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


C++ StringTable::erase方法代码示例

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


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

示例1: SaveSettings

void SaveSettings()
{
  /*
   * NOTE! This code needs to stay in sync with the preference setting
   *       code in in nsExceptionHandler.cpp.
   */

  StringTable settings;

  ReadStringsFromFile(gSettingsPath + "/" + kIniFile, settings, true);
  if (!gEmailFieldHint)
    settings["Email"] = gtk_entry_get_text(GTK_ENTRY(gEmailEntry));
  else
    settings.erase("Email");

  settings["EmailMe"] =
    gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(gEmailMeCheck)) ? "1" : "0";
  if (gIncludeURLCheck != 0)
    settings["IncludeURL"] =
      gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(gIncludeURLCheck))
      ? "1" : "0";
  settings["SubmitReport"] =
    gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(gSubmitReportCheck))
    ? "1" : "0";

  WriteStringsToFile(gSettingsPath + "/" + kIniFile,
                     "Crash Reporter", settings, true);
}
开发者ID:abhishekvp,项目名称:gecko-dev,代码行数:28,代码来源:crashreporter_linux.cpp

示例2: UpdateURL

static void UpdateURL()
{
  if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(gIncludeURLCheck))) {
    gQueryParameters["URL"] = gURLParameter;
  } else {
    gQueryParameters.erase("URL");
  }
}
开发者ID:JuannyWang,项目名称:gecko-dev,代码行数:8,代码来源:crashreporter_gtk_common.cpp

示例3: main

