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


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

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


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

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

示例2: if

/*
 * 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

示例3:

const char *SWModule_getFootnoteBody(SWHANDLE hmodule, const char *key, const char *note) {
	SWModule *module = (SWModule *)hmodule;
	static SWBuf body;
	module->popError();
	module->setKey(key);
	module->renderText();
	body = module->getEntryAttributes()["Footnote"][note]["body"].c_str();
	SWKey *keybuf = module->getKey();;
	module->renderFilter(body, keybuf);
	return (body) ? (const char*)body.c_str() : NULL;
}
开发者ID:,项目名称:,代码行数:11,代码来源:

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

示例5: main

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

        const char *modName = "HunKar";
        SWMgr library;
        SWModule *book = library.getModule(modName);
        if (!book) {
                cerr << "Can't find module: " << modName << endl;
                return -1;
        }
        VerseKey* key = ((VerseKey *)book->getKey());

        key->setIntros(true);
        book->setSkipConsecutiveLinks(true);
        book->setPosition(TOP);

        cout << *key << endl;
        return 0;
}
开发者ID:raphink,项目名称:sword,代码行数:18,代码来源:verseposition.cpp

示例6: main

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

	SWMgr library;

	SWModule *book = library.getModule("KJV");

	VerseKey *vk = (VerseKey *) book->getKey();
	for (;!vk->popError();vk->setChapter(vk->getChapter()+1)) {
		vk->setVerse(vk->getVerseMax());
		SWBuf text = book->stripText();
		text = text.trim();
		if (text.endsWith(",")) {
			cout << vk->getText() << ":\n\n";
			cout << text << endl;
		}
	}

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

示例7: getModule

/*
 * Class:     org_crosswire_android_sword_SWModule
 * Method:    hasKeyChildren
 * Signature: ()Z
 */
JNIEXPORT jboolean JNICALL Java_org_crosswire_android_sword_SWModule_hasKeyChildren
  (JNIEnv *env, jobject me) {

	init(); 


	SWModule *module = getModule(env, me);
	jboolean retVal = JNI_FALSE;

	if (module) {
		sword::SWKey *key = module->getKey();

		TreeKeyIdx *tkey = SWDYNAMIC_CAST(TreeKeyIdx, key);
		if (tkey) {
			retVal = (tkey->hasChildren())?JNI_TRUE:JNI_FALSE;
		}
	}
	return retVal;
}
开发者ID:raphink,项目名称:sword,代码行数:24,代码来源:swordstub.cpp

示例8: main

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

	cout << "\n";

	const char *modName = (argc > 1) ? argv[1] : "KJV";
	SWMgr manager;
	SWModule *bible = manager.getModule(modName);
	if (!bible) {
		cout << modName << " module is not installed.\nPlease install to show versification (v11n) from this specific Bible.\nShowing builtin KJV v11n scheme..\n\n";
	}

	VerseKey *vk = (bible) ? (VerseKey *)bible->getKey() : new VerseKey();

	for ((*vk) = TOP; !vk->popError(); vk->setBook(vk->getBook()+1)) {
		cout << vk->getBookName() << "\n";
	}

	// if we 'new'ed a VerseKey unassociated with a module, above, then we should delete it.
	if (!bible) delete vk;

	return 0;
}
开发者ID:,项目名称:,代码行数:22,代码来源:

示例9: main

