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


C++ TextFile::load方法代码示例

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


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

示例1: GetHeroList

/**
 * 从总Profile中读取每个小酒店的名称和英雄列表
 */
void GetHeroList(const char *profilePath)
{
    TextFile profile;
    string trvernList[] = {"n01B","n01P","n0GK","n0LJ","n01N","n007","n005","n0LI","n008","n0GJ","n01D","n0LH"};
    profile.load("D:\\Games\\Warcraft III\\Maps\\MapHack\\DotAHackS7\\MapTools\\conf\\FuncAndStrings.txt");
    for (int i=0; i<sizeof(trvernList); i++)
    {
        ObjectIdentity trvern_id;
        trvern_id.set_id(trvernList[i].c_str());
    }
}
开发者ID:Arathi,项目名称:W3Objects,代码行数:14,代码来源:W3OMain.cpp

示例2: MergeProfiles

/**
 * 合并Units目录下的所有profile
 */
void MergeProfiles(const char *filePath)
{
    ifstream ifs(filePath);
    TextFile profiles;
    string pathBase="D:\\Games\\Warcraft III\\Maps\\MapHack\\DotAHackS7\\MapFiles\\Units\\", fileName;
    while (ifs>>fileName)
    {
        profiles.load(pathBase+fileName);
    }
    profiles.save("D:\\Games\\Warcraft III\\Maps\\MapHack\\DotAHackS7\\MapTools\\output\\FuncAndStrings.txt");
}
开发者ID:Arathi,项目名称:W3Objects,代码行数:14,代码来源:W3OMain.cpp

示例3: HeaderInfo

  HeaderInfo(const String& filename)
  {
    header_description = "-- empty --";
    TextFile tf;
    tf.load(filename);
    String content = ListUtils::concatenate(tf, ";");

    String search = "$$ Sample Description:";
    Size pos = content.find(search);
    if (pos != -1)
    {
      pos += search.size();
      Size pos_end = content.find("$$", pos);
      if (pos_end != -1)
      {
        String tmp = content.substr(pos, pos_end - pos - 1);
        if (!tmp.trim().empty()) header_description = tmp;
        //std::cerr << "Header info is: " << header_description << std::endl;
      }
    }
  }
开发者ID:BioITer,项目名称:OpenMS,代码行数:21,代码来源:EICExtractor.C

示例4: ParseError

EnzymaticDigestionLogModel::EnzymaticDigestionLogModel() :
    enzyme_(*EnzymesDB::getInstance()->getEnzyme("Trypsin")),
    log_model_threshold_(0.25),
    model_data_()
{
    // load the cleavage model from disk (might throw exceptions)
    TextFile tf;
    tf.load(File::find("./CHEMISTRY/MissedCleavage.model"), true);
    for (TextFile::ConstIterator it = tf.begin(); it != tf.end(); ++it)
    {
        String tmp = *it;
        if (tmp.trim().hasPrefix("#")) continue;  // skip comments
        StringList components;
        tmp.split(' ', components);
        if (components.size() != 4)
        {
            throw Exception::ParseError(__FILE__, __LINE__, __PRETTY_FUNCTION__, String("split(' ',") + tmp + ")", String("Got ") + components.size() + " columns, expected 4!");
        }
        BindingSite_ bs(components[0].toInt(), components[1].trim());
        CleavageModel_ cl(components[2].toDouble(), components[3].toDouble());
        model_data_[bs] = cl;
    }
}
开发者ID:,项目名称:,代码行数:23,代码来源:

示例5: UnitMain

