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


C++ SWModule类代码示例

本文整理汇总了C++中SWModule的典型用法代码示例。如果您正苦于以下问题:C++ SWModule类的具体用法?C++ SWModule怎么用?C++ SWModule使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了SWModule类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1:

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,代码来源:

示例2: writeEntry

void writeEntry(SWModule & module,
                std::string const & key,
                std::string const & entry,
                bool const replace)
{
    if (key.size() && entry.size()) {
        std::cout << "from file: " << key << std::endl;
        VerseKey *vkey = (VerseKey *)module.getKey();
        std::unique_ptr<VerseKey> linkMaster(
                    static_cast<VerseKey *>(module.createKey().release()));

        ListKey listKey = vkey->parseVerseList(key.c_str(), "Gen1:1", true);

        bool first = true;
        for (listKey.positionToTop(); !listKey.popError(); listKey.increment()) {
            vkey->positionFrom(listKey);
            if (first) {
                *linkMaster = *vkey;
                std::string text;
                if (!replace)
                    text = module.getRawEntry();
                text += entry;

                std::cout << "adding entry: " << vkey->getText() << " length " << entry.size() << "/" << (unsigned short)text.size() << std::endl;
                module.setEntry(text.c_str());
                first = false;
            }
            else {
                std::cout << "linking entry: " << vkey->getText() << " to " << linkMaster->getText() << std::endl;
                module.linkEntry(*linkMaster);
            }
        }
    }
}
开发者ID:swordxx,项目名称:swordxx,代码行数:34,代码来源:imp2vs.cpp

示例3: initInstall

/*
 * Class:     org_crosswire_android_sword_InstallMgr
 * Method:    remoteInstallModule
 * Signature: (Ljava/lang/String;Ljava/lang/String;)I
 */
JNIEXPORT jint JNICALL Java_org_crosswire_android_sword_InstallMgr_remoteInstallModule
  (JNIEnv *env, jobject me, jstring sourceNameJS, jstring modNameJS) {

	initInstall();

	const char *sourceName = env->GetStringUTFChars(sourceNameJS, NULL);
SWLog::getSystemLog()->logDebug("remoteInstallModule: sourceName: %s\n", sourceName);
	InstallSourceMap::iterator source = installMgr->sources.find(sourceName);
	env->ReleaseStringUTFChars(sourceNameJS, sourceName);

	if (source == installMgr->sources.end()) {
		return -3;
	}

	InstallSource *is = source->second;
	SWMgr *rmgr = is->getMgr();
	SWModule *module;

	const char *modName = env->GetStringUTFChars(modNameJS, NULL);
SWLog::getSystemLog()->logDebug("remoteInstallModule: modName: %s\n", modName);
	ModMap::iterator it = rmgr->Modules.find(modName);
	env->ReleaseStringUTFChars(modNameJS, modName);

	if (it == rmgr->Modules.end()) {
		return -4;
	}

	module = it->second;

	int error = installMgr->installModule(mgr, 0, module->getName(), is);

	return error;
}
开发者ID:raphink,项目名称:sword,代码行数:38,代码来源:swordstub.cpp

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

示例6: init

/*
 * Class:     org_crosswire_android_sword_SWModule
 * Method:    setKeyText
 * Signature: (Ljava/lang/String;)V
 */
JNIEXPORT void JNICALL Java_org_crosswire_android_sword_SWModule_setKeyText
  (JNIEnv *env, jobject me, jstring keyTextJS) {

	init();

	SWModule *module = getModule(env, me);

	if (module) {
		const char *keyText = env->GetStringUTFChars(keyTextJS, NULL);
SWLog::getSystemLog()->logDebug("setKeyText(%s, %s)", module->getName(), keyText);
		sword::SWKey *key = module->getKey();
		sword::VerseKey *vkey = SWDYNAMIC_CAST(VerseKey, key);
		if (vkey && (*keyText=='+' ||*keyText=='-')) {
			if (!stricmp(keyText+1, "book")) {
				vkey->setBook(vkey->getBook() + ((*keyText=='+')?1:-1));
				env->ReleaseStringUTFChars(keyTextJS, keyText);
				return;
			}
			else if (!stricmp(keyText+1, "chapter")) {
				vkey->setChapter(vkey->getChapter() + ((*keyText=='+')?1:-1));
				env->ReleaseStringUTFChars(keyTextJS, keyText);
				return;
			}
		}

		module->setKey(keyText);
		env->ReleaseStringUTFChars(keyTextJS, keyText);
	}
}
开发者ID:raphink,项目名称:sword,代码行数:34,代码来源:swordstub.cpp

