本文整理汇总了C++中Lang::getLangName方法的典型用法代码示例。如果您正苦于以下问题:C++ Lang::getLangName方法的具体用法?C++ Lang::getLangName怎么用?C++ Lang::getLangName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Lang
的用法示例。
在下文中一共展示了Lang::getLangName方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: getLangFromExt
LangType Buffer::getLangFromExt(const char *ext)
{
NppParameters *pNppParam = NppParameters::getInstance();
int i = pNppParam->getNbLang();
i--;
while (i >= 0)
{
Lang *l = pNppParam->getLangFromIndex(i--);
const char *defList = l->getDefaultExtList();
const char *userList = NULL;
LexerStylerArray &lsa = pNppParam->getLStylerArray();
const char *lName = l->getLangName();
LexerStyler *pLS = lsa.getLexerStylerByName(lName);
if (pLS)
userList = pLS->getLexerUserExt();
std::string list("");
if (defList)
list += defList;
if (userList)
{
list += " ";
list += userList;
}
if (isInList(ext, list.c_str()))
return l->getLangID();
}
return L_TXT;
}
示例2: run_dlgProc
//.........这里部分代码省略.........
if (len < pLvdi->item.cchTextMax)
{
pLvdi->item.pszText[len++] = '*';
pLvdi->item.pszText[len] = 0;
}
}
else if (buf->isReadOnly())
{
len += lstrlen(readonlyString);
if (len <= pLvdi->item.cchTextMax)
lstrcat(pLvdi->item.pszText, readonlyString);
}
}
else if (pLvdi->item.iSubItem == 1) // directory
{
const TCHAR *fullName = buf->getFullPathName();
const TCHAR *fileName = buf->getFileName();
int len = lstrlen(fullName)-lstrlen(fileName);
if (!len) {
len = 1;
fullName = TEXT("");
}
if (pLvdi->item.cchTextMax < len)
len = pLvdi->item.cchTextMax;
generic_strncpy(pLvdi->item.pszText, fullName, len-1);
pLvdi->item.pszText[len-1] = 0;
}
else if (pLvdi->item.iSubItem == 2) // Type
{
int len = pLvdi->item.cchTextMax;
NppParameters *pNppParameters = NppParameters::getInstance();
Lang *lang = pNppParameters->getLangFromID(buf->getLangType());
if (NULL != lang)
{
generic_strncpy(pLvdi->item.pszText, lang->getLangName(), len-1);
}
}
}
return TRUE;
}
else if (pNMHDR->code == LVN_COLUMNCLICK) // sort columns with stable sort
{
NMLISTVIEW *pNMLV = (NMLISTVIEW *)pNMHDR;
if (pNMLV->iItem == -1)
{
bool reverse = false;
int iColumn = pNMLV->iSubItem;
if (_lastSort == iColumn)
{
reverse = true;
_lastSort = -1;
}
else
{
_lastSort = iColumn;
}
int i;
int n = _idxMap.size();
vector<int> sortMap;
sortMap.resize(n);
for (i=0; i<n; ++i) sortMap[_idxMap[i]] = ListView_GetItemState(_hList, i, LVIS_SELECTED);
stable_sort(_idxMap.begin(), _idxMap.end(), BufferEquivalent(_pTab, iColumn, reverse));
for (i=0; i<n; ++i) ListView_SetItemState(_hList, i, sortMap[_idxMap[i]] ? LVIS_SELECTED : 0, LVIS_SELECTED);
::InvalidateRect(_hList, &_rc, FALSE);
_isSorted = true;
updateButtonState();
}
return TRUE;
}
else if (pNMHDR->code == LVN_ITEMACTIVATE || pNMHDR->code == LVN_ITEMCHANGED || pNMHDR->code == LVN_ODSTATECHANGED)
{
updateButtonState();
return TRUE;
}
else if (pNMHDR->code == NM_DBLCLK)
{
::PostMessage(_hSelf, WM_COMMAND, IDOK, 0);
return TRUE;
}
else if (pNMHDR->code == LVN_KEYDOWN)
{
NMLVKEYDOWN *lvkd = (NMLVKEYDOWN *)pNMHDR;
// Ctrl+A
short ctrl = GetKeyState(VK_CONTROL);
short alt = GetKeyState(VK_MENU);
short shift = GetKeyState(VK_SHIFT);
if (lvkd->wVKey == 0x41/*a*/ && ctrl<0 && alt>=0 && shift>=0)
{
for (int i=0, n=ListView_GetItemCount(_hList); i<n; ++i)
ListView_SetItemState(_hList, i, LVIS_SELECTED, LVIS_SELECTED);
}
return TRUE;
}
}
break;
}
}
return MyBaseClass::run_dlgProc(message, wParam, lParam);
}
示例3: setFileOpenSaveDlgFilters
int Notepad_plus::setFileOpenSaveDlgFilters(FileDialog & fDlg, int langType)
{
NppParameters *pNppParam = NppParameters::getInstance();
NppGUI & nppGUI = (NppGUI & )pNppParam->getNppGUI();
int i = 0;
Lang *l = NppParameters::getInstance()->getLangFromIndex(i++);
int ltIndex = 0;
bool ltFound = false;
while (l)
{
LangType lid = l->getLangID();
bool inExcludedList = false;
for (size_t j = 0 ; j < nppGUI._excludedLangList.size() ; j++)
{
if (lid == nppGUI._excludedLangList[j]._langType)
{
inExcludedList = true;
break;
}
}
if (!inExcludedList)
{
const TCHAR *defList = l->getDefaultExtList();
const TCHAR *userList = NULL;
LexerStylerArray &lsa = (NppParameters::getInstance())->getLStylerArray();
const TCHAR *lName = l->getLangName();
LexerStyler *pLS = lsa.getLexerStylerByName(lName);
if (pLS)
userList = pLS->getLexerUserExt();
generic_string list(TEXT(""));
if (defList)
list += defList;
if (userList)
{
list += TEXT(" ");
list += userList;
}
generic_string stringFilters = exts2Filters(list);
const TCHAR *filters = stringFilters.c_str();
if (filters[0])
{
fDlg.setExtsFilter(getLangDesc(lid, true).c_str(), filters);
//
// Get index of lang type to find
//
if (langType != -1 && !ltFound)
{
ltFound = langType == lid;
}
if (langType != -1 && !ltFound)
{
ltIndex++;
}
}
}
l = (NppParameters::getInstance())->getLangFromIndex(i++);
}
if (!ltFound)
return -1;
return ltIndex;
}