int UnitMain()
{
#ifdef SYLKFILE_UNIT
    SylkFile slk("D:\\TestDir\\mpq\\Units\\AbilityData.slk");
    slk.save("D:\\TestDir\\mpq\\UnitsCopy\\AbilityData.slk");
    slk.save("D:\\TestDir\\mpq\\UnitsCopy\\AbilityData.comp.slk", true);
    slk.gen_indexs();
#endif //SYLKFILE_UNIT

#ifdef SYLKRECORD_UNIT
    SylkRecord record;
    record.parser("C;X1;Y13;K\"wild\"");
    cout<<"Type="<<record.get_type()<<endl;
    cout<<"X="<<record.get_x()<<endl;
    cout<<"Y="<<record.get_y()<<endl;
    cout<<"Value="<<record.get_value()<<endl;
#endif //SYLKRECORD_UNIT

#ifdef CONVERT_UNIT
    //SylkFile slk("D:\\TestDir\\mpq\\Units\\AbilityData.slk");
    //int i, line = slk.get_y();
    //for (i=2; i<=line; i++)
    //{
    //    string idStr=slk.getTableData(1, i);
    //    clog << idStr << " => " << id2int(idStr) <<endl;
    //}
    //char bytes[]={1,0,0,0};
    //convertInt(bytes);
    string trimStr="    //townhall tier 1 dependency";
    lTrim(trimStr);
    clog<<trimStr<<endl;
#endif // IDCONVERT_UNIT

#ifdef PROFILE_PARAM_UNIT
    ProfileParam param;
    param.parse("Art=ReplaceableTextures\\CommandButtons\\BTNReplenishManaOn.blp");
    param.parse("Buttonpos=0,2");
    cout<<param.to_string()<<endl;
#endif // PROFILE_PARAM_UNIT

#ifdef PROFILE_NODE_UNIT
    ProfileNode node, node2;
    node.init("Ucrl");
    node.add_param("Art=ReplaceableTextures\\CommandButtons\\BTNHeroCryptLord.blp");
    node.add_param("Buttonpos=0,1");
    node.add_param("RequiresCount=3");
    node.add_param("Requires=");

    node2.init("Ucrl");
    node2.add_param("Requires1=unp1");
    node2.add_param("Requires2=unp2");
    node2.add_param("Specialart=Objects\\Spawnmodels\\Undead\\UndeadLargeDeathExplode\\UndeadLargeDeathExplode.mdl");
    node2.add_param("Attachmentanimprops=medium");
    node2.add_param("ScoreScreenIcon=UI\\Glues\\ScoreScreen\\scorescreen-hero-cryptlord.blp");
    //cout<<node.to_string()<<endl;
    //cout<<node2.to_string()<<endl;
    node.merge(node2);
    cout<<node.to_string()<<endl;
#endif // PROFILE_NODE_UNIT

#ifdef PROFILE_UNIT
    TextFile profile;
    profile.load("D:\\TestDir\\mpq\\Units_126\\ItemFunc.txt");
    profile.save("D:\\TestDir\\mpq\\UnitsCopy\\ItemFunc.txt");
#endif // PROFILE_UNIT

#ifdef W3OFILE_UNIT
    W3_File w3a;
    w3a.load("D:\\TestDir\\mpq\\war3map.w3a");
    w3a.save("D:\\TestDir\\mpq\\war3map_copy.w3a");
#endif // W3OFile_UNIT

    return 0;
}
开发者ID:Arathi,项目名称:W3Objects,代码行数:74,代码来源:W3OUnits.cpp

示例6: GetHeroAbilitys


