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


C++ ConfigElem::remove_string方法代码示例

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


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

示例1: Region

	JusticeRegion::JusticeRegion( Clib::ConfigElem& elem, RegionId id ) :
	  Region( elem, id ),
	  guarded_( elem.remove_bool( "Guarded", false ) ),
	  nocombat_( elem.remove_bool( "NoCombat", false ) ),
	  region_name_( elem.rest() ),
	  entertext_( elem.remove_string( "EnterText", "" ) ),
	  leavetext_( elem.remove_string( "LeaveText", "" ) ),
	  enter_script_( elem.remove_string( "EnterScript", "" ) ),
	  leave_script_( elem.remove_string( "LeaveScript", "" ) )
	{}
开发者ID:byterj,项目名称:POL_099b,代码行数:10,代码来源:guardrgn.cpp

示例2: runtime_error

	USpell::USpell( Clib::ConfigElem& elem, Plib::Package* pkg ) :
	  pkg_( pkg ),
	  spellid_( elem.remove_ushort( "SPELLID" ) ),
	  name_( elem.remove_string( "NAME" ) ),
	  power_words_( elem.remove_string( "POWERWORDS" ) ),
	  scriptdef_( elem.remove_string( "SCRIPT", "" ), pkg, "scripts/" )
	{
	  unsigned short action;
	  if ( elem.remove_prop( "ANIMATION", &action ) )
	  {
		if ( UACTION_IS_VALID( action ) )
		{
		  action_ = static_cast<UACTION>( action );
		}
		else
		{
		  elem.throw_error( "Animation is out of range" );
		}
	  }
	  else
	  {
		action_ = ACTION_CAST_SPELL1;
	  }

	  unsigned short circle;
	  if ( elem.remove_prop( "CIRCLE", &circle ) )
	  {
		if ( circle < 1 || circle > spellcircles.size() ||
			 spellcircles[circle - 1] == NULL )
		{
          ERROR_PRINT << "Error reading spell " << name_
            << ": Circle " << circle << " is not defined.\n";
		  throw std::runtime_error( "Config file error" );
		}

		params_ = spellcircles[circle - 1]->params;
	  }
	  else
	  {
		params_ = USpellParams( elem );
	  }

	  std::string reagent_name;
	  while ( elem.remove_prop( "Reagent", &reagent_name ) )
	  {
        unsigned int reagent = Items::get_objtype_from_string( reagent_name );

		reglist_.push_back( reagent );
	  }
	}
开发者ID:Lolkauo,项目名称:polserver,代码行数:50,代码来源:spells.cpp

示例3: inited

UOSkill::UOSkill( const Plib::Package* pkg, Clib::ConfigElem& elem )
    : inited( true ),
      skillid( strtoul( elem.rest(), nullptr, 10 ) ),
      attributename( elem.remove_string( "Attribute", "" ) ),
      pAttr( nullptr ),
      pkg( pkg )
{
  if ( skillid >= 500 )
    elem.throw_error( "SkillID must be < 500" );

  if ( !attributename.empty() )
  {
    bool required = false;
    if ( attributename[0] == '+' )
    {
      required = true;
      attributename = attributename.substr( 1, std::string::npos );
    }
    pAttr = Mobile::Attribute::FindAttribute( attributename );
    if ( !pAttr )
    {
      if ( required )
      {
        elem.throw_error( "Attribute " + attributename + " not found." );
      }
      else
      {
        elem.warn( "Attribute " + attributename + " not found." );
      }
    }
  }
}
开发者ID:polserver,项目名称:polserver,代码行数:32,代码来源:uoskills.cpp

示例4: read_bannedips_config

	void read_bannedips_config( bool initial_load )
	{
	  if ( !initial_load )
	  {
		Core::networkManager.banned_ips.clear();
	  }
	  if ( !Clib::FileExists( "config/bannedips.cfg" ) )
		return;

	  Clib::ConfigFile cf( "config/bannedips.cfg" );
	  Clib::ConfigElem elem;

	  while ( cf.read( elem ) )
	  {
		IPRule CurrentEntry;
		std::string iptext = elem.remove_string( "IPMatch" );
		std::string::size_type delim = iptext.find_first_of( "/" );
		if ( delim != std::string::npos )
		{
          std::string ipaddr_str = iptext.substr(0, delim);
          std::string ipmask_str = iptext.substr(delim + 1);
		  CurrentEntry.ipMatch = inet_addr( ipaddr_str.c_str() );
		  CurrentEntry.ipMask = inet_addr( ipmask_str.c_str() );
		  Core::networkManager.banned_ips.push_back( CurrentEntry );
		}
		else
		{
          std::string ipmask_str = "255.255.255.255";
		  CurrentEntry.ipMatch = inet_addr( iptext.c_str() );
		  CurrentEntry.ipMask = inet_addr( ipmask_str.c_str() );
		  Core::networkManager.banned_ips.push_back( CurrentEntry );
		}
	  }
	}