示例7: sword__Quick_getJScriptAttribArray

int sword__Quick_getJScriptAttribArray(xsd__string modName, xsd__string modKey, xsd__string &arrayText) {
	SWModule *mod = mgr->Modules[modName];
	if (mod) {
		mod->setKey(modKey);
		AttributeTypeList::iterator i1;
		AttributeList::iterator i2;
		AttributeValue::iterator i3;
		int l1, l2, l3;
		char lbuf1[20], lbuf2[20], lbuf3[20];
		static string retVal = "";
		retVal = "var entryAttribs = new Array();\n";
		string l1keys = "entryAttribs[0] = new Array(";
		for (l1=0,i1 = target->getEntryAttributes().begin(); i1 != target->getEntryAttributes().end(); ++i1,++l1) {
			sprintf(lbuf1, "%d", l1+1);
			retVal += "entryAttribs["+lbuf1+"] = new Array();\n";
			string l2keys = "entryAttribs["+lbuf1+"][0] = new Array(";
			cout << "[ " << i1->first << " ]\n";
			for (l2=0,i2 = i1->second.begin(); i2 != i1->second.end(); ++i2,++l2) {
				sprintf(lbuf2, "%d", l2+1);
				retVal += "entryAttribs["+lbuf1+"]["+lbuf2+"][0] = new Array();\n";
				string l3keys = "entryAttribs["+lbuf1+"]["+lbuf2+"][0] = new Array(";
				cout << "\t[ " << i2->first << " ]\n";
				for (l3=0,i3 = i2->second.begin(); i3 != i2->second.end(); ++i3,++l3) {
					cout << "\t\t" << i3->first << " = " << i3->second << "\n";
				}
			}
		}
	}
	return SOAP_OK;
}
开发者ID:bluehavana,项目名称:sword,代码行数:30,代码来源:gsoapsword.cpp

示例8: main

int main(int argc, char **argv) {
	SWMgr library;
	SWModule *darby = library.getModule("Darby");
	darby->setKey("James 1:19");
	cout << darby->RenderText();

	return 0;
}
开发者ID:Jaden-J,项目名称:osstudybible,代码行数:8,代码来源:simple.cpp

示例9: sword__Quick_getModuleRawEntry

int sword__Quick_getModuleRawEntry(xsd__string modName, xsd__string modKey, xsd__string &modText) {
	SWModule *mod = mgr->Modules[modName];
	if (mod) {
		mod->setKey(modKey);
		modText = mod->getRawEntry();
	}
	return SOAP_OK;
}
开发者ID:bluehavana,项目名称:sword,代码行数:8,代码来源:gsoapsword.cpp

示例10: sword__Quick_setModuleRawEntry

int sword__Quick_setModuleRawEntry(xsd__string modName, xsd__string modKey, xsd__string modText, xsd__int &noop) {
	SWModule *mod = mgr->Modules[modName];
	if (mod) {
		mod->setKey(modKey);
		(*mod) << modText;
	}
	return SOAP_OK;
}
开发者ID:bluehavana,项目名称:sword,代码行数:8,代码来源:gsoapsword.cpp

示例11: sword__Quick_getModuleRenderText

int sword__Quick_getModuleRenderText(xsd__string modName, xsd__string modKey, xsd__string &modText) {
	SWModule *mod = mgr->Modules[modName];
	if (mod) {
		mod->setKey(modKey);
		modText = (char *)mod->RenderText();
	}
	return SOAP_OK;
}
开发者ID:bluehavana,项目名称:sword,代码行数:8,代码来源:gsoapsword.cpp

