本文整理汇总了C++中StringBuffer::null方法的典型用法代码示例。如果您正苦于以下问题:C++ StringBuffer::null方法的具体用法?C++ StringBuffer::null怎么用?C++ StringBuffer::null使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类StringBuffer
的用法示例。
在下文中一共展示了StringBuffer::null方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: parseCmdline
bool FSyncOpt::parseCmdline(int args_num, char** args_val)
{
if (parser.parse(args_num, const_cast<const char **>(args_val), opts, args) == false) {
return false;
}
if (optionSet("verbose")) {
verbose = VERBOSE;
} else if (optionSet("quiet")) {
verbose = QUIET;
}
FSyncConfig *config = FSyncConfig::getInstance();
// Get log options
StringBuffer logLevelName = opts["loglevel"];
if (!logLevelName.null()) {
LogLevel logLevel;
if (logLevelName == "error") {
logLevel = LOG_LEVEL_NONE;
} else if (logLevelName == "info") {
logLevel = LOG_LEVEL_INFO;
} else if (logLevelName == "debug") {
logLevel = LOG_LEVEL_DEBUG;
} else {
fprintf(stderr, "%s: unrecognized log level: '%s'\n",
parser.getProgramName().c_str(), logLevelName.c_str());
exit(EXIT_FAILURE);
}
config->getDeviceConfig().setLogLevel(logLevel);
LOG.setLevel(config->getDeviceConfig().getLogLevel());
}
// Get server option
StringBuffer serverUrl = opts["server"];
if (!serverUrl.null()) {
config->getAccessConfig().setSyncURL(serverUrl);
}
// Get local dir
StringBuffer dir = opts["dir"];
if (!dir.null()) {
config->setSyncPath(dir);
// TODO: reset anchors if different.
}
// Get username
StringBuffer user = opts["user"];
if (!user.null()) {
config->getAccessConfig().setUsername(user);
}
// Get password (not secure, it's an example!)
StringBuffer pass = opts["password"];
if (!pass.null()) {
config->getAccessConfig().setPassword(pass);
}
return true;
}
示例2: testEmpty
//////////////////////////////////////////////////////// Test /////
// Test null() and empty() behavior
void testEmpty() {
StringBuffer s;
CPPUNIT_ASSERT(s.empty());
CPPUNIT_ASSERT(s.null());
s = "";
CPPUNIT_ASSERT( s.empty() );
CPPUNIT_ASSERT( !s.null() );
}
示例3: saveSettings
bool CCalendarSettings::saveSettings(bool saveToDisk)
{
CString remoteName, outlookFolder, syncType;
CString s1;
_bstr_t bst;
WindowsSyncSourceConfig* ssconf = ((OutlookConfig*)getConfig())->getSyncSourceConfig(APPOINTMENT_);
GetDlgItemText(IDC_CALENDAR_EDIT_REMOTE, remoteName);
GetDlgItemText(IDC_CALENDAR_EDIT_FOLDER, outlookFolder);
// change values
if(remoteName == ""){
// remote name is empty
s1.LoadString(IDS_ERROR_SET_REMOTE_NAME);
wsafeMessageBox(s1);
return false;
}
if (UICustomization::showWarningOnChangeFromOneWay) {
int currentSyncType = getSyncTypeIndex(ssconf->getSync());
int newSyncType = lstSyncType.GetCurSel();
if (checkOneWayToTwoWay(currentSyncType, newSyncType)) {
return false;
}
}
// sync source enabled
ssconf->setSync(getSyncTypeName(lstSyncType.GetCurSel()));
// Date Filter
int filterPos = lstFilter.GetCurSel();
ssconf->getDateFilter().setRelativeLowerDate(getDateFilterValue(filterPos));
// Note: use 'toMultibyte' which uses charset UTF-8.
// (when writing to winreg, toWideChar is then called)
char* olFolder = toMultibyte(outlookFolder.GetBuffer());
if (olFolder) {
// If folder has changed, clear anchors
if (UICustomization::clearAnchorsOnFolderChange) {
const char * original = ssconf->getFolderPath();
if (strcmp(original, olFolder) != 0) {
ssconf->setLast(0);
ssconf->setEndTimestamp(0);
}
}
ssconf->setFolderPath(olFolder);
delete [] olFolder;
}
if(checkInclude.GetCheck() == BST_CHECKED){
ssconf->setUseSubfolders(true);
}
else {
ssconf->setUseSubfolders(false);
}
StringBuffer remName;
remName.convert(remoteName.GetBuffer());
if (!remName.null()) {
ssconf->setURI(remName.c_str());
}
// Never save to winreg, will save when 'OK' is clicked on SyncSettings.
//if(saveToDisk)
// ((OutlookConfig*)getConfig())->save();
return true;
}