开发者ID:byterj,项目名称:POL_099b,代码行数:34,代码来源:bannedips.cpp

示例5: while

AuxService::AuxService( const Plib::Package* pkg, Clib::ConfigElem& elem ) :
  _pkg( pkg ),
  _scriptdef( elem.remove_string( "SCRIPT" ), _pkg ),
  _port( elem.remove_ushort( "PORT" ) )
{
  std::string iptext;
  while ( elem.remove_prop( "IPMATCH", &iptext ) )
  {
    auto delim = iptext.find_first_of("/");
    if (delim != std::string::npos)
    {
      std::string ipaddr_str = iptext.substr(0, delim);
      std::string ipmask_str = iptext.substr(delim + 1);
      unsigned int ipaddr = inet_addr( ipaddr_str.c_str() );
      unsigned int ipmask = inet_addr( ipmask_str.c_str() );
      _aux_ip_match.push_back( ipaddr );
      _aux_ip_match_mask.push_back( ipmask );
    }
    else
    {
      unsigned int ipaddr = inet_addr( iptext.c_str() );
      _aux_ip_match.push_back( ipaddr );
      _aux_ip_match_mask.push_back( 0xFFffFFffLu );
    }
  }
}
开发者ID:gtozzi,项目名称:polserver,代码行数:26,代码来源:auxclient.cpp

示例6: port

UoClientListener::UoClientListener( Clib::ConfigElem& elem ) :
  port( elem.remove_ushort( "PORT" ) ),
  aosresist( elem.remove_bool( "AOSRESISTANCES", false ) ),
  sticky( elem.remove_bool( "KeepClients", false ) )

{
  CalculateCryptKeys( elem.remove_string( "ENCRYPTION", "none" ), encryption );
}
开发者ID:gtozzi,项目名称:polserver,代码行数:8,代码来源:uoclient.cpp

示例7: EquipDesc

/// Since the constructor is doing some wrong guessing to tell when an armor is a shield,
/// forceShield will force to consider it a shield
ArmorDesc::ArmorDesc( u32 objtype, Clib::ConfigElem& elem, const Plib::Package* pkg,
                      bool forceShield )
    : EquipDesc( objtype, elem, ARMORDESC, pkg ),
      ar( elem.remove_ushort( "AR", 0 ) ),
      zones(),
      on_hit_script( elem.remove_string( "ONHITSCRIPT", "" ), pkg, "scripts/items/" )
{
  std::string coverage;
  while ( elem.remove_prop( "COVERAGE", &coverage ) )
  {
    try
    {
      zones.insert( Mobile::zone_name_to_zone( coverage.c_str() ) );
    }
    catch ( std::runtime_error& )
    {
      fmt::Writer tmp;
      tmp.Format( "Error in Objtype 0x{:X}" ) << objtype;
      if ( pkg == NULL )
        tmp << "config/itemdesc.cfg\n";
      else
        tmp << pkg->dir() << "itemdesc.cfg\n";

      ERROR_PRINT << tmp.str();
      throw;
    }
  }

  if ( zones.empty() )
  {
    // No 'COVERAGE' entries existed.
    // default coverage based on object type/layer
    unsigned short layer = Plib::systemstate.tile[graphic].layer;
    // special case for shields - they effectively have no coverage.
    if ( !forceShield && layer != Core::LAYER_HAND1 && layer != Core::LAYER_HAND2 )
    {
      try
      {
        zones.insert( Mobile::layer_to_zone( layer ) );
      }
      catch ( std::runtime_error& )
      {
        fmt::Writer tmp;
        tmp.Format( "Error in Objtype 0x{:X}" ) << objtype;
        if ( pkg == NULL )
          tmp << "config/itemdesc.cfg\n";
        else
          tmp << pkg->dir() << "itemdesc.cfg\n";

        ERROR_PRINT << tmp.str();
        throw;
      }
    }
  }
}
开发者ID:JohnnyB1971,项目名称:polserver,代码行数:57,代码来源:armor.cpp

