本文整理汇总了C++中VariantMap类的典型用法代码示例。如果您正苦于以下问题:C++ VariantMap类的具体用法?C++ VariantMap怎么用?C++ VariantMap使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了VariantMap类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: setupUI
void PushButton::setupUI(const VariantMap &ui)
{
Widget::setupUI( ui );
__D_REF(_d,PushButton)
Variant tmp;
tmp = ui.get( "bgtype" );
if( tmp.isValid() )
{
BackgroundStyleHelper helper;
setBackgroundStyle( helper.findType( tmp.toString() ) );
}
setIsPushButton( (bool)ui.get( "pushbutton" ) );
_d.text.offset = ui.get( "textOffset" );
_d.text.offset = ui.get( "text.offset", _d.text.offset );
setEnabled( (bool)ui.get( "enabled", true ) );
Variant vFont = ui.get( "font" );
if( vFont.isValid() ) { setFont( Font::create( vFont.toString() ) ); }
VariantList vlist = ui.get( "normal" ).toList();
if( !vlist.empty() ) setPicture( vlist.get( 0 ).toString(), vlist.get( 1 ).toInt(), stNormal );
vlist = ui.get( "hovered" ).toList();
if( !vlist.empty() ) setPicture( vlist.get( 0 ).toString(), vlist.get( 1 ).toInt(), stHovered );
vlist = ui.get( "pressed" ).toList();
if( !vlist.empty() ) setPicture( vlist.get( 0 ).toString(), vlist.get( 1 ).toInt(), stPressed );
vlist = ui.get( "disabled" ).toList();
if( !vlist.empty() ) setPicture( vlist.get( 0 ).toString(), vlist.get( 1 ).toInt(), stDisabled );
}
开发者ID:dalerank,项目名称:caesaria-game,代码行数:34,代码来源:pushbutton.cpp
示例2: load
void Factory::load( const VariantMap& stream)
{
WorkingBuilding::load( stream );
_d->goodStore.load( stream.get( "goodStore" ).toMap() );
_d->progress = (float)stream.get( "progress" ); // approximation
_d->productionRate = (float)stream.get( "productionRate" );
}
开发者ID:coniu,项目名称:opencaesar3,代码行数:7,代码来源:oc3_building_factory.cpp
示例3: onWrite
static size_t onWrite(char *ptr, size_t size, size_t nmemb, void *userdata)
{
WebRequestInternalState *is_(reinterpret_cast<WebRequestInternalState*>(userdata));
is_->state = HTTP_OPEN;
if (is_->isAborted)
{
is_->state = HTTP_CLOSED;
// This should probably be CURL_WRITEFUNC_ABORT, but that doesn't
// exist. It probably would be the same numeric value, if it did.
// The docs say that it just has to be a number of bytes that is
// not "size * nmemb" to abort.
return CURL_READFUNC_ABORT;
}
// Find the size in bytes.
size_t real_size(size * nmemb);
// Write the date into the download buffer queue.
Serializer* download(dynamic_cast<Serializer*>(is_->download.Get()));
download->Write(ptr, (unsigned int)real_size);
// Emit a "download_chunk" event.
VariantMap eventData;
eventData.Insert(MakePair(StringHash("download"), Variant(is_->download)));
eventData.Insert(MakePair(StringHash("size"), Variant((unsigned int)real_size)));
is_->es.SendEvent("download_chunk", eventData);
return real_size;
}
开发者ID:AliAkbarMontazeri,项目名称:AtomicGameEngine,代码行数:29,代码来源:WebRequest.cpp
示例4: load
bool OMap::load(const std::string& filename, Game& game)
{
_d->restartFile = filename;
VariantMap vm;
if( vfs::Path( filename ).isMyExtension( ".zmap" ) )
{
Logger::error( "OMap not loading citymap from zip" );
return false;
}
else
{
vm = config::load( filename );
}
_d->climate = vm.get( "climate" ).toInt();
_d->loadCity( vm, game.city() );
_d->initCameraStartPos(vm, game.city() );
game.city()->setOption( PlayerCity::adviserEnabled, 1 );
game.empire()->setCitiesAvailable( true );
return true;
}
开发者ID:dalerank,项目名称:caesaria-game,代码行数:25,代码来源:loader_omap.cpp
示例5: windowSize
void StartMenu::Impl::showLanguageOptions()
{
Widget* parent = game->gui()->rootWidget();
Size windowSize( 512, 384 );
Label* frame = new Label( parent, Rect( Point(), windowSize ), "", false, gui::Label::bgWhiteFrame );
ListBox* lbx = new ListBox( frame, Rect( 0, 0, 1, 1 ), -1, true, true );
PushButton* btn = new PushButton( frame, Rect( 0, 0, 1, 1), _("##apply##") );
WidgetEscapeCloser::insertTo( frame );
frame->setCenter( parent->center() );
lbx->setFocus();
lbx->setGeometry( RectF( 0.05, 0.05, 0.95, 0.85 ) );
btn->setGeometry( RectF( 0.1, 0.88, 0.9, 0.95 ) );
VariantMap languages = config::load( SETTINGS_RC_PATH( langModel ) );
std::string currentLang = SETTINGS_VALUE( language ).toString();
int currentIndex = -1;
foreach( it, languages )
{
lbx->addItem( it->first );
std::string ext = it->second.toMap().get( literals::ext ).toString();
if( ext == currentLang )
currentIndex = std::distance( languages.begin(), it );
}
开发者ID:Ecordonnier,项目名称:caesaria-game,代码行数:25,代码来源:menu.cpp
示例6: climateType
int OMap::climateType(const std::string& filename)
{
VariantMap vm = config::load( filename );
_d->climate = vm.get( "climate" ).toInt();
return _d->climate;
}
开发者ID:dalerank,项目名称:caesaria-game,代码行数:7,代码来源:loader_omap.cpp
示例7: _exec
void ChangeEmpireOptions::_exec(Game& game, unsigned int)
{
VariantMap emOpts = _vars.get( literals::empire ).toMap();
VariantMap advOptions = _vars.get( literals::adviser ).toMap();
if( !emOpts.empty() )
{
world::EmpirePtr empire = game.empire();
unsigned int lastWorkerSalary = empire->workerSalary();
empire->load( emOpts );
if( empire->workerSalary() != lastWorkerSalary )
{
bool raiseSalary = empire->workerSalary() - lastWorkerSalary;
GameEventPtr e = ShowInfobox::create( "##rome##", raiseSalary ? "##rome_raises_wages##" : "##rome_lowers_wages##");
e->dispatch();
}
}
Variant adv_enabled = advOptions.get( literals::enabled );
if( adv_enabled.isValid() )
{
game.city()->setOption( PlayerCity::adviserEnabled, adv_enabled );
}
}
开发者ID:Ecordonnier,项目名称:caesaria-game,代码行数:28,代码来源:changeempireoptions.cpp
示例8: load
void ServiceBuilding::load( const VariantMap& stream )
{
WorkingBuilding::load( stream );
_d->serviceTimer = (int)stream.get( "timer" );
_d->serviceDelay = (int)stream.get( "delay" );
_d->serviceRange = (int)stream.get( "range" );
}
开发者ID:mjgsklea,项目名称:opencaesar3,代码行数:7,代码来源:oc3_building_service.cpp
示例9: sendStartupArguments
virtual void sendStartupArguments(pid_t pid, FileDescriptor &fd) {
VariantMap options = agentsOptions;
options.set("logging_agent_address", wo->loggingAgentAddress);
options.set("logging_agent_password", wo->loggingAgentPassword);
options.set("logging_agent_admin_address", wo->loggingAgentAdminAddress);
options.writeToFd(fd);
}
开发者ID:GeoffWilliams,项目名称:passenger,代码行数:7,代码来源:LoggingAgentWatcher.cpp
示例10: load
void RandomFire::load(const VariantMap& stream)
{
VariantList vl = stream.get( lc_population ).toList();
_d->minPopulation = vl.get( 0, 0 ).toInt();
_d->maxPopulation = vl.get( 1, 999999 ).toInt();
_d->strong = stream.get( lc_strong, 10 );
}
开发者ID:KSLcom,项目名称:caesaria-game,代码行数:7,代码来源:random_fire.cpp
示例11: load
void LandOverlay::load( const VariantMap& stream )
{
_name = stream.get( "name" ).toString();
_d->buildingType = (BuildingType)stream.get( "buildingType" ).toInt();
_picture = &Picture::load( stream.get( "picture" ).toString() + ".png" );
_size = stream.get( "size" ).toInt();
_isDeleted = stream.get( "isDeleted" ).toBool();
}
开发者ID:LMG,项目名称:opencaesar3,代码行数:8,代码来源:oc3_building.cpp
示例12: sendStartupArguments
virtual void sendStartupArguments(pid_t pid, FileDescriptor &fd) {
VariantMap options = agentsOptions;
options.set("request_socket_password", Base64::encode(requestSocketPassword)).
set("message_socket_password", Base64::encode(messageSocketPassword)).
set("logging_agent_address", loggingAgentAddress).
set("logging_agent_password", loggingAgentPassword);
options.writeToFd(fd);
}
开发者ID:henare,项目名称:passenger,代码行数:8,代码来源:Watchdog.cpp
示例13: load
void Peace::load(const VariantMap& stream)
{
VARIANT_LOAD_ANY_D( _d, peaceYears, stream )
VARIANT_LOAD_ANY_D( _d, someCriminalSeen, stream )
_d->protestorOrMugglerSeen = stream.get( lc_protestorOrMugglerSeen );
_d->rioterSeen = stream.get( lc_rioterSeen );
_d->value = stream.get( lc_value );
_d->significantBuildingsDestroyed = stream.get( lc_significantBuildingsDestroyed );
}
开发者ID:mdl8bit,项目名称:caesaria-game,代码行数:9,代码来源:cityservice_peace.cpp
示例14: installAbortHandler
static void
installAbortHandler() {
VariantMap options;
options.set("passenger_root", resourceLocator->getRoot());
initializeAgentOptions("CxxTestMain", options);
installAgentAbortHandler();
}
开发者ID:1234-,项目名称:passenger,代码行数:9,代码来源:CxxTestMain.cpp
示例15: reportAgentsInformation
virtual void reportAgentsInformation(VariantMap &report) {
const VariantMap &options = *agentsOptions;
report.set("ust_router_address", options.get("ust_router_address"));
report.set("ust_router_password", options.get("ust_router_password"));
// For backward compatibilty:
report.set("logging_agent_address", options.get("ust_router_address"));
report.set("logging_agent_password", options.get("ust_router_password"));
}
开发者ID:1234-,项目名称:passenger,代码行数:9,代码来源:UstRouterWatcher.cpp
示例16: set
void set( Senate::Status status, const VariantMap& stream )
{
if( stream.empty() )
return;
Picture pic( stream.get( "rc"), stream.get( "index") );
Point offset = stream.get( "offset" );
set( status, pic, offset );
}
开发者ID:dalerank,项目名称:caesaria-game,代码行数:9,代码来源:senate.cpp
示例17: load
void Dispatcher::load( const vfs::Path& filename, const std::string& section)
{
VariantMap vm = config::load( filename );
if( !section.empty() )
vm = vm.get( section ).toMap();
load( vm );
}
开发者ID:dalerank,项目名称:caesaria-game,代码行数:9,代码来源:dispatcher.cpp
示例18: load
void ShowAdvisorWindow::load(const VariantMap &stream)
{
GameEvent::load( stream );
_show = stream.get( "show" );
Variant adv = stream.get( "advisor" );
if( adv.type() == Variant::String ) { _advisor = advisor::fromString( adv.toString() ); }
else { _advisor = (advisor::Type)adv.toInt(); }
}
开发者ID:andrelago13,项目名称:caesaria-game,代码行数:9,代码来源:showadvisorwindow.cpp
示例19: load
void TileOverlay::load( const VariantMap& stream )
{
_d->name = stream.get( "name" ).toString();
_d->size = stream.get( "size", Size(1) ).toSize();
//_d->overlayType = (LandOverlayType)stream.get( "overlayType" ).toInt();
_d->picture = Picture::load( stream.get( "picture" ).toString() + ".png" );
_d->picture.setOffset( stream.get( "pictureOffset" ).toPoint() );
_d->isDeleted = stream.get( "isDeleted", false ).toBool();
}
开发者ID:BlackFoks,项目名称:opencaesar3,代码行数:9,代码来源:tileoverlay.cpp
示例20: reportAgentsInformation
virtual void reportAgentsInformation(VariantMap &report) {
const VariantMap &options = *agentsOptions;
vector<string> addresses = options.getStrSet("core_addresses");
report.set("core_address", addresses.front());
report.set("core_password", options.get("core_password"));
// For backwards compatibility:
report.set("server_address", addresses.front());
report.set("server_password", options.get("core_password"));
}
开发者ID:shiduanguang,项目名称:passenger,代码行数:10,代码来源:CoreWatcher.cpp
注:本文中的VariantMap类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论