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


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

本文整理汇总了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();
}
开发者ID:zefanja,项目名称:biblez-plugin,代码行数:25,代码来源:SwordPluginAPI.cpp

示例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;
}
开发者ID:raphink,项目名称:sword,代码行数:51,代码来源:swordstub.cpp

示例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;
}
开发者ID:raphink,项目名称:sword,代码行数:28,代码来源:swordstub.cpp

示例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);

//.........这里部分代码省略.........
开发者ID:lefticus,项目名称:BibleStudy,代码行数:101,代码来源:BookTreeCtrl.cpp


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