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


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

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


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

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

示例2:

const char *SWModule_getType(SWHANDLE hmodule) {
	SWModule *module = (SWModule *)hmodule;
	return (const char *)((module) ? module->getType() : 0);
}
开发者ID:,项目名称:,代码行数:4,代码来源:

示例3: systemquery

void systemquery(const char * key, ostream* output){
	DiathekeMgr manager;
	ModMap::iterator it;

	SWModule *target;
	
	bool types = false, descriptions = false, names = false;

	if (!::stricmp(key, "localelist")) {		
		LocaleMgr *lm = LocaleMgr::getSystemLocaleMgr();
		list<SWBuf> loclist =	lm->getAvailableLocales();
		list<SWBuf>::iterator li = loclist.begin();
		for (;li != loclist.end(); li++) {
		  *output << li->c_str() << endl;
		}
	}
	else if (!::stricmp(key, "modulelist")) {
		types = true;
		descriptions = true;
		names = true;
	}
	else if (!::stricmp(key, "modulelistnames")) {
		names = true;
	}
	else if (!::stricmp(key, "modulelistdescriptions")) {
		descriptions = true;
	}
	
	
	if (types || descriptions || names) {
		if (types) *output << "Biblical Texts:\n";
		for (it = manager.Modules.begin(); it != manager.Modules.end(); it++) {
			target = it->second;
			if (!strcmp(target->getType(), "Biblical Texts")) {
				if (names) *output << target->getName();
				if (names && descriptions) *output << " : ";
				if (descriptions) *output << target->getDescription();
				*output << endl;
			}
		}
		if (types) *output << "Commentaries:\n";
		for (it = manager.Modules.begin(); it != manager.Modules.end(); it++) {
			target = it->second;
			if (!strcmp(target->getType(), "Commentaries")) {
				if (names) *output << target->getName();
				if (names && descriptions) *output << " : ";
				if (descriptions) *output << target->getDescription();
				*output << endl;
			}
		}
		if (types) *output << "Dictionaries:\n";
		for (it = manager.Modules.begin(); it != manager.Modules.end(); it++) {
			target = it->second;
			if (!strcmp(target->getType(), "Lexicons / Dictionaries")) {
				if (names) *output << target->getName();
				if (names && descriptions) *output << " : ";
				if (descriptions) *output << target->getDescription();
				*output << endl;
			}
		}
		if (types) *output << "Generic books:\n";
		for (it = manager.Modules.begin(); it != manager.Modules.end(); it++) {
			target = it->second;
			if (!strcmp(target->getType(), "Generic Books")) {
				if (names) *output << target->getName();
				if (names && descriptions) *output << " : ";
				if (descriptions) *output << target->getDescription();
				*output << endl;
			}
		}

	}
}
开发者ID:raphink,项目名称:sword,代码行数:73,代码来源:corediatheke.cpp

示例4: doquery

void doquery(unsigned long maxverses = -1, unsigned char outputformat = FMT_PLAIN, unsigned char outputencoding = ENC_UTF8, unsigned long optionfilters = 0, unsigned char searchtype = ST_NONE, const char *range = 0, const char *text = 0, const char *locale = 0, const char *ref = 0, ostream* output = &cout, const char *script = 0, signed short variants = 0) {
	static DiathekeMgr manager(NULL, NULL, false, outputencoding, outputformat,
		((OP_BIDI & optionfilters) == OP_BIDI),
		((OP_ARSHAPE & optionfilters) == OP_ARSHAPE));

	ModMap::iterator it;
	ListKey listkey;
	SectionMap::iterator sit;
	ConfigEntMap::iterator eit;

	SWModule *target;
	char *font = 0;
	char inputformat = 0;
	SWBuf encoding;
	char querytype = 0;

	if (locale) {
		LocaleMgr::getSystemLocaleMgr()->setDefaultLocaleName(locale);
	}

	//deal with queries to "system"
	if (!::stricmp(text, "system")) {
		querytype = QT_SYSTEM;
		systemquery(ref, output);
	}
	if (!strnicmp(text, "info", 4)) {
	        querytype = QT_INFO;
		text = ref;
	}
	//otherwise, we have a real book
	it = manager.Modules.find(text);
	if (it == manager.Modules.end()) { //book not found
		return;
	}
	target = (*it).second;
	SWKey *p = target->createKey();
        VerseKey *parser = SWDYNAMIC_CAST(VerseKey, p);
	if (!parser) {
        	delete p;
	        parser = new VerseKey();
	}

	if ((sit = manager.config->Sections.find((*it).second->getName())) != manager.config->Sections.end()) {
		if ((eit = (*sit).second.find("SourceType")) != (*sit).second.end()) {
			if (!::stricmp((char *)(*eit).second.c_str(), "GBF"))
				inputformat = FMT_GBF;
			else if (!::stricmp((char *)(*eit).second.c_str(), "ThML"))
				inputformat = FMT_THML;
			else if (!::stricmp((char *)(*eit).second.c_str(), "OSIS"))
				inputformat = FMT_OSIS;
			else if (!::stricmp((char *)(*eit).second.c_str(), "TEI"))
				inputformat = FMT_TEI;
		}
		encoding = ((eit = (*sit).second.find("Encoding")) != (*sit).second.end()) ? (*eit).second : (SWBuf)"";
	}


	if (querytype == QT_INFO) {
	  switch (inputformat) {
	  case FMT_THML :
	    *output << "ThML";
	    break;
	  case FMT_GBF :
	    *output << "GBF";
	    break;
	  case FMT_OSIS :
	    *output << "OSIS";
	    break;
	  case FMT_TEI :
	    *output << "TEI";
	    break;
	  default:
	    *output << "Other";
	  }
	  *output << ";";
	  *output << target->getType();
	  *output << ";";
	  delete parser;
	  return;
	}

	if (searchtype)
		querytype = QT_SEARCH;
	else if (!strcmp(target->getType(), "Biblical Texts"))
		querytype = QT_BIBLE;
	else if (!strcmp(target->getType(), "Commentaries"))
		querytype = QT_COMM;
	else if (!strcmp(target->getType(), "Lexicons / Dictionaries"))
		querytype = QT_LD;
	else if (!strcmp(target->getType(), "Generic Books"))
		querytype = QT_LD;

	if (optionfilters & OP_FOOTNOTES)
		manager.setGlobalOption("Footnotes","On");
	else
		manager.setGlobalOption("Footnotes","Off");
	if (optionfilters & OP_HEADINGS)
		manager.setGlobalOption("Headings","On");
	else
		manager.setGlobalOption("Headings","Off");
//.........这里部分代码省略.........
开发者ID:raphink,项目名称:sword,代码行数:101,代码来源:corediatheke.cpp


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