当前位置: 首页>>代码示例>>C++>>正文


C++ SWModule::renderText方法代码示例

本文整理汇总了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;
}
开发者ID:kalemas,项目名称:swordxx,代码行数:31,代码来源:webiftest.cpp

示例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;
}
开发者ID:bluehavana,项目名称:sword,代码行数:53,代码来源:osistest.cpp

示例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;
}
开发者ID:,项目名称:,代码行数:7,代码来源:

示例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;
}
开发者ID:bluehavana,项目名称:sword,代码行数:34,代码来源:verserangeparse.cpp

示例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;
}
开发者ID:raphink,项目名称:sword,代码行数:18,代码来源:swordstub.cpp

示例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;
}
开发者ID:raphink,项目名称:sword,代码行数:47,代码来源:verserangeparse.cpp

示例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)++;
	}
}
开发者ID:bluehavana,项目名称:sword,代码行数:40,代码来源:emptyvss.cpp

示例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;

}
开发者ID:kalemas,项目名称:swordxx,代码行数:38,代码来源:swmgrex.cpp


注:本文中的SWModule::renderText方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。