int main(int argc, char **argv) {
	std::cerr << "\n";
	SWLog::getSystemLog()->setLogLevel(SWLog::LOG_DEBUG);
	SWConfig *sysConf = 0;
	if (argc > 1) {
		sysConf = new SWConfig(argv[1]);
	}
	SWMgr mymgr(0, sysConf);
	std::cerr << "\n\nprefixPath: " << mymgr.prefixPath;
	std::cerr << "\nconfigPath: " << mymgr.configPath << "\n\n";



	ModMap::iterator it;

	for (it = mymgr.Modules.begin(); it != mymgr.Modules.end(); it++) {
		std::cout << "[" << (*it).second->getName() << "] (Writable: " << (it->second->isWritable()?"Yes":"No") << ") [" << (*it).second->getDescription() << "]\n";
		std::cout << "AbsoluteDataPath = " << it->second->getConfigEntry("AbsoluteDataPath") << "\n";
		std::cout << "Has Feature HebrewDef = " << it->second->getConfig().has("Feature", "HebrewDef") << "\n";
		if ((!strcmp((*it).second->getType(), "Biblical Texts")) || (!strcmp((*it).second->getType(), "Commentaries"))) {
			it->second->setKey("James 1:19");
			std::cout << (const char *) *(*it).second << "\n\n";
		}
	}

	SWModule *mhc = mymgr.Modules["MHC"];

	if (mhc) {
		std::cout << "MHC, Lang = " << mhc->getLanguage() << "\n\n";
		for (mhc->setKey("Gen 1:1"); *mhc->getKey() < (VerseKey) "Gen 1:10"; (*mhc)++)
			std::cout << (const char *) *mhc << "\n";
	}

	if (sysConf)
		delete sysConf;

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

示例10: getBooknames

std::string SwordPluginAPI::getBooknames(const std::string& moduleName) {
    std::stringstream bnames;
    std::string bnStr;

    SWModule *module = displayLibrary->getModule(moduleName.c_str());
    /*if (!module) {
        PDL_JSException(parms, "getBooknames: Couldn't find Module");
        return PDL_TRUE;  // assert we found the module
    }

    VerseKey *vkey = dynamic_cast<VerseKey *>(module->getKey());
    if (!vkey) {
        PDL_JSException(parms, "getBooknames: Couldn't find verse!");
        return PDL_TRUE;    // assert our module uses verses
    } */
    VerseKey *vkey = dynamic_cast<VerseKey *>(module->getKey());
    VerseKey &vk = *vkey;

    bnames << "[";
    for (int b = 0; b < 2; b++) {
        vk.setTestament(b+1);
        for (int i = 0; i < vk.BMAX[b]; i++) {
            vk.setBook(i+1);
            bnames << "{\"name\": \"" << convertString(vk.getBookName()) << "\", ";
            bnames << "\"abbrev\": \"" << convertString(vk.getBookAbbrev()) << "\", ";
            bnames << "\"cmax\": \"" << vk.getChapterMax() << "\"}";
            if (i+1 == vk.BMAX[b] && b == 1) {
                bnames << "]";
            } else {
                bnames << ", ";
            }
        }
    }

    return bnames.str();
}
开发者ID:zefanja,项目名称:biblez-plugin,代码行数:36,代码来源:SwordPluginAPI.cpp

示例11: main

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

	SWMgr library;
	SWModule *kjv = library.getModule((argc > 1)?argv[1]:"KJV");

	kjv->setKey(argc > 2 ? argv[2] : "Jn.3.16");

	VerseKey *key = (VerseKey *)kjv->getKey();

	int curVerse = key->getVerse();
	int curChapter = key->getChapter();
	int curBook = key->getBook();

	for (key->setVerse(1);
				(key->getBook()    == curBook)    &&
				(key->getChapter() == curChapter) &&
				!kjv->popError();
				(*kjv)++) {
		if (key->getVerse() == curVerse) cout << "* ";
		cout << key->getVerse() << " " << kjv->stripText() << "\n";
	}

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

示例12: 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 << "]";
//.........这里部分代码省略.........
开发者ID:zefanja,项目名称:biblez-plugin,代码行数:101,代码来源:SwordPluginAPI.cpp

示例13: main

int main(int argc, char **argv)
{
//    SWMgr manager(0, 0, true, new MarkupFilterMgr(FMT_RTF, ENC_RTF));
    SWMgr manager;
    SWModule *target;
    ListKey listkey;
    ListKey scope;
    ModMap::iterator it;

    if ((argc < 3) || (argc > 5)) {
        fprintf(stderr, "\nusage: %s <modname> <\"search string\"> [\"search_scope\"] [\"search again for string in previous result set\"]\n"
                             "\tExample: search KJV \"swift hear slow speak\"\n\n", argv[0]);

        exit(-1);
    }


    std::string searchTerm = argv[2];
    manager.setGlobalOption("Greek Accents", "Off");
    manager.setGlobalOption("Strong's Numbers", "On");
    manager.setGlobalOption("Hebrew Vowel Points", "Off");
    manager.filterText("Greek Accents", searchTerm);

    it = manager.Modules.find(argv[1]);
    if (it == manager.Modules.end()) {
        fprintf(stderr, "Could not find module [%s].  Available modules:\n", argv[1]);
        for (it = manager.Modules.begin(); it != manager.Modules.end(); ++it) {
            fprintf(stderr, "[%s]\t - %s\n", (*it).second->getName(), (*it).second->getDescription());
        }
        exit(-1);
    }

    target = (*it).second;

    if (argc > 3) {            // if min / max specified
        SWKey *k = target->getKey();
        VerseKey *parser = SWDYNAMIC_CAST(VerseKey, k);
        VerseKey kjvParser;
        if (!parser) parser = &kjvParser;    // use standard KJV parsing as fallback
        scope = parser->parseVerseList(argv[3], *parser, true);
        scope.setPersist(true);
        target->setKey(scope);
    }

    std::cerr << "[0=================================50===============================100]\n ";
    char lineLen = 70;
    listkey = target->search(searchTerm.c_str(), SEARCH_TYPE, /*SEARCHFLAG_MATCHWHOLEENTRY*/ REG_ICASE, 0, 0, &percentUpdate, &lineLen);
    std::cerr << std::endl;
    if (argc > 4) {            // if min / max specified
        scope = listkey;
        scope.setPersist(true);
        target->setKey(scope);
        printed = 0;
        std::cerr << " ";
        listkey = target->search(argv[4], SEARCH_TYPE, /*SEARCHFLAG_MATCHWHOLEENTRY*/ REG_ICASE, 0, 0, &percentUpdate, &lineLen);
        std::cerr << std::endl;
    }
// we don't want to sort by verse if we've been given scores
//    listkey.sort();
    while (!listkey.popError()) {
        std::cout << (const char *)listkey;
        if (listkey.getElement()->userData) std::cout << " : " << (uint64_t)listkey.getElement()->userData << "%";
        std::cout << std::endl;
        ++listkey;
    }

    return 0;

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

示例14: doquery


//.........这里部分代码省略.........

	}

	else if (querytype == QT_BIBLE || querytype == QT_COMM) {
		//do commentary/Bible stuff

		if ((sit = manager.config->Sections.find((*it).second->getName())) != manager.config->Sections.end()) {
			if ((eit = (*sit).second.find("Font")) != (*sit).second.end()) {
				font = (char *)(*eit).second.c_str();
				if (strlen(font) == 0) font = 0;
			}
		}

 		listkey = parser->parseVerseList(ref, "Gen1:1", true);
		int i;

		if (outputformat == FMT_RTF) {
			*output << "{\\rtf1\\ansi{\\fonttbl{\\f0\\froman\\fcharset0\\fprq2 Times New Roman;}{\\f1\\fdecor\\fprq2 ";
			if (font)
				*output << font;
			else
				*output << "Times New Roman";
			*output << ";}{\\f7\\froman\\fcharset2\\fprq2 Symbol;}}";
		}
		else if (outputformat == FMT_HTML) {
			*output << "<meta http-equiv=\"content-type\" content=\"text/html; charset=UTF-8\">";
		}

		for (i = 0; i < listkey.Count() && maxverses; i++) {
			VerseKey *element = SWDYNAMIC_CAST(VerseKey, listkey.GetElement(i));
			if (element && element->isBoundSet()) {
			  target->setKey(element->getLowerBound());
				*parser = element->getUpperBound();
				while (maxverses && *target->getKey() <= *parser) {
					*output << (char*)target->getKeyText();
					if (font && (outputformat == FMT_HTML || outputformat == FMT_THML || outputformat == FMT_CGI)) {
						*output << ": <font face=\"";
						*output << font;
						*output << "\">";
					}
					else if (outputformat == FMT_RTF) {
						*output << ": {\\f1 ";
					}
					else {
						*output << ": ";
					}
					*output << (const char*)*target;
					if (font && (outputformat == FMT_HTML || outputformat == FMT_THML || outputformat == FMT_CGI)) {
						*output << "</font>";
					}
					else if (outputformat == FMT_RTF) {
						*output << "}";
					}

					if (inputformat != FMT_THML && (outputformat == FMT_HTML || outputformat == FMT_THML || outputformat == FMT_CGI))
						*output << "<br />";
					else if (outputformat == FMT_OSIS)
						*output << "<milestone type=\"line\"/>";
					else if (outputformat == FMT_RTF)
						*output << "\\par ";
					else if (outputformat == FMT_GBF)
						*output << "<CM>";

					*output << "\n";

					if (*target->getKey() == *parser)
开发者ID:raphink,项目名称:sword,代码行数:67,代码来源:corediatheke.cpp


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