本文整理汇总了C++中clib::ConfigElem::has_prop方法的典型用法代码示例。如果您正苦于以下问题:C++ ConfigElem::has_prop方法的具体用法?C++ ConfigElem::has_prop怎么用?C++ ConfigElem::has_prop使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类clib::ConfigElem
的用法示例。
在下文中一共展示了ConfigElem::has_prop方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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 );
}
示例2: pkg
NpcTemplate::NpcTemplate( const Clib::ConfigElem& elem, const Plib::Package* pkg ) :
intrinsic_weapon( Items::find_intrinsic_weapon( elem.rest() ) ),
pkg( pkg ),
// script( elem.read_string( "SCRIPT" ) ),
alignment( static_cast<ALIGNMENT>( translate( elem.read_string( "ALIGNMENT", "neutral" ), xlate_align ) ) ),
method_script( NULL )
{
if ( pkg == NULL )
{
name = elem.rest();
}
else
{
if ( elem.rest()[0] == ':' )
{
name = elem.rest();
}
else
{
name = ":" + pkg->name() + ":" + elem.rest();
}
}
if ( elem.has_prop( "MethodScript" ) )
{
std::string temp = elem.read_string( "MethodScript" );
if ( !temp.empty() )
{
ExportScript* shs = new ExportScript( pkg, temp );
if ( shs->Initialize() )
method_script = shs;
else
delete shs;
}
}
}