本文整理汇总了C++中wstring::GetBuffer方法的典型用法代码示例。如果您正苦于以下问题:C++ wstring::GetBuffer方法的具体用法?C++ wstring::GetBuffer怎么用?C++ wstring::GetBuffer使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类wstring
的用法示例。
在下文中一共展示了wstring::GetBuffer方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: saveSettings
bool CContactSettings::saveSettings(bool saveToDisk)
{
CString remoteName, outlookFolder, syncType;
CString s1;
_bstr_t bst;
bool useSif;
WindowsSyncSourceConfig* ssconf = ((OutlookConfig*)getConfig())->getSyncSourceConfig(CONTACT_);
GetDlgItemText(IDC_CONTACTS_EDIT_REMOTE, remoteName);
GetDlgItemText(IDC_CONTACTS_EDIT_FOLDER, outlookFolder);
// change values
if(remoteName == ""){
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()));
// 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 || UICustomization::forceUseSubfolders)
ssconf->setUseSubfolders(true);
else
ssconf->setUseSubfolders(false);
char* remName = toMultibyte(remoteName.GetBuffer());
if (remName) {
ssconf->setURI(remName);
delete [] remName;
}
if(radioSif.GetCheck() == BST_CHECKED)
useSif = true;
else
useSif = false;
// Data formats
if(useSif){
char* version = toMultibyte(SIF_VERSION);
ssconf->setType("text/x-s4j-sifc");
ssconf->setVersion(version);
ssconf->setEncoding("b64");
delete [] version;
}
else{
char* version = toMultibyte(VCARD_VERSION);
ssconf->setType("text/x-vcard");
ssconf->setVersion(version);
// When encryption is used, encoding is always 'base64'.
if ( !strcmp(ssconf->getEncryption(), "") ) {
ssconf->setEncoding("bin");
}
else {
ssconf->setEncoding("b64");
}
delete [] version;
}
// Never save to winreg, will save when 'OK' is clicked on SyncSettings.
//if(saveToDisk)
// ((OutlookConfig*)getConfig())->save();
return true;
}
示例2: 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;
}