本文整理汇总了C++中WordList::push_back方法的典型用法代码示例。如果您正苦于以下问题:C++ WordList::push_back方法的具体用法?C++ WordList::push_back怎么用?C++ WordList::push_back使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WordList
的用法示例。
在下文中一共展示了WordList::push_back方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
const WordList layprop::ViewProperties::getAllLayers(void)
{
//drawprop._layset
WordList listLayers;
laySetList::const_iterator it;
for( it = _drawprop._layset.begin(); it != _drawprop._layset.end(); ++it)
{
listLayers.push_back((*it).first);
}
return listLayers;
}
示例2: getList
void LayerMapGds::getList(wxString exp, WordList& data)
{
wxRegEx number_tmpl(wxT("[[:digit:]]*"));
wxRegEx separ_tmpl(wxT("[\\,\\-]{1,1}"));
unsigned long conversion;
bool last_was_separator = true;
char separator = ',';
VERIFY(number_tmpl.IsValid());
VERIFY(separ_tmpl.IsValid());
do
{
if (last_was_separator)
{
number_tmpl.Matches(exp);
number_tmpl.GetMatch(exp).ToULong(&conversion);
number_tmpl.ReplaceFirst(&exp,wxT(""));
if (',' == separator)
data.push_back((word)conversion);
else
{
for (word numi = data.back() + 1; numi <= conversion; numi++)
data.push_back(numi);
}
}
else
{
separ_tmpl.Matches(exp);
if (wxT("-") == separ_tmpl.GetMatch(exp))
separator = '-';
else if (wxT(",") == separ_tmpl.GetMatch(exp))
separator = ',';
else assert(false);
separ_tmpl.ReplaceFirst(&exp,wxT(""));
}
last_was_separator = !last_was_separator;
} while (!exp.IsEmpty());
}
示例3: build
void HighlightStateBuilder::build(StringListLangElem *elem,
HighlightState *state) {
const string &name = elem->getName();
StringDefs *alternatives = elem->getAlternatives();
WordList wordList;
bool doubleQuoted = false, nonDoubleQuoted = false, buildAsWordList = true;
for (StringDefs::const_iterator it = alternatives->begin(); it
!= alternatives->end(); ++it) {
const string &rep = (*it)->toString();
// double quoted strings generate WordListRules, otherwise simple ListRules
// we don't allow double quoted strings mixed with non double quoted
if (((*it)->isDoubleQuoted() && nonDoubleQuoted)
|| (!(*it)->isDoubleQuoted() && doubleQuoted)) {
throw HighlightBuilderException(
"cannot mix double quoted and non double quoted", elem);
}
doubleQuoted = (*it)->isDoubleQuoted();
nonDoubleQuoted = !(*it)->isDoubleQuoted();
wordList.push_back(rep);
// now check whether we must build a word list rule (word boundary) or an
// ordinary list; as soon as we find something that is not to be isolated
// we set buildAsWordList as false
if (buildAsWordList && (!doubleQuoted || !is_to_isolate(rep))) {
buildAsWordList = false;
}
}
HighlightRulePtr rule;
if (buildAsWordList)
rule = HighlightRulePtr(highlightRuleFactory->createWordListRule(name,
wordList, elem->isCaseSensitive()));
else
rule = HighlightRulePtr(highlightRuleFactory->createListRule(name,
wordList, elem->isCaseSensitive()));
rule->setAdditionalInfo(elem->toStringParserInfo());
state->addRule(rule);
setExitLevel(elem, rule.get());
}
示例4: highPassFilter
void FrequencyMap::highPassFilter( WordList& allowedWords, double ratio ) const
{
allowedWords.clear();
FrequencyMap::ReFrequencyMap reFrequencyMap;
reverseMap(reFrequencyMap);
FrequencyMap::ReFrequencyMap::reverse_iterator rit;
int totalItemNum = total();
int localItemNum(0);
for ( rit=reFrequencyMap.rbegin(); rit!=reFrequencyMap.rend(); ++rit )
{
localItemNum += rit->first;
if ( ((double)localItemNum)/totalItemNum > ratio )
break;
allowedWords.push_back(rit->second);
}
}
示例5: read
void DictionaryItems::read( std::istream& is )
{
clear();
//x std::ofstream logs("vonyokornai.nojoker.reconstructed.txt");
//x std::ostream& os = logs;
while (!is.eof())
{
WordList hu;
WordList en;
Word delimiter;
bool engPart = true;
while (true)
{
Word w;
is >> w;
if (w.empty())
break;
// We allow vonyo7's "@" delimiter, and vonyokornai's "@V", "@N" etc. delimiters.
if ( (w.size()<=2) && (w[0]=='@') )
{
engPart = false;
delimiter = w;
}
else if (engPart)
{
en.push_back(w);
}
else
{
hu.push_back(w);
}
while ( (is.peek()==' ') || (is.peek()=='\r') )
{
is.ignore();
}
if (is.peek()=='\n')
{
is.ignore();
break;
}
}
if (en.empty())
break;
push_back(std::make_pair(en,hu));
//x WordList::const_iterator it;
//x for ( it=en.begin(); it!=en.end(); ++it )
//x {
//x os << *it << " ";
//x }
//x os << delimiter ;
//x for ( it=hu.begin(); it!=hu.end(); ++it )
//x {
//x os << " " << *it ;
//x }
//x os << "\n";
}
//x os.flush();
}
示例6: main
int main() {
ostringstream printedState;
HighlightStatePrinter printer(printedState);
MatchingParameters params;
cout << "*** test_regexrules" << endl;
// first of all check the only spaces regular expression
boost::regex onlySpaces("[[:blank:]]*");
assertTrue(boost::regex_match(" \t \t ", onlySpaces));
assertTrue(boost::regex_match("", onlySpaces));
assertFalse(boost::regex_match(" a\t \t ", onlySpaces));
assertFalse(boost::regex_match(" a ", onlySpaces));
assertFalse(boost::regex_match("foo", onlySpaces));
RegexRuleFactory factory;
HighlightRulePtr rule = HighlightRulePtr(factory.createSimpleRule("foo",
"foo|bar"));
check_regex(rule.get(), params, "before_foo_after", true, "foo", "before_",
"_after");
check_regex(rule.get(), params, "before_foo", true, "foo", "before_", "");
check_regex(rule.get(), params, "bar_after", true, "bar", "", "_after");
check_regex(rule.get(), params, "before__after", false, "foo", "before_",
"_after");
WordList wordList;
wordList.push_back("foo");
wordList.push_back("bar");
wordList.push_back("gogo");
rule = HighlightRulePtr(factory.createWordListRule("foo", wordList));
cout << "word list regex: " << rule->toString() << endl;
assertEquals("\\<(?:foo|bar|gogo)\\>", rule->toString());
// there's no matching since we required word boundaries
check_regex(rule.get(), params, "before_foo_after", false, "foo",
"before_", "_after");
check_regex(rule.get(), params, "before_foo", false, "foo", "before_", "");
check_regex(rule.get(), params, "bar_after", false, "bar", "", "_after");
// now there's match
check_regex(rule.get(), params, "before foo after", true, "foo", "before ",
" after");
check_regex(rule.get(), params, "before foo", true, "foo", "before ", "");
check_regex(rule.get(), params, "bar after", true, "bar", "", " after");
check_regex(rule.get(), params, "before__after", false, "foo", "before_",
"_after");
// non case sensitive version
rule = HighlightRulePtr(factory.createWordListRule("foo", wordList, false));
cout << "word list regex: " << rule->toString() << endl;
assertEquals("\\<(?:[Ff][Oo][Oo]|[Bb][Aa][Rr]|[Gg][Oo][Gg][Oo])\\>",
rule->toString());
check_regex(rule.get(), params, "before FoO", true, "FoO", "before ", "");
check_regex(rule.get(), params, "bAr after", true, "bAr", "", " after");
// now the simple list version (i.e., not word list)
rule = HighlightRulePtr(factory.createListRule("foo", wordList));
cout << "word list regex: " << rule->toString() << endl;
assertEquals("(?:foo|bar|gogo)", rule->toString());
check_regex(rule.get(), params, "before_foo", true, "foo", "before_", "");
check_regex(rule.get(), params, "bar_after", true, "bar", "", "_after");
// search for strings delimited by A
rule = HighlightRulePtr(factory.createLineRule("foo", "A", "A"));
cout << "line rule: " << rule->toString() << endl;
assertEquals("A(?:[^A])*A", rule->toString());
check_regex(rule.get(), params, "before A foo bar A after", true,
"A foo bar A", "before ", " after");
// search for strings delimited by A and BC
rule = HighlightRulePtr(factory.createLineRule("foo", "A", "B"));
cout << "line rule: " << rule->toString() << endl;
assertEquals("A(?:[^AB])*B", rule->toString());
check_regex(rule.get(), params, "before A foo bar A and BC after", true,
"A and B", "before A foo bar ", "C after");
// search for strings delimited by < and > and escape char
rule = HighlightRulePtr(factory.createLineRule("foo", "<", ">", "\\\\"));
cout << "line rule: " << rule->toString() << endl;
//.........这里部分代码省略.........