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


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

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


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

示例1: LoadSettings

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

  StringTable settings;
  if (ReadStringsFromFile(gSettingsPath + "/" + kIniFile, settings, true)) {
    if (settings.find("Email") != settings.end()) {
      gtk_entry_set_text(GTK_ENTRY(gEmailEntry), settings["Email"].c_str());
      gEmailFieldHint = false;
    }
    if (settings.find("EmailMe") != settings.end()) {
      gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(gEmailMeCheck),
                                   settings["EmailMe"][0] != '0');
    }
    if (settings.find("IncludeURL") != settings.end() &&
        gIncludeURLCheck != 0) {
      gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(gIncludeURLCheck),
                                   settings["IncludeURL"][0] != '0');
    }
    bool enabled;
    if (settings.find("SubmitReport") != settings.end())
      enabled = settings["SubmitReport"][0] != '0';
    else
      enabled = ShouldEnableSending();
    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(gSubmitReportCheck),
                                 enabled);
  }
}
开发者ID:abhishekvp,项目名称:gecko-dev,代码行数:31,代码来源:crashreporter_linux.cpp

示例2: text

 GameString text(const GameStringKey& id) const {
     auto a = m_strings.find(id);
     if (a != m_strings.end()) {
         return a->second;
     }
     return GameStringUtil::fromString("MISSING: " + id);
 }
开发者ID:aldoxtor,项目名称:openrw,代码行数:7,代码来源:GameTexts.hpp

示例3: StringValue

//---------------------------------------------------------------------------
const char* StringValue( const unsigned int stringID )
{
	const char* errorValue = "empty!";
	StringTable::iterator iter;
	for ( iter = s_theStringTable.begin(); iter != s_theStringTable.end(); ++ iter )
	{
		if ( iter->second.m_id == stringID ) return iter->second.m_originalString.c_str();
	}
	return errorValue;
}
开发者ID:slajar,项目名称:BeatDetection,代码行数:11,代码来源:StringTable.cpp

示例4: CountOccurrences

static void CountOccurrences(int nthreads) {
    StringTable table;

    tick_count t0 = tick_count::now();
    parallel_for( blocked_range<MyString*>( Data, Data+N, 1000 ), Tally(table) );
    tick_count t1 = tick_count::now();

    int n = 0;
    for( StringTable::iterator i=table.begin(); i!=table.end(); ++i ) {
        if( verbose && nthreads )
            printf("%s %d\n",i->first.c_str(),i->second);
        n += i->second;
    }

    if ( !silent ) printf("total = %d  unique = %u  time = %g\n", n, unsigned(table.size()), (t1-t0).seconds());
}
开发者ID:Klaim,项目名称:aos-cpp-dependencies,代码行数:16,代码来源:count_strings.cpp

示例5: Save

    void Save(const char* filename)
    {
        const std::string header("String #");
        const std::string header_next(" is ");
        const char splitter = '~';

        if(_origin.empty())
            return;

        std::ofstream  fin(filename);

        fin << "// Total:" << _origin.size() << std::endl;
        StringTable::iterator itr = _origin.begin();
        for(;itr!=_origin.end();itr++)
        {
            fin << header << itr->first << header_next << splitter
                << itr->second << splitter << std::endl;
        }
    }
开发者ID:fantasydr,项目名称:nwn2dev,代码行数:19,代码来源:UpdateModTemplates.cpp

示例6: PushString

    unsigned int PushString(unsigned int index, const std::string& content)
    {
        StringTable::iterator ot = _origin.find(index);
        if(ot != _origin.end())
            throw std::runtime_error( "String ID conflict." );

        StringTableRev::iterator otr = _origin_rev.find(content);
        if(otr != _origin_rev.end())
            return otr->second; // duplicated string

        // got unique string
        _origin[index] = content;
        _origin_rev[content] = index;

        if(_max_id < index)
            _max_id = index;

        return index;
    }
开发者ID:fantasydr,项目名称:nwn2dev,代码行数:19,代码来源:UpdateModTemplates.cpp

示例7: StringID