示例12: createModule

void SWMgr::CreateMods(bool multiMod) {
	SectionMap::iterator it;
	ConfigEntMap::iterator start;
	ConfigEntMap::iterator end;
	ConfigEntMap::iterator entry;
	SWModule *newmod;
	SWBuf driver, misc1;
	for (it = config->Sections.begin(); it != config->Sections.end(); it++) {
		ConfigEntMap &section = (*it).second;
		newmod = 0;
		
		driver = ((entry = section.find("ModDrv")) != section.end()) ? (*entry).second : (SWBuf)"";
		if (driver.length()) {
			newmod = createModule((*it).first, driver, section);
			if (newmod) {
				// Filters to add for this module and globally announce as an option to the user
				// e.g. translit, strongs, redletterwords, etc, so users can turn these on and off globally
				start = (*it).second.lower_bound("GlobalOptionFilter");
				end   = (*it).second.upper_bound("GlobalOptionFilter");
				AddGlobalOptions(newmod, section, start, end);

				// Only add the option to the module, don't announce it's availability
				// These are useful for like: filters that parse special entryAttribs in a text
				// or whatever you might want to happen on entry lookup
				start = (*it).second.lower_bound("LocalOptionFilter");
				end   = (*it).second.upper_bound("LocalOptionFilter");
				AddLocalOptions(newmod, section, start, end);

				//STRIP FILTERS

				// add all basic ones for for the modtype
				AddStripFilters(newmod, section);

				// Any special processing for this module when searching:
				// e.g. for papyri, removed all [](). notation
				start = (*it).second.lower_bound("LocalStripFilter");
				end   = (*it).second.upper_bound("LocalStripFilter");
				AddStripFilters(newmod, section, start, end);

				AddRawFilters(newmod, section);
				AddRenderFilters(newmod, section);
				AddEncodingFilters(newmod, section);
				
				SWModule *oldmod = Modules[newmod->getName()];
				if (oldmod) {
					delete oldmod;
				}
				
				Modules[newmod->getName()] = newmod;
			}
		}
	}
}
开发者ID:raphink,项目名称:sword,代码行数:53,代码来源:swmgr.cpp

示例13: SWModule_doSearch

SWHANDLE SWModule_doSearch(SWHANDLE hmodule, const char *searchString, int type, int params ,void (*percent) (char, void *), void *percentUserData) {
	
	static ListKey results;
	SWKey * scope = 0;
	SWModule *module = (SWModule *)hmodule;
	if (!module) 	
		return -1;
	
	results.clear();
	results = module->search(searchString, type, params, scope, 0, percent, (void *) &percentUserData);
	
	return (SWHANDLE)&results;
}
开发者ID:,项目名称:,代码行数:13,代码来源:

示例14: main

int main(int argc, char **argv) {
	SWMgr mymgr;

	SWModule *bbe = mymgr.Modules["BBE"];

	if (bbe) {
		VerseKey vk;
		vk.setPersist(true);
		bbe->setKey(vk);
		for (; !bbe->popError(); (*bbe)++ ) {
			std::cout << vk.getIndex() << std::endl; 
		}
	}
	return 0;
}
开发者ID:raphink,项目名称:sword,代码行数:15,代码来源:indextest.cpp

示例15: main

int main(int argc, char **argv) {

	SWMgr mgr;
	SWModule *mod = mgr.getModule("KJVgb");

	VerseKey *key1 = (VerseKey *)mod->createKey();

	key1->setTestament(2);
	key1->setBook(4);
	key1->setChapter(2);
	key1->setVerse(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.popError(); keys++) {
		cout << "\n" << keys.getText() << ":\n" << endl;
	}


	keys.setPersist(true);

	mod->setKey(keys);

	for ((*mod) = TOP; !mod->popError(); (*mod)++) {
		cout << "\n" << mod->getKeyText() << ":\n" << endl;
	}

	delete key1;

	return 0;
}
开发者ID:bluehavana,项目名称:sword,代码行数:58,代码来源:vtreekeytest.cpp


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