本文整理汇总了C++中Note::createdOnOrAfter方法的典型用法代码示例。如果您正苦于以下问题:C++ Note::createdOnOrAfter方法的具体用法?C++ Note::createdOnOrAfter怎么用?C++ Note::createdOnOrAfter使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Note
的用法示例。
在下文中一共展示了Note::createdOnOrAfter方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: search
NoteCollection NoteStore::search(std::string term) {
std::transform(term.begin(), term.end(), term.begin(), ::tolower);
std::string word = "";
std::vector<std::string> words;
for (unsigned int i=0; i<term.length(); i++) {
char c = term[i];
if (c != ' ') {
word += c;
} else {
if (word.length() > 0) {
words.push_back(word);
}
word = "";
}
}
if (word.length() > 0) {
words.push_back(word);
}
NoteCollection noteCollection;
Note note;
std::string guid;
for ( auto it = this->noteDatabase.begin(); it != this->noteDatabase.end(); ++it ) {
guid = it->first;
note = it->second;
bool matchesAll = true;
for (unsigned int i=0; i<words.size(); i++) {
std::string keyword = words[i];
long wildcardAt = keyword.find_first_of('*');
if (strcmp(keyword.substr(0, 4).c_str(), "tag:") == 0) {
if (!note.hasTag(keyword.substr(4,keyword.length()-4),wildcardAt-4)) {
matchesAll = false;
break;
}
} else if (strcmp(keyword.substr(0, 8).c_str(), "created:") == 0) {
if (!note.createdOnOrAfter(keyword.substr(8,keyword.length()-8))) {
matchesAll = false;
break;
}
} else {
if (!note.hasKeyword(keyword, wildcardAt)) {
matchesAll = false;
break;
}
}
}
if (matchesAll) {
noteCollection.addNote(note);
}
}
noteCollection.sortByDate();
return noteCollection;
}