//---------------------------------------------------------------------------
unsigned int StringID( const std::string& stringValue )
{
	std::string value( stringValue );
	ToLower( value );
	StringTable::iterator iter = s_theStringTable.find( value );
	if ( iter != s_theStringTable.end() )
	{
		return iter->second.m_id;
	}
	else
	{
		StringTableEntry newEntry;
		newEntry.m_id = s_nextStringID;
		newEntry.m_originalString = stringValue;
		s_theStringTable.insert( std::make_pair( value, newEntry ) );
		++ s_nextStringID;
		return newEntry.m_id;
	}
}
开发者ID:slajar,项目名称:BeatDetection,代码行数:20,代码来源:StringTable.cpp

示例8: WriteStrings

bool WriteStrings(ostream& out,
                  const string& header,
                  StringTable& strings,
                  bool escape)
{
  out << "[" << header << "]" << std::endl;
  for (StringTable::iterator iter = strings.begin();
       iter != strings.end();
       iter++) {
    out << iter->first << "=";
    if (escape)
      out << Escape(iter->second);
    else
      out << iter->second;

    out << std::endl;
  }

  return true;
}
开发者ID:Wafflespeanut,项目名称:gecko-dev,代码行数:20,代码来源:crashreporter.cpp

示例9: CountOccurrences

static void CountOccurrences(int nthreads) {
    StringTable table;

    tick_count t0 = tick_count::now();
    parallel_for( blocked_range<mystring*>( Data, Data+N, 1000 ), Tally(table) );
    tick_count t1 = tick_count::now();

    int n = 0;
    for( StringTable::iterator i=table.begin(); i!=table.end(); ++i ) {
        if( Verbose && nthreads )
            printf("%s %d\n",i->first.c_str(),i->second);
        n += i->second;
    }

    if (is_number_of_threads_set) {
        printf("threads = %d  total = %d  unique = %u  time = %g\n", nthreads, n, unsigned(table.size()), (t1-t0).seconds());
    } else {
        if ( nthreads == 1 ) {
            printf("serial run   total = %d  unique = %u  time = %g\n", n, unsigned(table.size()), (t1-t0).seconds());
        } else {
            printf("parallel run total = %d  unique = %u  time = %g\n", n, unsigned(table.size()), (t1-t0).seconds());
        }
    }
}
开发者ID:GDXN,项目名称:fitsliberator,代码行数:24,代码来源:count_strings.cpp

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

示例11: AddSubmittedReport

static bool AddSubmittedReport(const string& serverResponse)
{
  StringTable responseItems;
  istringstream in(serverResponse);
  ReadStrings(in, responseItems, false);

  if (responseItems.find("StopSendingReportsFor") != responseItems.end()) {
    // server wants to tell us to stop sending reports for a certain version
    string reportPath =
      gSettingsPath + UI_DIR_SEPARATOR + "EndOfLife" +
      responseItems["StopSendingReportsFor"];

    ofstream* reportFile = UIOpenWrite(reportPath);
    if (reportFile->is_open()) {
      // don't really care about the contents
      *reportFile << 1 << "\n";
      reportFile->close();
    }
    delete reportFile;
  }

  if (responseItems.find("Discarded") != responseItems.end()) {
    // server discarded this report... save it so the user can resubmit it
    // manually
    return false;
  }

  if (responseItems.find("CrashID") == responseItems.end())
    return false;

  string submittedDir =
    gSettingsPath + UI_DIR_SEPARATOR + "submitted";
  if (!UIEnsurePathExists(submittedDir)) {
    return false;
  }

  string path = submittedDir + UI_DIR_SEPARATOR +
    responseItems["CrashID"] + ".txt";

  ofstream* file = UIOpenWrite(path);
  if (!file->is_open()) {
    delete file;
    return false;
  }

  char buf[1024];
  UI_SNPRINTF(buf, 1024,
              gStrings["CrashID"].c_str(),
              responseItems["CrashID"].c_str());
  *file << buf << "\n";

  if (responseItems.find("ViewURL") != responseItems.end()) {
    UI_SNPRINTF(buf, 1024,
                gStrings["CrashDetailsURL"].c_str(),
                responseItems["ViewURL"].c_str());
    *file << buf << "\n";
  }

  file->close();
  delete file;

  WriteSubmissionEvent(Succeeded, responseItems["CrashID"]);
  return true;
}
开发者ID:Wafflespeanut,项目名称:gecko-dev,代码行数:64,代码来源:crashreporter.cpp

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