本文整理汇总了C++中WordList::Clear方法的典型用法代码示例。如果您正苦于以下问题:C++ WordList::Clear方法的具体用法?C++ WordList::Clear怎么用?C++ WordList::Clear使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WordList
的用法示例。
在下文中一共展示了WordList::Clear方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: onEditCompleteWord
void Model::onEditCompleteWord()
{
if (!static_cast<ModelStyle*>(m_pStyle)->autoComplete.useAutoComplete)
return;
setFocus();
std::string primaryKwList = getAllKW();
WordList fullWordList;
fullWordList.Set(primaryKwList.c_str());
fullWordList.InList("");
primaryKwList = "";
typedef std::vector<std::string> string_list;
class compareStringScintilla {
public:
bool operator()(std::string A, std::string B) {
return CompareNCaseInsensitive(A.c_str(), B.c_str(), A.length()) < 0;
}
};
compareStringScintilla functor;
WordListUtil getList(fullWordList);
string_list basicList = getList.getNearestWords(std::string());
std::sort(basicList.begin(), basicList.end(), functor);
for (string_list::const_iterator it = basicList.begin(); it != basicList.end(); ++it)
{
primaryKwList += *it;
if (it != basicList.end() - 1)
{
primaryKwList += " ";
}
}
char currentLine[8000];
int line = getCurrentLineNumber();
sendEditor(SCI_GETLINE, line, reinterpret_cast<long>(currentLine));
int currentPos = getCurrentPos() - getPositionFromLine(line);
currentLine[currentPos] = '\0';
int startPos = currentPos;
int identifierLength = 0;
std::wstring wCurrentLine = rdo::locale::convertToWStr(currentLine);
std::wstring::const_reverse_iterator wCharIt = wCurrentLine.rbegin();
while (wCharIt != wCurrentLine.rend())
{
if (!rdo::gui::lexer::isIdentifier(*wCharIt))
break;
++identifierLength;
++wCharIt;
}
startPos -= rdo::locale::convertFromWStr(wCurrentLine.substr(wCurrentLine.length() - identifierLength)).length();
const char* userPattern = currentLine + startPos;
unsigned int userPatternLength = currentPos - startPos;
string_list prioritySortedKwList = getList.getNearestWords(userPattern);
if (prioritySortedKwList.empty())
{
prioritySortedKwList = basicList;
}
string_list::const_iterator it = prioritySortedKwList.begin();
std::string stWord = *it;
std::sort(prioritySortedKwList.begin(), prioritySortedKwList.end(), functor);
std::string foundKeyWords = "";
for (string_list::const_iterator it = prioritySortedKwList.begin(); it != prioritySortedKwList.end(); ++it)
{
foundKeyWords += (*it);
if (it != prioritySortedKwList.end() - 1)
{
foundKeyWords += " ";
}
}
const char* list;
if (static_cast<ModelStyle*>(m_pStyle)->autoComplete.showFullList)
{
list = primaryKwList.c_str();
}
else
{
list = foundKeyWords.c_str();
if (!list)
{
list = primaryKwList.c_str();
}
}
if (list)
{
std::string startKeyWord = "";
std::string startKeyWordScroll = stWord;
bool useReplace = false;
if (foundKeyWords.c_str())
{
fullWordList.Clear();
fullWordList.Set(foundKeyWords.c_str());
//.........这里部分代码省略.........