int main(int argc, char** argv)
{
  gArgc = argc;
  gArgv = argv;

  if (!ReadConfig()) {
    UIError("Couldn't read configuration.");
    return 0;
  }

  if (!UIInit())
    return 0;

  if (argc > 1) {
    gReporterDumpFile = argv[1];
  }

  if (gReporterDumpFile.empty()) {
    // no dump file specified, run the default UI
    UIShowDefaultUI();
  } else {
    // Start by running minidump analyzer to gather stack traces.
    string reporterDumpFile = gReporterDumpFile;
    vector<string> args = { reporterDumpFile };
    UIRunProgram(GetProgramPath(UI_MINIDUMP_ANALYZER_FILENAME),
                 args, /* wait */ true);

    // go ahead with the crash reporter
    gExtraFile = GetAdditionalFilename(gReporterDumpFile, kExtraDataExtension);
    if (gExtraFile.empty()) {
      UIError(gStrings[ST_ERROR_BADARGUMENTS]);
      return 0;
    }

    if (!UIFileExists(gExtraFile)) {
      UIError(gStrings[ST_ERROR_EXTRAFILEEXISTS]);
      return 0;
    }

    gMemoryFile = GetAdditionalFilename(gReporterDumpFile,
                                        kMemoryReportExtension);
    if (!UIFileExists(gMemoryFile)) {
      gMemoryFile.erase();
    }

    StringTable queryParameters;
    if (!ReadStringsFromFile(gExtraFile, queryParameters, true)) {
      UIError(gStrings[ST_ERROR_EXTRAFILEREAD]);
      return 0;
    }

    if (queryParameters.find("ProductName") == queryParameters.end()) {
      UIError(gStrings[ST_ERROR_NOPRODUCTNAME]);
      return 0;
    }

    // There is enough information in the extra file to rewrite strings
    // to be product specific
    RewriteStrings(queryParameters);

    if (queryParameters.find("ServerURL") == queryParameters.end()) {
      UIError(gStrings[ST_ERROR_NOSERVERURL]);
      return 0;
    }

    // Hopefully the settings path exists in the environment. Try that before
    // asking the platform-specific code to guess.
    gSettingsPath = UIGetEnv("MOZ_CRASHREPORTER_DATA_DIRECTORY");
    if (gSettingsPath.empty()) {
      string product = queryParameters["ProductName"];
      string vendor = queryParameters["Vendor"];
      if (!UIGetSettingsPath(vendor, product, gSettingsPath)) {
        gSettingsPath.clear();
      }
    }

    if (gSettingsPath.empty() || !UIEnsurePathExists(gSettingsPath)) {
      UIError(gStrings[ST_ERROR_NOSETTINGSPATH]);
      return 0;
    }

    OpenLogFile();

    gEventsPath = UIGetEnv("MOZ_CRASHREPORTER_EVENTS_DIRECTORY");
    gPingPath = UIGetEnv("MOZ_CRASHREPORTER_PING_DIRECTORY");

    // Assemble and send the crash ping
    string hash;
    string pingUuid;

    hash = ComputeDumpHash();
    if (!hash.empty()) {
      AppendToEventFile("MinidumpSha256Hash", hash);
    }

    if (SendCrashPing(queryParameters, hash, pingUuid, gPingPath)) {
      AppendToEventFile("CrashPingUUID", pingUuid);
    }

    // Update the crash event with stacks if they are present
//.........这里部分代码省略.........
开发者ID:Wafflespeanut,项目名称:gecko-dev,代码行数:101,代码来源:crashreporter.cpp

示例4: main

int main(int argc, char** argv)
{
    gArgc = argc;
    gArgv = argv;

    if (!ReadConfig()) {
        UIError("Couldn't read configuration.");
        return 0;
    }

    if (!UIInit())
        return 0;

    if (argc > 1) {
        gReporterDumpFile = argv[1];
    }

    if (gReporterDumpFile.empty()) {
        // no dump file specified, run the default UI
        UIShowDefaultUI();
    } else {
        gExtraFile = GetAdditionalFilename(gReporterDumpFile, kExtraDataExtension);
        if (gExtraFile.empty()) {
            UIError(gStrings[ST_ERROR_BADARGUMENTS]);
            return 0;
        }

        if (!UIFileExists(gExtraFile)) {
            UIError(gStrings[ST_ERROR_EXTRAFILEEXISTS]);
            return 0;
        }

        gMemoryFile = GetAdditionalFilename(gReporterDumpFile,
                                            kMemoryReportExtension);
        if (!UIFileExists(gMemoryFile)) {
            gMemoryFile.erase();
        }

        StringTable queryParameters;
        if (!ReadStringsFromFile(gExtraFile, queryParameters, true)) {
            UIError(gStrings[ST_ERROR_EXTRAFILEREAD]);
            return 0;
        }

        if (queryParameters.find("ProductName") == queryParameters.end()) {
            UIError(gStrings[ST_ERROR_NOPRODUCTNAME]);
            return 0;
        }

        // There is enough information in the extra file to rewrite strings
        // to be product specific
        RewriteStrings(queryParameters);

        if (queryParameters.find("ServerURL") == queryParameters.end()) {
            UIError(gStrings[ST_ERROR_NOSERVERURL]);
            return 0;
        }

        // Hopefully the settings path exists in the environment. Try that before
        // asking the platform-specific code to guess.
#ifdef XP_WIN32
        static const wchar_t kDataDirKey[] = L"MOZ_CRASHREPORTER_DATA_DIRECTORY";
        const wchar_t *settingsPath = _wgetenv(kDataDirKey);
        if (settingsPath && *settingsPath) {
            gSettingsPath = WideToUTF8(settingsPath);
        }
#else
        static const char kDataDirKey[] = "MOZ_CRASHREPORTER_DATA_DIRECTORY";
        const char *settingsPath = getenv(kDataDirKey);
        if (settingsPath && *settingsPath) {
            gSettingsPath = settingsPath;
        }
#endif
        else {
            string product = queryParameters["ProductName"];
            string vendor = queryParameters["Vendor"];
            if (!UIGetSettingsPath(vendor, product, gSettingsPath)) {
                gSettingsPath.clear();
            }
        }

        if (gSettingsPath.empty() || !UIEnsurePathExists(gSettingsPath)) {
            UIError(gStrings[ST_ERROR_NOSETTINGSPATH]);
            return 0;
        }

        OpenLogFile();

#ifdef XP_WIN32
        static const wchar_t kEventsDirKey[] = L"MOZ_CRASHREPORTER_EVENTS_DIRECTORY";
        const wchar_t *eventsPath = _wgetenv(kEventsDirKey);
        if (eventsPath && *eventsPath) {
            gEventsPath = WideToUTF8(eventsPath);
        }
#else
        static const char kEventsDirKey[] = "MOZ_CRASHREPORTER_EVENTS_DIRECTORY";
        const char *eventsPath = getenv(kEventsDirKey);
        if (eventsPath && *eventsPath) {
            gEventsPath = eventsPath;
        }
//.........这里部分代码省略.........
开发者ID:qiuyang001,项目名称:Spidermonkey,代码行数:101,代码来源:crashreporter.cpp


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