本文整理汇总了C++中SWModule::getLanguage方法的典型用法代码示例。如果您正苦于以下问题:C++ SWModule::getLanguage方法的具体用法?C++ SWModule::getLanguage怎么用?C++ SWModule::getLanguage使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SWModule
的用法示例。
在下文中一共展示了SWModule::getLanguage方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
JNIEXPORT jobjectArray JNICALL Java_org_crosswire_android_sword_SWMgr_getModInfoList
(JNIEnv *env, jobject) {
init();
int size = 0;
for (sword::ModMap::iterator it = mgr->Modules.begin(); it != mgr->Modules.end(); ++it) {
if ((!(it->second->getConfigEntry("CipherKey"))) || (*(it->second->getConfigEntry("CipherKey"))))
size++;
}
SWLog::getSystemLog()->logDebug("getModInfoList returning %d length array\n", size);
jclass clazzModInfo = env->FindClass("org/crosswire/android/sword/SWMgr$ModInfo");
jfieldID nameID = env->GetFieldID(clazzModInfo, "name", "Ljava/lang/String;");
jfieldID descID = env->GetFieldID(clazzModInfo, "description", "Ljava/lang/String;");
jfieldID catID = env->GetFieldID(clazzModInfo, "category", "Ljava/lang/String;");
jfieldID langID = env->GetFieldID(clazzModInfo, "language", "Ljava/lang/String;");
jfieldID versionID = env->GetFieldID(clazzModInfo, "version", "Ljava/lang/String;");
jfieldID deltaID = env->GetFieldID(clazzModInfo, "delta", "Ljava/lang/String;");
jobjectArray ret = (jobjectArray) env->NewObjectArray(size, clazzModInfo, NULL);
int i = 0;
for (sword::ModMap::iterator it = mgr->Modules.begin(); it != mgr->Modules.end(); ++it) {
SWModule *module = it->second;
if ((!(module->getConfigEntry("CipherKey"))) || (*(module->getConfigEntry("CipherKey")))) {
SWBuf type = module->Type();
SWBuf cat = module->getConfigEntry("Category");
SWBuf version = module->getConfigEntry("Version");
if (cat.length() > 0) type = cat;
jobject modInfo = env->AllocObject(clazzModInfo);
jstring val;
val = env->NewStringUTF(assureValidUTF8(module->getName())); env->SetObjectField(modInfo, nameID , val); env->DeleteLocalRef(val);
val = env->NewStringUTF(assureValidUTF8(module->getDescription())); env->SetObjectField(modInfo, descID , val); env->DeleteLocalRef(val);
val = env->NewStringUTF(assureValidUTF8(type.c_str())); env->SetObjectField(modInfo, catID , val); env->DeleteLocalRef(val);
val = env->NewStringUTF(assureValidUTF8(module->getLanguage())); env->SetObjectField(modInfo, langID , val); env->DeleteLocalRef(val);
val = env->NewStringUTF(assureValidUTF8(version.c_str())); env->SetObjectField(modInfo, versionID, val); env->DeleteLocalRef(val);
val = env->NewStringUTF(assureValidUTF8("")); env->SetObjectField(modInfo, deltaID , val); env->DeleteLocalRef(val);
env->SetObjectArrayElement(ret, i++, modInfo);
env->DeleteLocalRef(modInfo);
}
}
return ret;
}
示例2: 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;
}