示例8: pkg

Vital::Vital( const Plib::Package* pkg, Clib::ConfigElem& elem ) :
  pkg( pkg ),
  name( elem.rest() ),
  aliases(),
  vitalid( 0 ),
  next( NULL ),
  get_regenrate_func( FindExportedFunction( elem, pkg, elem.remove_string( "RegenRateFunction" ), 1 ) ),
  get_maximum_func( FindExportedFunction( elem, pkg, elem.remove_string( "MaximumFunction" ), 1 ) ),
  underflow_func( NULL ),
  regen_while_dead( elem.remove_bool( "RegenWhileDead", false ) )
{
  aliases.push_back( name );
  std::string tmp;
  while ( elem.remove_prop( "Alias", &tmp ) )
    aliases.push_back( tmp );

  if ( elem.remove_prop( "UnderflowFunction", &tmp ) )
  {
    underflow_func = FindExportedFunction( elem, pkg, tmp, 2 );
  }
}
开发者ID:gtozzi,项目名称:polserver,代码行数:21,代码来源:vital.cpp

示例9: readfrom

	void Account::readfrom( Clib::ConfigElem& elem )
	{
	  if ( elem.has_prop( "Password" ) )
	  {
        std::string temppass = elem.remove_string("Password");
		if ( Plib::systemstate.config.retain_cleartext_passwords )
		{
		  password_ = temppass;
		}
		if ( !Clib::MD5_Encrypt( name_ + temppass, passwordhash_ ) )	//MD5
		  elem.throw_error( "Failed to encrypt password for " + name_ );
		Plib::systemstate.accounts_txt_dirty = true;
	  }
	  else if ( elem.has_prop( "PasswordHash" ) )
	  {
		passwordhash_ = elem.remove_string( "PasswordHash" );
	  }
	  else
		elem.throw_error( "Failed password reads for account " + name_ );

	  enabled_ = elem.remove_bool( "ENABLED", true );
	  banned_ = elem.remove_bool( "BANNED", false );
	  uo_expansion_ = convert_uo_expansion( elem.remove_string( "UOExpansion", "T2A" ) );

	  default_privs_.readfrom( elem.remove_string( "DefaultPrivs", "" ) );

	  std::string cmdaccstr = elem.remove_string( "DefaultCmdLevel", "player" );
	  Core::CmdLevel* cmdlevel_search = Core::find_cmdlevel( cmdaccstr.c_str( ) );
	  if ( cmdlevel_search != NULL )
		default_cmdlevel_ = cmdlevel_search->cmdlevel;
	  else
		elem.throw_error( "Didn't understand cmdlevel of '" + cmdaccstr + "'" );

	  props_.clear();
	  props_.readProperties( elem );
	}
开发者ID:AlessandroMamusa,项目名称:polserver,代码行数:36,代码来源:account.cpp

示例10: name

RealmDescriptor::RealmDescriptor(const std::string& realm_name, const std::string& realm_path, Clib::ConfigElem& elem) :
  name( realm_name ),
  file_path( realm_path ),
  width( elem.remove_ushort( "width" ) ),
  height( elem.remove_ushort( "height" ) ),
  uomapid( elem.remove_unsigned( "uomapid", 0 ) ),
  uodif( elem.remove_bool( "uodif", false ) ),
  num_map_patches( elem.remove_unsigned( "num_map_patches", 0 ) ),
  num_static_patches( elem.remove_unsigned( "num_static_patches", 0 ) ),
  season( elem.remove_unsigned( "season", 1 ) ),
  mapserver_type( Clib::strlower( elem.remove_string( "mapserver", "memory" ) ) ),
  grid_width(calc_grid_size(width)),
  grid_height(calc_grid_size(height))
{
}
开发者ID:gtozzi,项目名称:polserver,代码行数:15,代码来源:realmdescriptor.cpp

示例11: read_region_data

