本文整理汇总了C++中WcharMbcsConvertor::char2wchar方法的典型用法代码示例。如果您正苦于以下问题:C++ WcharMbcsConvertor::char2wchar方法的具体用法?C++ WcharMbcsConvertor::char2wchar怎么用?C++ WcharMbcsConvertor::char2wchar使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WcharMbcsConvertor
的用法示例。
在下文中一共展示了WcharMbcsConvertor::char2wchar方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: getMsgBoxLang
bool NativeLangSpeaker::getMsgBoxLang(const char *msgBoxTagName, generic_string & title, generic_string & message)
{
title = TEXT("");
message = TEXT("");
if (!_nativeLangA) return false;
TiXmlNodeA *msgBoxNode = _nativeLangA->FirstChild("MessageBox");
if (!msgBoxNode) return false;
msgBoxNode = searchDlgNode(msgBoxNode, msgBoxTagName);
if (!msgBoxNode) return false;
WcharMbcsConvertor *wmc = WcharMbcsConvertor::getInstance();
// Set Title
const char *titre = (msgBoxNode->ToElement())->Attribute("title");
const char *msg = (msgBoxNode->ToElement())->Attribute("message");
if ((titre && titre[0]) && (msg && msg[0]))
{
title = wmc->char2wchar(titre, _nativeLangEncoding);
message = wmc->char2wchar(msg, _nativeLangEncoding);
return true;
}
return false;
}
示例2: changeConfigLang
void NativeLangSpeaker::changeConfigLang(HWND hDlg)
{
if (!_nativeLangA) return;
TiXmlNodeA *styleConfDlgNode = _nativeLangA->FirstChild("Dialog");
if (!styleConfDlgNode) return;
styleConfDlgNode = styleConfDlgNode->FirstChild("StyleConfig");
if (!styleConfDlgNode) return;
WcharMbcsConvertor *wmc = WcharMbcsConvertor::getInstance();
// Set Title
const char *titre = (styleConfDlgNode->ToElement())->Attribute("title");
if ((titre && titre[0]) && hDlg)
{
const wchar_t *nameW = wmc->char2wchar(titre, _nativeLangEncoding);
::SetWindowText(hDlg, nameW);
}
for (TiXmlNodeA *childNode = styleConfDlgNode->FirstChildElement("Item");
childNode ;
childNode = childNode->NextSibling("Item") )
{
TiXmlElementA *element = childNode->ToElement();
int id;
const char *sentinel = element->Attribute("id", &id);
const char *name = element->Attribute("name");
if (sentinel && (name && name[0]))
{
HWND hItem = ::GetDlgItem(hDlg, id);
if (hItem)
{
const wchar_t *nameW = wmc->char2wchar(name, _nativeLangEncoding);
::SetWindowText(hItem, nameW);
}
}
}
styleConfDlgNode = styleConfDlgNode->FirstChild("SubDialog");
for (TiXmlNodeA *childNode = styleConfDlgNode->FirstChildElement("Item");
childNode ;
childNode = childNode->NextSibling("Item") )
{
TiXmlElementA *element = childNode->ToElement();
int id;
const char *sentinel = element->Attribute("id", &id);
const char *name = element->Attribute("name");
if (sentinel && (name && name[0]))
{
HWND hItem = ::GetDlgItem(hDlg, id);
if (hItem)
{
const wchar_t *nameW = wmc->char2wchar(name, _nativeLangEncoding);
::SetWindowText(hItem, nameW);
}
}
}
}
示例3: changePluginsAdminDlgLang
void NativeLangSpeaker::changePluginsAdminDlgLang(PluginsAdminDlg & pluginsAdminDlg)
{
if (_nativeLangA)
{
TiXmlNodeA *dlgNode = _nativeLangA->FirstChild("Dialog");
if (dlgNode)
{
dlgNode = searchDlgNode(dlgNode, "PluginsAdminDlg");
if (dlgNode)
{
WcharMbcsConvertor *wmc = WcharMbcsConvertor::getInstance();
TiXmlNodeA *ColumnPluginNode = dlgNode->FirstChild("ColumnPlugin");
if (ColumnPluginNode)
{
const char *name = (ColumnPluginNode->ToElement())->Attribute("name");
if (name && name[0])
{
basic_string<wchar_t> nameW = wmc->char2wchar(name, _nativeLangEncoding);
pluginsAdminDlg.changeColumnName(COLUMN_PLUGIN, nameW.c_str());
}
}
TiXmlNodeA *ColumnVersionNode = dlgNode->FirstChild("ColumnVersion");
if (ColumnVersionNode)
{
const char *name = (ColumnVersionNode->ToElement())->Attribute("name");
if (name && name[0])
{
basic_string<wchar_t> nameW = wmc->char2wchar(name, _nativeLangEncoding);
pluginsAdminDlg.changeColumnName(COLUMN_VERSION, nameW.c_str());
}
}
const char *titre1 = (dlgNode->ToElement())->Attribute("titleAvailable");
const char *titre2 = (dlgNode->ToElement())->Attribute("titleUpdates");
const char *titre3 = (dlgNode->ToElement())->Attribute("titleInstalled");
if (titre1 && titre1[0])
{
basic_string<wchar_t> nameW = wmc->char2wchar(titre1, _nativeLangEncoding);
pluginsAdminDlg.changeTabName(AVAILABLE_LIST, nameW.c_str());
}
if (titre2 && titre2[0])
{
basic_string<wchar_t> nameW = wmc->char2wchar(titre2, _nativeLangEncoding);
pluginsAdminDlg.changeTabName(UPDATES_LIST, nameW.c_str());
}
if (titre3 && titre3[0])
{
basic_string<wchar_t> nameW = wmc->char2wchar(titre3, _nativeLangEncoding);
pluginsAdminDlg.changeTabName(INSTALLED_LIST, nameW.c_str());
}
}
changeDlgLang(pluginsAdminDlg.getHSelf(), "PluginsAdminDlg");
}
}
}
示例4: changeLangTabDrapContextMenu
void NativeLangSpeaker::changeLangTabDrapContextMenu(HMENU hCM)
{
const int POS_GO2VIEW = 0;
const int POS_CLONE2VIEW = 1;
const char *goToViewA = NULL;
const char *cloneToViewA = NULL;
if (_nativeLangA)
{
TiXmlNodeA *tabBarMenu = _nativeLangA->FirstChild("Menu");
if (tabBarMenu)
tabBarMenu = tabBarMenu->FirstChild("TabBar");
if (tabBarMenu)
{
for (TiXmlNodeA *childNode = tabBarMenu->FirstChildElement("Item");
childNode ;
childNode = childNode->NextSibling("Item") )
{
TiXmlElementA *element = childNode->ToElement();
int ordre;
element->Attribute("order", &ordre);
if (ordre == 5)
goToViewA = element->Attribute("name");
else if (ordre == 6)
cloneToViewA = element->Attribute("name");
}
}
//HMENU hCM = _tabPopupDropMenu.getMenuHandle();
#ifdef UNICODE
WcharMbcsConvertor *wmc = WcharMbcsConvertor::getInstance();
if (goToViewA && goToViewA[0])
{
const wchar_t *goToViewG = wmc->char2wchar(goToViewA, _nativeLangEncoding);
int cmdID = ::GetMenuItemID(hCM, POS_GO2VIEW);
::ModifyMenu(hCM, POS_GO2VIEW, MF_BYPOSITION|MF_STRING, cmdID, goToViewG);
}
if (cloneToViewA && cloneToViewA[0])
{
const wchar_t *cloneToViewG = wmc->char2wchar(cloneToViewA, _nativeLangEncoding);
int cmdID = ::GetMenuItemID(hCM, POS_CLONE2VIEW);
::ModifyMenu(hCM, POS_CLONE2VIEW, MF_BYPOSITION|MF_STRING, cmdID, cloneToViewG);
}
#else
if (goToViewA && goToViewA[0])
{
int cmdID = ::GetMenuItemID(hCM, POS_GO2VIEW);
::ModifyMenu(hCM, POS_GO2VIEW, MF_BYPOSITION, cmdID, goToViewA);
}
if (cloneToViewA && cloneToViewA[0])
{
int cmdID = ::GetMenuItemID(hCM, POS_CLONE2VIEW);
::ModifyMenu(hCM, POS_CLONE2VIEW, MF_BYPOSITION, cmdID, cloneToViewA);
}
#endif
}
}
示例5: changeDlgLang
bool NativeLangSpeaker::changeDlgLang(HWND hDlg, const char *dlgTagName, char *title)
{
if (title)
title[0] = '\0';
if (!_nativeLangA) return false;
TiXmlNodeA *dlgNode = _nativeLangA->FirstChild("Dialog");
if (!dlgNode) return false;
dlgNode = searchDlgNode(dlgNode, dlgTagName);
if (!dlgNode) return false;
#ifdef UNICODE
WcharMbcsConvertor *wmc = WcharMbcsConvertor::getInstance();
#endif
// Set Title
const char *titre = (dlgNode->ToElement())->Attribute("title");
if ((titre && titre[0]) && hDlg)
{
#ifdef UNICODE
const wchar_t *nameW = wmc->char2wchar(titre, _nativeLangEncoding);
::SetWindowText(hDlg, nameW);
#else
::SetWindowText(hDlg, titre);
#endif
if (title)
strcpy(title, titre);
}
// Set the text of child control
for (TiXmlNodeA *childNode = dlgNode->FirstChildElement("Item");
childNode ;
childNode = childNode->NextSibling("Item") )
{
TiXmlElementA *element = childNode->ToElement();
int id;
const char *sentinel = element->Attribute("id", &id);
const char *name = element->Attribute("name");
if (sentinel && (name && name[0]))
{
HWND hItem = ::GetDlgItem(hDlg, id);
if (hItem)
{
#ifdef UNICODE
const wchar_t *nameW = wmc->char2wchar(name, _nativeLangEncoding);
::SetWindowText(hItem, nameW);
#else
::SetWindowText(hItem, name);
#endif
}
}
}
return true;
}
示例6: changeShortcutmapperLang
void NativeLangSpeaker::changeShortcutmapperLang(ShortcutMapper * sm)
{
if (!_nativeLangA) return;
TiXmlNodeA *shortcuts = _nativeLangA->FirstChild("Dialog");
if (!shortcuts) return;
shortcuts = shortcuts->FirstChild("ShortcutMapper");
if (!shortcuts) return;
for (TiXmlNodeA *childNode = shortcuts->FirstChildElement("Item");
childNode ;
childNode = childNode->NextSibling("Item") )
{
TiXmlElementA *element = childNode->ToElement();
int index;
if (element->Attribute("index", &index))
{
if (index > -1 && index < 5) //valid index only
{
const char *name = element->Attribute("name");
WcharMbcsConvertor *wmc = WcharMbcsConvertor::getInstance();
const wchar_t * nameW = wmc->char2wchar(name, _nativeLangEncoding);
sm->translateTab(index, nameW);
}
}
}
}
示例7: getFileBrowserLangMenuStr
generic_string NativeLangSpeaker::getFileBrowserLangMenuStr(int cmdID, const TCHAR *defaultStr) const
{
if (!_nativeLangA) return defaultStr;
TiXmlNodeA *targetNode = _nativeLangA->FirstChild("FolderAsWorkspace");
if (!targetNode) return defaultStr;
targetNode = targetNode->FirstChild("Menus");
if (!targetNode) return defaultStr;
const char *name = NULL;
for (TiXmlNodeA *childNode = targetNode->FirstChildElement("Item");
childNode;
childNode = childNode->NextSibling("Item"))
{
TiXmlElementA *element = childNode->ToElement();
int id;
const char *idStr = element->Attribute("id", &id);
if (idStr && id == cmdID)
{
name = element->Attribute("name");
break;
}
}
if (name && name[0])
{
WcharMbcsConvertor *wmc = WcharMbcsConvertor::getInstance();
return wmc->char2wchar(name, _nativeLangEncoding);
}
return defaultStr;
}
示例8: getSpecialMenuEntryName
generic_string NativeLangSpeaker::getSpecialMenuEntryName(const char *entryName) const
{
if (!_nativeLangA) return TEXT("");
TiXmlNodeA *mainMenu = _nativeLangA->FirstChild("Menu");
if (!mainMenu) return TEXT("");
mainMenu = mainMenu->FirstChild("Main");
if (!mainMenu) return TEXT("");
TiXmlNodeA *entriesRoot = mainMenu->FirstChild("Entries");
if (!entriesRoot) return TEXT("");
WcharMbcsConvertor *wmc = WcharMbcsConvertor::getInstance();
for (TiXmlNodeA *childNode = entriesRoot->FirstChildElement("Item");
childNode ;
childNode = childNode->NextSibling("Item") )
{
TiXmlElementA *element = childNode->ToElement();
const char *idName = element->Attribute("idName");
if (idName)
{
const char *name = element->Attribute("name");
if (!strcmp(idName, entryName))
{
return wmc->char2wchar(name, _nativeLangEncoding);
}
}
}
return TEXT("");
}
示例9: getNativeLangMenuString
generic_string NativeLangSpeaker::getNativeLangMenuString(int itemID) const
{
if (!_nativeLangA)
return TEXT("");
TiXmlNodeA *node = _nativeLangA->FirstChild("Menu");
if (!node) return TEXT("");
node = node->FirstChild("Main");
if (!node) return TEXT("");
node = node->FirstChild("Commands");
if (!node) return TEXT("");
WcharMbcsConvertor *wmc = WcharMbcsConvertor::getInstance();
for (TiXmlNodeA *childNode = node->FirstChildElement("Item");
childNode ;
childNode = childNode->NextSibling("Item") )
{
TiXmlElementA *element = childNode->ToElement();
int id;
if (element->Attribute("id", &id) && (id == itemID))
{
const char *name = element->Attribute("name");
if (name)
{
return wmc->char2wchar(name, _nativeLangEncoding);
}
}
}
return TEXT("");
}
示例10: changeStyleCtrlsLang
void NativeLangSpeaker::changeStyleCtrlsLang(HWND hDlg, int *idArray, const char **translatedText)
{
const int iColorStyle = 0;
const int iUnderline = 8;
HWND hItem;
for (int i = iColorStyle ; i < (iUnderline + 1) ; i++)
{
if (translatedText[i] && translatedText[i][0])
{
hItem = ::GetDlgItem(hDlg, idArray[i]);
if (hItem)
{
#ifdef UNICODE
WcharMbcsConvertor *wmc = WcharMbcsConvertor::getInstance();
const wchar_t *nameW = wmc->char2wchar(translatedText[i], _nativeLangEncoding);
::SetWindowText(hItem, nameW);
#else
::SetWindowText(hItem, translatedText[i]);
#endif
}
}
}
}
示例11: changeFindReplaceDlgLang
void NativeLangSpeaker::changeFindReplaceDlgLang(FindReplaceDlg & findReplaceDlg)
{
if (_nativeLangA)
{
TiXmlNodeA *dlgNode = _nativeLangA->FirstChild("Dialog");
if (dlgNode)
{
NppParameters *pNppParam = NppParameters::getInstance();
dlgNode = searchDlgNode(dlgNode, "Find");
if (dlgNode)
{
const char *titre1 = (dlgNode->ToElement())->Attribute("titleFind");
const char *titre2 = (dlgNode->ToElement())->Attribute("titleReplace");
const char *titre3 = (dlgNode->ToElement())->Attribute("titleFindInFiles");
const char *titre4 = (dlgNode->ToElement())->Attribute("titleMark");
WcharMbcsConvertor *wmc = WcharMbcsConvertor::getInstance();
if (titre1 && titre1[0])
{
basic_string<wchar_t> nameW = wmc->char2wchar(titre1, _nativeLangEncoding);
pNppParam->getFindDlgTabTitiles()._find = nameW;
findReplaceDlg.changeTabName(FIND_DLG, pNppParam->getFindDlgTabTitiles()._find.c_str());
}
if (titre2 && titre2[0])
{
basic_string<wchar_t> nameW = wmc->char2wchar(titre2, _nativeLangEncoding);
pNppParam->getFindDlgTabTitiles()._replace = nameW;
findReplaceDlg.changeTabName(REPLACE_DLG, pNppParam->getFindDlgTabTitiles()._replace.c_str());
}
if (titre3 && titre3[0])
{
basic_string<wchar_t> nameW = wmc->char2wchar(titre3, _nativeLangEncoding);
pNppParam->getFindDlgTabTitiles()._findInFiles = nameW;
findReplaceDlg.changeTabName(FINDINFILES_DLG, pNppParam->getFindDlgTabTitiles()._findInFiles.c_str());
}
if (titre4 && titre4[0])
{
basic_string<wchar_t> nameW = wmc->char2wchar(titre4, _nativeLangEncoding);
pNppParam->getFindDlgTabTitiles()._mark = nameW;
findReplaceDlg.changeTabName(MARK_DLG, pNppParam->getFindDlgTabTitiles()._mark.c_str());
}
}
}
}
changeDlgLang(findReplaceDlg.getHSelf(), "Find");
}
示例12: changeDlgLang
bool WindowsDlg::changeDlgLang()
{
if (!_dlgNode) return false;
WcharMbcsConvertor *wmc = WcharMbcsConvertor::getInstance();
int nativeLangEncoding = CP_ACP;
TiXmlDeclarationA *declaration = _dlgNode->GetDocument()->FirstChild()->ToDeclaration();
if (declaration)
{
const char * encodingStr = declaration->Encoding();
EncodingMapper *em = EncodingMapper::getInstance();
nativeLangEncoding = em->getEncodingFromString(encodingStr);
}
// Set Title
const char *titre = (_dlgNode->ToElement())->Attribute("title");
if (titre && titre[0])
{
const wchar_t *nameW = wmc->char2wchar(titre, nativeLangEncoding);
::SetWindowText(_hSelf, nameW);
}
// Set the text of child control
for (TiXmlNodeA *childNode = _dlgNode->FirstChildElement("Item");
childNode ;
childNode = childNode->NextSibling("Item") )
{
TiXmlElementA *element = childNode->ToElement();
int id;
const char *sentinel = element->Attribute("id", &id);
const char *name = element->Attribute("name");
if (sentinel && (name && name[0]))
{
HWND hItem = ::GetDlgItem(_hSelf, id);
if (hItem)
{
const wchar_t *nameW = wmc->char2wchar(name, nativeLangEncoding);
::SetWindowText(hItem, nameW);
}
}
}
return true;
}
示例13: getAttrNameStr
generic_string NativeLangSpeaker::getAttrNameStr(const TCHAR *defaultStr, const char *nodeL1Name, const char *nodeL2Name) const
{
if (!_nativeLangA) return defaultStr;
TiXmlNodeA *targetNode = _nativeLangA->FirstChild(nodeL1Name);
if (!targetNode) return defaultStr;
if (nodeL2Name)
targetNode = targetNode->FirstChild(nodeL2Name);
if (!targetNode) return defaultStr;
const char *name = (targetNode->ToElement())->Attribute("name");
if (name && name[0])
{
WcharMbcsConvertor *wmc = WcharMbcsConvertor::getInstance();
return wmc->char2wchar(name, _nativeLangEncoding);
}
return defaultStr;
}
示例14: getProjectPanelLangMenuStr
generic_string NativeLangSpeaker::getProjectPanelLangMenuStr(const char * nodeName, int cmdID, const TCHAR *defaultStr) const
{
if (!_nativeLangA) return defaultStr;
TiXmlNodeA *targetNode = _nativeLangA->FirstChild("ProjectManager");
if (!targetNode) return defaultStr;
targetNode = targetNode->FirstChild("Menus");
if (!targetNode) return defaultStr;
targetNode = targetNode->FirstChild(nodeName);
if (!targetNode) return defaultStr;
const char *name = NULL;
for (TiXmlNodeA *childNode = targetNode->FirstChildElement("Item");
childNode ;
childNode = childNode->NextSibling("Item") )
{
TiXmlElementA *element = childNode->ToElement();
int id;
const char *idStr = element->Attribute("id", &id);
if (idStr && id == cmdID)
{
name = element->Attribute("name");
break;
}
}
if (name && name[0])
{
#ifdef UNICODE
WcharMbcsConvertor *wmc = WcharMbcsConvertor::getInstance();
return wmc->char2wchar(name, _nativeLangEncoding);
#else
return name;
#endif
}
return defaultStr;
}
示例15: getLocalizedStrFromID
generic_string NativeLangSpeaker::getLocalizedStrFromID(const char *strID, const generic_string& defaultString) const
{
if (not _nativeLangA)
return defaultString;
if (not strID)
return defaultString;
TiXmlNodeA *node = _nativeLangA->FirstChild("MiscStrings");
if (not node) return defaultString;
node = node->FirstChild(strID);
if (not node) return defaultString;
TiXmlElementA *element = node->ToElement();
const char *value = element->Attribute("value");
if (not value) return defaultString;
WcharMbcsConvertor *wmc = WcharMbcsConvertor::getInstance();
return wmc->char2wchar(value, _nativeLangEncoding);
}