本文整理汇总了C++中NppParameters::getExternalLexerDoc方法的典型用法代码示例。如果您正苦于以下问题:C++ NppParameters::getExternalLexerDoc方法的具体用法?C++ NppParameters::getExternalLexerDoc怎么用?C++ NppParameters::getExternalLexerDoc使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NppParameters
的用法示例。
在下文中一共展示了NppParameters::getExternalLexerDoc方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: loadPlugin
//.........这里部分代码省略.........
char lexName[MAX_EXTERNAL_LEXER_NAME_LEN];
lexName[0] = '\0';
TCHAR lexDesc[MAX_EXTERNAL_LEXER_DESC_LEN];
lexDesc[0] = '\0';
int numLexers = GetLexerCount();
NppParameters * nppParams = NppParameters::getInstance();
ExternalLangContainer *containers[30];
#ifdef UNICODE
WcharMbcsConvertor *wmc = WcharMbcsConvertor::getInstance();
#endif
for (int x = 0; x < numLexers; x++)
{
GetLexerName(x, lexName, MAX_EXTERNAL_LEXER_NAME_LEN);
GetLexerStatusText(x, lexDesc, MAX_EXTERNAL_LEXER_DESC_LEN);
#ifdef UNICODE
const TCHAR *pLexerName = wmc->char2wchar(lexName, CP_ACP);
#else
const TCHAR *pLexerName = lexName;
#endif
if (!nppParams->isExistingExternalLangName(pLexerName) && nppParams->ExternalLangHasRoom())
containers[x] = new ExternalLangContainer(pLexerName, lexDesc);
else
containers[x] = NULL;
}
TCHAR xmlPath[MAX_PATH];
lstrcpy(xmlPath, nppParams->getNppPath().c_str());
PathAppend(xmlPath, TEXT("plugins\\Config"));
PathAppend(xmlPath, pi->_moduleName.c_str());
PathRemoveExtension(xmlPath);
PathAddExtension(xmlPath, TEXT(".xml"));
if (!PathFileExists(xmlPath))
{
memset(xmlPath, 0, MAX_PATH * sizeof(TCHAR));
lstrcpy(xmlPath, nppParams->getAppDataNppDir() );
PathAppend(xmlPath, TEXT("plugins\\Config"));
PathAppend(xmlPath, pi->_moduleName.c_str());
PathRemoveExtension( xmlPath );
PathAddExtension( xmlPath, TEXT(".xml") );
if (! PathFileExists( xmlPath ) )
{
throw generic_string(generic_string(xmlPath) + TEXT(" is missing."));
}
}
TiXmlDocument *_pXmlDoc = new TiXmlDocument(xmlPath);
if (!_pXmlDoc->LoadFile())
{
delete _pXmlDoc;
_pXmlDoc = NULL;
throw generic_string(generic_string(xmlPath) + TEXT(" failed to load."));
}
for (int x = 0; x < numLexers; x++) // postpone adding in case the xml is missing/corrupt
if (containers[x] != NULL)
nppParams->addExternalLangToEnd(containers[x]);
nppParams->getExternalLexerFromXmlTree(_pXmlDoc);
nppParams->getExternalLexerDoc()->push_back(_pXmlDoc);
#ifdef UNICODE
const char *pDllName = wmc->wchar2char(pluginFilePath.c_str(), CP_ACP);
#else
const char *pDllName = pluginFilePath.c_str();
#endif
::SendMessage(_nppData._scintillaMainHandle, SCI_LOADLEXERLIBRARY, 0, (LPARAM)pDllName);
}
_pluginInfos.push_back(pi);
return (_pluginInfos.size() - 1);
}
catch(generic_string s)
{
s += TEXT("\n\n");
s += USERMSG;
if (::MessageBox(NULL, s.c_str(), pluginFilePath.c_str(), MB_YESNO) == IDYES)
{
dll2Remove.push_back(pluginFilePath);
}
delete pi;
return -1;
}
catch(...)
{
generic_string msg = TEXT("Fail loaded");
msg += TEXT("\n\n");
msg += USERMSG;
if (::MessageBox(NULL, msg.c_str(), pluginFilePath.c_str(), MB_YESNO) == IDYES)
{
dll2Remove.push_back(pluginFilePath);
}
delete pi;
return -1;
}
}
示例2: loadPlugin
//.........这里部分代码省略.........
// Assign a buffer for the lexer name.
char lexName[MAX_EXTERNAL_LEXER_NAME_LEN];
lexName[0] = '\0';
TCHAR lexDesc[MAX_EXTERNAL_LEXER_DESC_LEN];
lexDesc[0] = '\0';
int numLexers = GetLexerCount();
ExternalLangContainer *containers[30];
WcharMbcsConvertor *wmc = WcharMbcsConvertor::getInstance();
for (int x = 0; x < numLexers; ++x)
{
GetLexerName(x, lexName, MAX_EXTERNAL_LEXER_NAME_LEN);
GetLexerStatusText(x, lexDesc, MAX_EXTERNAL_LEXER_DESC_LEN);
const TCHAR *pLexerName = wmc->char2wchar(lexName, CP_ACP);
if (!nppParams->isExistingExternalLangName(pLexerName) && nppParams->ExternalLangHasRoom())
containers[x] = new ExternalLangContainer(pLexerName, lexDesc);
else
containers[x] = NULL;
}
TCHAR xmlPath[MAX_PATH];
lstrcpy(xmlPath, nppParams->getNppPath().c_str());
PathAppend(xmlPath, TEXT("plugins\\Config"));
PathAppend(xmlPath, pi->_moduleName.c_str());
PathRemoveExtension(xmlPath);
PathAddExtension(xmlPath, TEXT(".xml"));
if (!PathFileExists(xmlPath))
{
lstrcpyn(xmlPath, TEXT("\0"), MAX_PATH );
lstrcpy(xmlPath, nppParams->getAppDataNppDir() );
PathAppend(xmlPath, TEXT("plugins\\Config"));
PathAppend(xmlPath, pi->_moduleName.c_str());
PathRemoveExtension( xmlPath );
PathAddExtension( xmlPath, TEXT(".xml") );
if (! PathFileExists( xmlPath ) )
{
throw generic_string(generic_string(xmlPath) + TEXT(" is missing."));
}
}
TiXmlDocument *pXmlDoc = new TiXmlDocument(xmlPath);
if (!pXmlDoc->LoadFile())
{
delete pXmlDoc;
pXmlDoc = NULL;
throw generic_string(generic_string(xmlPath) + TEXT(" failed to load."));
}
for (int x = 0; x < numLexers; ++x) // postpone adding in case the xml is missing/corrupt
{
if (containers[x] != NULL)
nppParams->addExternalLangToEnd(containers[x]);
}
nppParams->getExternalLexerFromXmlTree(pXmlDoc);
nppParams->getExternalLexerDoc()->push_back(pXmlDoc);
const char *pDllName = wmc->wchar2char(pluginFilePath, CP_ACP);
::SendMessage(_nppData._scintillaMainHandle, SCI_LOADLEXERLIBRARY, 0, reinterpret_cast<LPARAM>(pDllName));
}
addInLoadedDlls(pluginFilePath, pluginFileName);
_pluginInfos.push_back(pi);
return static_cast<int32_t>(_pluginInfos.size() - 1);
}
catch (std::exception& e)
{
::MessageBoxA(NULL, e.what(), "Exception", MB_OK);
return -1;
}
catch (generic_string s)
{
s += TEXT("\n\n");
s += pluginFileName;
s += USERMSG;
if (::MessageBox(NULL, s.c_str(), pluginFilePath, MB_YESNO) == IDYES)
{
dll2Remove.push_back(pluginFilePath);
}
delete pi;
return -1;
}
catch (...)
{
generic_string msg = TEXT("Failed to load");
msg += TEXT("\n\n");
msg += pluginFileName;
msg += USERMSG;
if (::MessageBox(NULL, msg.c_str(), pluginFilePath, MB_YESNO) == IDYES)
{
dll2Remove.push_back(pluginFilePath);
}
delete pi;
return -1;
}
}