void read_region_data( Clib::ConfigElem& elem )
{
  ResourceDef* rd = find_resource_def( elem.rest() );
  if ( rd == nullptr )
  {
    ERROR_PRINT << "Error reading RESOURCE.DAT: Unable to find resource type " << elem.rest()
                << "\n";
    throw std::runtime_error( "Data file error" );
  }
  std::string regionname = elem.remove_string( "Name" );
  ResourceRegion* rgn = rd->getregion( regionname );
  if ( rgn == nullptr )
  {
    ERROR_PRINT << "Error reading RESOURCE.DAT: Unable to find region " << regionname
                << " in resource " << elem.rest() << "\n";
    throw std::runtime_error( "Data file error" );
  }
  rgn->read_data( elem );
}
开发者ID:polserver,项目名称:polserver,代码行数:19,代码来源:resource.cpp

示例12: pkg

Attribute::Attribute( const Plib::Package* pkg, Clib::ConfigElem& elem ) :
  pkg( pkg ),
  name( elem.rest() ),
  attrid( 0 ),
  aliases(),
  next( NULL ),
  getintrinsicmod_func( nullptr ),
  delay_seconds( elem.remove_ushort( "DELAY", 0 ) ),
  unhides( elem.remove_bool( "UNHIDES", true ) ),
  disable_core_checks( elem.remove_bool( "DisableCoreChecks", false ) ),
  default_cap( elem.remove_ushort( "DefaultCap", Core::settingsManager.ssopt.default_attribute_cap ) ),
  script_( elem.remove_string( "SCRIPT", "" ), pkg, "scripts/skills/" )
{
  aliases.push_back( name );
  std::string tmp;
  while ( elem.remove_prop( "Alias", &tmp ) )
    aliases.push_back( tmp );

  if ( elem.remove_prop( "GetIntrinsicModFunction", &tmp ) )
  {
    getintrinsicmod_func = Core::FindExportedFunction( elem, pkg, tmp, 1 );
  }
}
开发者ID:gtozzi,项目名称:polserver,代码行数:23,代码来源:attribute.cpp

示例13: read_npc_templates

void read_npc_templates( Plib::Package* pkg )
{
  std::string filename = GetPackageCfgPath( pkg, "npcdesc.cfg" );
  if ( !Clib::FileExists( filename ) )
    return;

  Clib::ConfigFile cf( filename.c_str() );
  Clib::ConfigElem elem;
  while ( cf.read( elem ) )
  {
    if ( elem.type_is( "NpcTemplate" ) )
    {
      // first determine the NPC template name.
      std::string namebase;
      const char* rest = elem.rest();
      if ( rest != NULL && *rest != '\0' )
      {
        namebase = rest;
      }
      else
      {
        namebase = elem.remove_string( "TemplateName" );
      }
      std::string descname;
      if ( pkg != NULL )
      {
        descname = ":" + pkg->name() + ":" + namebase;
        elem.set_rest( descname.c_str() );
      }
      else
        descname = namebase;

      gamestate.npc_template_elems[descname] = NpcTemplateElem( cf, elem );
    }
  }
}
开发者ID:JohnnyB1971,项目名称:polserver,代码行数:36,代码来源:npctemplates.cpp

示例14: main