//.........这里部分代码省略.........
    K34[81]="U00K";
    K34[82]="Opgh";
    K34[83]="Hvsh";
    K34[84]="Udea";
    K34[85]="E01B";
    K34[86]="E01A";
    K34[87]="U00P";
    K34[88]="E01C";
    K34[89]="H00I";
    K34[90]="N01W";
    K34[91]="N00R";
    K34[92]="H00R";
    K34[93]="H00N";
    K34[94]="H00U";
    K34[95]="Uktl";
    K34[96]="O016";
    K34[97]="N0HP";
    K34[98]="H071";
    K34[99]="Eevi";
    K34[100]="Ekee";
    K34[101]="E02H";
    K34[102]="Ulic";
    K34[103]="UC76";
    K34[104]="UC18";
    K34[105]="EC57";
    K34[106]="UC11";
    K34[107]="UC60";
    K34[108]="U00A";
    K34[109]="N0M7";
    K34[110]="N0MK";

    //载入单位名称的Profile文件(所有*UnitStrings.txt,共6个)
    TextFile profile;
    profile.load("D:\\Games\\Warcraft III\\Maps\\MapHack\\DotAHackS7\\MapFiles\\Units\\CampaignUnitStrings.txt");
    profile.load("D:\\Games\\Warcraft III\\Maps\\MapHack\\DotAHackS7\\MapFiles\\Units\\HumanUnitStrings.txt");
    profile.load("D:\\Games\\Warcraft III\\Maps\\MapHack\\DotAHackS7\\MapFiles\\Units\\NeutralUnitStrings.txt");
    profile.load("D:\\Games\\Warcraft III\\Maps\\MapHack\\DotAHackS7\\MapFiles\\Units\\OrcUnitStrings.txt");
    profile.load("D:\\Games\\Warcraft III\\Maps\\MapHack\\DotAHackS7\\MapFiles\\Units\\UndeadUnitStrings.txt");
    profile.load("D:\\Games\\Warcraft III\\Maps\\MapHack\\DotAHackS7\\MapFiles\\Units\\nightelfunitstrings.txt");

    profile.load("D:\\Games\\Warcraft III\\Maps\\MapHack\\DotAHackS7\\MapFiles\\Units\\CampaignAbilityStrings.txt");
    profile.load("D:\\Games\\Warcraft III\\Maps\\MapHack\\DotAHackS7\\MapFiles\\Units\\HumanAbilityStrings.txt");
    profile.load("D:\\Games\\Warcraft III\\Maps\\MapHack\\DotAHackS7\\MapFiles\\Units\\ItemAbilityStrings.txt");
    profile.load("D:\\Games\\Warcraft III\\Maps\\MapHack\\DotAHackS7\\MapFiles\\Units\\NeutralAbilityStrings.txt");
    profile.load("D:\\Games\\Warcraft III\\Maps\\MapHack\\DotAHackS7\\MapFiles\\Units\\NightElfAbilityStrings.txt");
    profile.load("D:\\Games\\Warcraft III\\Maps\\MapHack\\DotAHackS7\\MapFiles\\Units\\OrcAbilityStrings.txt");
    profile.load("D:\\Games\\Warcraft III\\Maps\\MapHack\\DotAHackS7\\MapFiles\\Units\\UndeadAbilityStrings.txt");
    profile.load("D:\\Games\\Warcraft III\\Maps\\MapHack\\DotAHackS7\\MapFiles\\Units\\commonabilitystrings.txt");

    profile.load("D:\\Games\\Warcraft III\\Maps\\MapHack\\DotAHackS7\\MapFiles\\Units\\CampaignAbilityFunc.txt");
    profile.load("D:\\Games\\Warcraft III\\Maps\\MapHack\\DotAHackS7\\MapFiles\\Units\\CommonAbilityFunc.txt");
    profile.load("D:\\Games\\Warcraft III\\Maps\\MapHack\\DotAHackS7\\MapFiles\\Units\\HumanAbilityFunc.txt");
    profile.load("D:\\Games\\Warcraft III\\Maps\\MapHack\\DotAHackS7\\MapFiles\\Units\\ItemAbilityFunc.txt");
    profile.load("D:\\Games\\Warcraft III\\Maps\\MapHack\\DotAHackS7\\MapFiles\\Units\\NeutralAbilityFunc.txt");
    profile.load("D:\\Games\\Warcraft III\\Maps\\MapHack\\DotAHackS7\\MapFiles\\Units\\NightElfAbilityFunc.txt");
    profile.load("D:\\Games\\Warcraft III\\Maps\\MapHack\\DotAHackS7\\MapFiles\\Units\\OrcAbilityFunc.txt");
    profile.load("D:\\Games\\Warcraft III\\Maps\\MapHack\\DotAHackS7\\MapFiles\\Units\\UndeadAbilityFunc.txt");

    //载入单位技能对应slk文件(UnitAbilities.slk)
    SylkFile slk;
    slk.load("D:\\Games\\Warcraft III\\Maps\\MapHack\\DotAHackS7\\MapFiles\\Units\\UnitAbilities.slk");

    //载入单位技能
    int heroId = 0;
    int heroAbilListID = slk.get_field_order("heroAbilList");
    for (heroId = 1; heroId <= 110; heroId++ )
开发者ID:Arathi,项目名称:W3Objects,代码行数:67,代码来源:W3OMain.cpp


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