本文整理汇总了C++中SWModule::getConfigEntry方法的典型用法代码示例。如果您正苦于以下问题:C++ SWModule::getConfigEntry方法的具体用法?C++ SWModule::getConfigEntry怎么用?C++ SWModule::getConfigEntry使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SWModule
的用法示例。
在下文中一共展示了SWModule::getConfigEntry方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: getModules
std::string SwordPluginAPI::getModules() {
/*Get all installed modules or all modules of a specific type. Set modType to e.g. "Biblical Texts"
getModules() returns a JSON string */
refreshManagers();
std::stringstream modules;
ModMap::iterator it;
modules << "[";
for (it = displayLibrary->Modules.begin(); it != displayLibrary->Modules.end(); it++) {
SWModule *module = (*it).second;
if (it != displayLibrary->Modules.begin()) {
modules << ", ";
}
modules << "{\"name\": \"" << module->Name() << "\", ";
modules << "\"modType\":\"" << module->Type() << "\", ";
if (module->getConfigEntry("Lang")) {
modules << "\"lang\": \"" << module->getConfigEntry("Lang") << "\", ";
}
modules << "\"dataPath\":\"" << module->getConfigEntry("DataPath") << "\", ";
modules << "\"descr\": \"" << convertString(module->Description()) << "\"}";
}
modules << "]";
return modules.str();
}
示例2:
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;
}
示例3: getModule
/*
* Class: org_crosswire_android_sword_SWModule
* Method: getConfigEntry
* Signature: (Ljava/lang/String;)Ljava/lang/String;
*/
JNIEXPORT jstring JNICALL Java_org_crosswire_android_sword_SWModule_getConfigEntry
(JNIEnv *env, jobject me, jstring configKeyJS) {
init();
jstring retVal = 0;
const char *configKey = env->GetStringUTFChars(configKeyJS, NULL);
SWLog::getSystemLog()->logDebug("getConfigEntry(%s)\n", configKey);
SWModule *module = getModule(env, me);
if (module) {
SWBuf about = module->getConfigEntry(configKey);
SWBuf assuredBuf = assureValidUTF8(about.c_str());
retVal = env->NewStringUTF(assuredBuf.c_str());
}
env->ReleaseStringUTFChars(configKeyJS, configKey);
return retVal;
}
示例4: RefreshBookList
void BookTreeCtrl::RefreshBookList(bool ShowLanguages)
{
using namespace sword;
ModMap::iterator it;
SWModule *curMod = 0;
ModMap *Modules;
Modules = m_SwordTools->GetModuleMap();
wxTreeItemId rootnode,
childnode,
langnode,
curNode;
std::map < string, wxTreeItemId > treenodes;
std::map < string, wxTreeItemId > treelangnodes;
string group,
grouplang;
wxString configEntry;
rootnode = AddRoot(wxT("books"));
for (it = Modules->begin(); it != Modules->end(); it++)
{
curMod = (*it).second;
if (curMod == 0) {
continue;
}
wxLogDebug(wxT("type %s"),
(const wxChar *) wxString(curMod->Type(), wxConvUTF8));
configEntry = wxT("");
configEntry = wxString(curMod->getConfigEntry("Category"), wxConvUTF8);
if (!configEntry.CompareTo(wxT("")))
{
childnode = treenodes[curMod->Type()];
if (!childnode.IsOk())
{
wxLogDebug(wxT("appending type"));
childnode =
AppendItem(rootnode, wxString(curMod->Type(), wxConvUTF8),
ID_CLOSEDFOLDER_ICON, ID_CLOSEDFOLDER_ICON);
treenodes[curMod->Type()] = childnode;
}
group = curMod->Type();
}
else
{
childnode = treenodes[(const char *) configEntry.mb_str()];
if (!childnode.IsOk())
{
childnode =
AppendItem(rootnode, configEntry, ID_CLOSEDFOLDER_ICON,
ID_CLOSEDFOLDER_ICON);
treenodes[(const char *) configEntry.mb_str()] = childnode;
}
curMod->Type((const char *) configEntry.mb_str());
group = (const char *) configEntry.mb_str();
}
grouplang = group;
wxLogDebug(wxT("language %s"),
(const wxChar *) wxString(curMod->Lang(), wxConvUTF8));
grouplang.append(curMod->Lang());
if (ShowLanguages)
{
langnode = treelangnodes[grouplang];
if (!langnode.IsOk())
{
wxString language;
wxLogDebug(wxT("appending language"));
language =
m_Languages.GetLanguage(wxString(curMod->Lang(), wxConvUTF8));
langnode =
AppendItem(childnode, language, ID_CLOSEDFOLDER_ICON,
ID_CLOSEDFOLDER_ICON);
treelangnodes[grouplang] = langnode;
}
}
else
{
langnode = childnode;
}
wxString modname = wxString(curMod->Name(), wxConvUTF8);
modname += wxT(" - ");
modname += wxString(curMod->Description(), wxConvUTF8);
wxLogDebug(wxT("appending module %s"), (const wxChar *) modname);
//.........这里部分代码省略.........