本文整理汇总了C++中SWModule::renderText方法的典型用法代码示例。如果您正苦于以下问题:C++ SWModule::renderText方法的具体用法?C++ SWModule::renderText怎么用?C++ SWModule::renderText使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SWModule
的用法示例。
在下文中一共展示了SWModule::renderText方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main(int argc, char **argv) {
const char* modName = (argc >= 2) ? argv[1] : "KJV";
const char* keyName = (argc == 3) ? argv[2] : "John 1:1";
SWMgr mgr(0, 0, true, new MarkupFilterMgr(FMT_WEBIF, ENC_UTF8));
mgr.setGlobalOption("Strong's Numbers", "on");
mgr.setGlobalOption("Morphological Tags", "on");
SWModule *module = mgr.Modules[modName];
if (!module) {
module = mgr.Modules.begin()->second;
}
module->setKey(keyName);
std::cout << module->renderText() << std::endl<< std::endl<< std::endl;
//------------------------
SWMgr mgr2(0, 0, true, new MarkupFilterMgr(FMT_HTMLHREF, ENC_UTF8));
mgr2.setGlobalOption("Strong's Numbers", "on");
mgr2.setGlobalOption("Morphological Tags", "on");
module = mgr2.Modules[modName];
if (!module) {
module = mgr2.Modules.begin()->second;
}
module->setKey(keyName);
std::cout << module->renderText() << std::endl;
return 0;
}
示例2: main
int main(int argc, char **argv) {
if (argc != 2) {
cerr << "\nusage: " << *argv << " <modName>\n" << endl;
exit(-1);
}
SWMgr library(new MarkupFilterMgr(FMT_XHTML));
library.setGlobalOption("Headings", "On");
SWModule *module = library.getModule(argv[1]);
if (!module) {
cerr << "\nCouldn't find module: " << argv[1] << "\n" << endl;
exit(-2);
}
module->setKey("Ps.3.1");
outputCurrentVerse(module);
module->setKey("Mark.1.14");
outputCurrentVerse(module);
cout << "\nWhitespace tests around headings:\n";
((VerseKey *)module->getKey())->setIntros(true);
*module = TOP;
// module heading
cout << module->renderText() << "\n";
(*module)++;
// testament heading
cout << module->renderText() << "\n";
(*module)++;
// book heading
cout << module->renderText() << "\n";
(*module)++;
// chapter heading
cout << module->renderText() << "\n";
(*module)++;
// verse body
module->renderText();
SWBuf header = module->getEntryAttributes()["Heading"]["Preverse"]["0"];
cout << module->renderText(header) << endl;
cout << "[ " << module->getKeyText() << " ] " << module->renderText() << "\n";
(*module)++;
// verse body
module->renderText();
header = module->getEntryAttributes()["Heading"]["Preverse"]["0"];
cout << module->renderText(header) << endl;
cout << "[ " << module->getKeyText() << " ] " << module->renderText() << "\n";
return 0;
}
示例3:
const char *SWModule_getEntryAttributes(SWHANDLE hmodule, const char *level1, const char *level2, const char *level3) {
SWModule *module = (SWModule *)hmodule;
static SWBuf retval;
module->renderText();
retval = module->getEntryAttributes()[level1][level2][level3].c_str();
return (retval.length()) ? (const char*)retval.c_str() : NULL;
}
示例4: main
int main(int argc, char **argv)
{
const char *range = (argc > 1) ? argv[1] : "Mat 2:10,12-15";
VerseKey parser;
ListKey result;
result = parser.parseVerseList(range, parser, true);
// let's iterate the key and display
for (result = TOP; !result.popError(); result++) {
cout << result << "\n";
}
cout << endl;
// Now let's output a module with the entries from the result
// we'll initialize our library of books
SWMgr library(new MarkupFilterMgr(FMT_PLAIN)); // render plain without fancy markup
// Let's get a book;
SWModule *book = library.getModule("KJV");
// couldn't find our test module
if (!book) return -1;
// now let's iterate the book and display
for (result = TOP; !result.popError(); result++) {
book->setKey(result);
cout << "*** " << book->getKeyText() << ": " << book->renderText() << "\n";
}
return 0;
}
示例5: getModule
/*
* Class: org_crosswire_android_sword_SWModule
* Method: getRenderText
* Signature: ()Ljava/lang/String;
*/
JNIEXPORT jstring JNICALL Java_org_crosswire_android_sword_SWModule_getRenderText
(JNIEnv *env, jobject me) {
init();
SWModule *module = getModule(env, me);
jstring retVal = 0;
if (module) {
retVal = env->NewStringUTF(assureValidUTF8(module->renderText()));
}
return retVal;
}
示例6: main
int main(int argc, char **argv)
{
const char *range = (argc > 1) ? argv[1] : "Mat 2:10,12-15";
VerseKey parser;
ListKey result;
result = parser.parseVerseList(range, parser, true);
// let's iterate the key and display
for (result = TOP; !result.popError(); result++) {
cout << result << "\n";
}
cout << endl;
// Now if we'd like persist this key for use inside of a book...
result.setPersist(true);
// Let's get a book;
SWMgr library(new MarkupFilterMgr(FMT_PLAIN)); // render plain without fancy markup
SWModule *book = library.getModule("KJV");
// and set our limited key inside
book->setKey(result);
// now let's iterate the book and display
for ((*book) = TOP; !book->popError(); (*book)++) {
cout << "*** " << book->getKeyText() << ": " << book->renderText() << "\n";
}
// Since we've told our result key to persist in book, we can reuse our
// setup by simply resetting result, e.g.
//
// result = parser.ParseVerseList(someNewRange, parser, true);
//
// Now an iteration of book will give us our new range.
//
// To stop persistence of our custom key, we'll need to set our book's key
// to something simple:
//
// book->setKey("gen.1.1");
//
// Resetting our book object's key to something not persistent will revert our book object to using its default key for positioning
//
//
return 0;
}
示例7: main
int main(int argc, char **argv) {
if (argc < 2) {
fprintf(stderr, "usage: %s <Mod Name>\n", argv[0]);
exit(-1);
}
SWMgr mgr;
ModMap::iterator it = mgr.Modules.find(argv[1]);
if (it == mgr.Modules.end()) {
fprintf(stderr, "error: %s: couldn't find module: %s \n", argv[0], argv[1]);
exit(-2);
}
SWModule *mod = it->second;
SWKey *key = (*mod);
VerseKey *vkey = 0;
SWTRY {
vkey = dynamic_cast<VerseKey *>(key);
}
SWCATCH (...) {}
if (!vkey) {
fprintf(stderr, "error: %s: %s module is not keyed to verses \n", argv[0], argv[1]);
exit(-3);
}
vkey->setIntros(false); // turn on mod/testmnt/book/chap headings
(*mod) = TOP;
while (!mod->popError()) {
if (vkey->getVerse())
if (!mod->renderText().length())
std::cout << *vkey << std::endl;
(*mod)++;
}
}
示例8: main
int main(int argc, char **argv) {
SWMgr manager; // create a default manager that looks in the current directory for mods.conf
cout << "\nInstalled Modules:\n\n";
ModMap::iterator modIterator;
// Loop thru all installed modules and print out information
for (modIterator = manager.Modules.begin(); modIterator != manager.Modules.end(); modIterator++) {
std::string modName = (*modIterator).first; // mod.conf section name (stored in module->Name())
SWModule *module = (*modIterator).second;
cout << modName << "(" << module->getName() << ") | " << module->getType() << "\n";
}
// Print out a verse from the first module:
cout << "\n" << manager.Modules.begin()->second->getKeyText() << ":\n";
cout << manager.Modules.begin()->second->renderText();
cout << " (" << manager.Modules.begin()->second->getName() << ")\n";
// Print out the same verse from the second module (less confusing):
modIterator = manager.Modules.begin(); // get first module
modIterator++; // increment to next module
SWModule *mod = modIterator->second;
cout << "\n" << mod->getKeyText() << ":\n";
// cout << (const char *)(*mod); // we could do this, the same as above
cout << mod->renderText();
cout << " (" << mod->getName() << ")\n\n";
return 0;
}