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


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

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


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

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

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

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

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

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


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