int UoToolMain::main()
{
  const std::vector<std::string> binArgs = programArgs();

  /**********************************************
   * show help
   **********************************************/
  if (binArgs.size() == 1)
  {
    showHelp();
    return 0; // return "okay"
  }

  /**********************************************
   * TODO: rework the following cruft from former uotool.cpp
   **********************************************/
  Clib::ConfigFile cf( "pol.cfg" );
  Clib::ConfigElem elem;

  cf.readraw( elem );

  Plib::systemstate.config.uo_datafile_root = elem.remove_string( "UoDataFileRoot" );
  Plib::systemstate.config.uo_datafile_root = Clib::normalized_dir_form( Plib::systemstate.config.uo_datafile_root );

  unsigned short max_tile = elem.remove_ushort( "MaxTileID", UOBJ_DEFAULT_MAX );

  if ( max_tile != UOBJ_DEFAULT_MAX && max_tile != UOBJ_SA_MAX && max_tile != UOBJ_HSA_MAX )
    Plib::systemstate.config.max_tile_id = UOBJ_DEFAULT_MAX;
  else
    Plib::systemstate.config.max_tile_id = max_tile;

  std::string argvalue = binArgs[1];
  if ( argvalue[0] == '/' || argvalue[0] == ':' )
  {
    Plib::systemstate.config.uo_datafile_root = argvalue;
    if (binArgs.size() < 3)
    {
      showHelp();
      return 0;
    }
    argvalue = binArgs[2];
  }

  std::transform(argvalue.begin(), argvalue.end(), argvalue.begin(), ::tolower);

  if ( argvalue == "tiledump" )
  {
    return UoTool::tiledump( s_argc, s_argv );
  }
  else if ( argvalue == "vertile" )
  {
    return UoTool::vertile();
  }
  else if ( argvalue == "verlandtile" )
  {
    return UoTool::verlandtile();
  }
  else if ( argvalue == "landtilehist" )
  {
    return UoTool::landtilehist();
  }
  else if ( argvalue == "flagsearch" )
  {
    return UoTool::flagsearch( s_argc, s_argv );
  }
  else if ( argvalue == "landtileflagsearch" )
  {
    return UoTool::landtileflagsearch( s_argc, s_argv );
  }
  else if ( argvalue == "loschange" )
  {
    return UoTool::loschange( s_argc, s_argv );
  }
  else if ( argvalue == "rawdump" )
  {
    return UoTool::rawdump( s_argc, s_argv );
  }
  else if ( argvalue == "ctable" )
  {
    return UoTool::print_ctable();
  }
  else if ( argvalue == "sndlist" )
  {
    return UoTool::print_sndlist();
  }
  else if ( argvalue == "statics" )
  {
    return UoTool::print_statics();
  }
  else if ( argvalue == "verdata" )
  {
    return UoTool::print_verdata_info();
  }
  else if ( argvalue == "multis" )
  {
    return UoTool::print_multis();
  }
  else if ( argvalue == "water" )
  {
    return UoTool::print_water_data();
//.........这里部分代码省略.........
开发者ID:gtozzi,项目名称:polserver,代码行数:101,代码来源:UoToolMain.cpp

示例15: FindNpcTemplate

// FIXME inefficient.  Templates should be read in once, and reused.
bool FindNpcTemplate( const char* template_name, Clib::ConfigFile& cf, Clib::ConfigElem& elem )
{
  try
  {
    const Plib::Package* pkg;
    std::string npctemplate;
    if ( !Plib::pkgdef_split( template_name, NULL, &pkg, &npctemplate ) )
      return false;

    std::string filename =
        Plib::GetPackageCfgPath( const_cast<Plib::Package*>( pkg ), "npcdesc.cfg" );

    cf.open( filename.c_str() );
    while ( cf.read( elem ) )
    {
      if ( !elem.type_is( "NpcTemplate" ) )
        continue;

      std::string orig_rest = elem.rest();
      if ( pkg != NULL )
      {
        std::string newrest = ":" + pkg->name() + ":" + npctemplate;
        elem.set_rest( newrest.c_str() );
      }
      const char* rest = elem.rest();
      if ( rest != NULL && *rest != '\0' )
      {
        if ( stricmp( orig_rest.c_str(), npctemplate.c_str() ) == 0 )
          return true;
      }
      else
      {
        std::string tname = elem.remove_string( "TemplateName" );
        if ( stricmp( tname.c_str(), npctemplate.c_str() ) == 0 )
          return true;
      }
    }
    return false;
  }
  catch ( const char* msg )
  {
    ERROR_PRINT << "NPC Creation (" << template_name << ") Failed: " << msg << "\n";
  }
  catch ( std::string& str )
  {
    ERROR_PRINT << "NPC Creation (" << template_name << ") Failed: " << str << "\n";
  }                                 // egcs has some trouble realizing 'exception' should catch
  catch ( std::runtime_error& re )  // runtime_errors, so...
  {
    ERROR_PRINT << "NPC Creation (" << template_name << ") Failed: " << re.what() << "\n";
  }
  catch ( std::exception& ex )
  {
    ERROR_PRINT << "NPC Creation (" << template_name << ") Failed: " << ex.what() << "\n";
  }
#ifndef WIN32
  catch ( ... )
  {
  }
#endif
  return false;
}
开发者ID:JohnnyB1971,项目名称:polserver,代码行数:63,代码来源:npctemplates.cpp


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