本文整理汇总了C++中ListKey::Error方法的典型用法代码示例。如果您正苦于以下问题:C++ ListKey::Error方法的具体用法?C++ ListKey::Error怎么用?C++ ListKey::Error使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ListKey
的用法示例。
在下文中一共展示了ListKey::Error方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main(int argc, char **argv) {
SWMgr mgr;
SWModule *mod = mgr.getModule("KJVgb");
VerseKey *key1 = (VerseKey *)mod->CreateKey();
key1->Testament(2);
key1->Book(4);
key1->Chapter(2);
key1->Verse(3);
cout << "\n" << key1->getText() << ":\n\n";
ListKey keys;
keys << *key1;
cout << "\n" << keys.getRangeText() << ":\n\n";
ListKey keys2 = keys;
cout << "\n" << keys2.getRangeText() << ":\n\n";
keys = key1->ParseVerseList("Lk.4.5");
cout << "\n" << key1->getText() << ":\n\n";
key1->setText("jn.6.7");
cout << "\n" << key1->getText() << ":\n\n";
mod->setKey("lk.2.3");
cout << "\n" << mod->getKeyText() << ":\n" << endl;
cout << mod->getRawEntry() << endl;
cout << "\nListkey persist key iteration test\n\n";
keys = key1->ParseVerseList("mat1", 0, true);
for (keys = TOP; !keys.Error(); keys++) {
cout << "\n" << keys.getText() << ":\n" << endl;
}
keys.Persist(1);
mod->setKey(keys);
for ((*mod) = TOP; !mod->Error(); (*mod)++) {
cout << "\n" << mod->getKeyText() << ":\n" << endl;
}
delete key1;
return 0;
}
示例2: getVerses
std::string SwordPluginAPI::getVerses(const std::string& moduleName, const std::string& key, const std::string& single) {
/*Get verses from a specific module (e.g. "ESV"). Set your biblepassage in key e.g. "James 1:19" */
std::stringstream passage;
std::stringstream tmpPassage;
std::stringstream out;
SWModule *module = displayLibrary->getModule(moduleName.c_str());
/* if (!module || !(strcmp(module->Type(), "Biblical Texts") == 0 || strcmp(module->Type(), "Commentaries") == 0)) {
PDL_JSException(parms, "getVerses: Module isn't verse driven (no bible or commentary). Currently BibleZ HD doesn't support Generic Books and Lexicons / Dictionaries!");
return PDL_TRUE;
} */
//module->setKey(key);
//VerseKey *vk = (VerseKey*)module->getKey();
VerseKey *vk = dynamic_cast<VerseKey *>(module->getKey());
//vk->AutoNormalize(false);
vk->Headings(true);
vk->setText(key.c_str());
ListKey verses = VerseKey().ParseVerseList(key.c_str(), "", true);
passage << "{\"bookName\": \"" << vk->getBookName() << "\", \"cnumber\": \"" << vk->Chapter() << "\", \"vnumber\": \"" << vk->Verse() << "\", \"passageSingle\" : \"" << vk->getBookName() << " " << vk->Chapter() << ":" << vk->Verse() << "\", \"passage\" : \"" << vk->getBookName() << " " << vk->Chapter() << "\", \"abbrev\": \"" << vk->getBookAbbrev() << "\"}";
if (single == "true") {
verses = VerseKey().ParseVerseList(key.c_str(), "", true);
} else {
tmpPassage << vk->getBookName() << " " << vk->Chapter();
verses = VerseKey().ParseVerseList(tmpPassage.str().c_str(), "", true);
}
AttributeTypeList::iterator i1;
AttributeList::iterator i2;
AttributeValue::iterator i3;
out << "[";
for (verses = TOP; !verses.Error(); verses++) {
vk->setText(verses);
if (strcmp(module->RenderText(), "") != 0) {
//headingOn = 0;
out << "{\"content\": \"" << convertString(module->RenderText()) << "\", ";
out << "\"vnumber\": \"" << vk->Verse() << "\", ";
out << "\"cnumber\": \"" << vk->Chapter() << "\"";
out << ", \"heading\": \"" << convertString(module->getEntryAttributes()["Heading"]["Preverse"]["0"].c_str()) << "\"";
for (i1 = module->getEntryAttributes().begin(); i1 != module->getEntryAttributes().end(); i1++) {
if (strcmp(i1->first, "Footnote") == 0) {
out << ", \"footnotes\": [";
for (i2 = i1->second.begin(); i2 != i1->second.end(); i2++) {
out << "{";
for (i3 = i2->second.begin(); i3 != i2->second.end(); i3++) {
out << "\"" << i3->first << "\": \"" << convertString(i3->second.c_str()) << "\"";
//footnotesOn = 1;
if (i3 != --i2->second.end()) {
out << ", ";
}
}
out << "}";
if (i2 != --i1->second.end()) {
out << ", ";
}
}
out << "]";
} /*else if (strcmp(i1->first, "Word") == 0) {
out << ", \"words\": [";
for (i2 = i1->second.begin(); i2 != i1->second.end(); i2++) {
out << "{";
for (i3 = i2->second.begin(); i3 != i2->second.end(); i3++) {
out << "\"" << i3->first << "\": \"" << convertString(i3->second.c_str()) << "\"";
if (i3 != --i2->second.end()) {
out << ", ";
}
}
out << "}";
if (i2 != --i1->second.end()) {
out << ", ";
}
}
out << "]";
} */
}
if (vk->Chapter() == 1 && vk->Verse() == 1) {
vk->setChapter(0);
vk->setVerse(0);
out << ", \"intro\": \"" << convertString(module->RenderText()) << "\"";
}
out << "}";
ListKey helper = verses;
helper++;
if (!helper.Error()) {
out << ", ";
}
}
}
out << "]";
//.........这里部分代码省略.........