本文整理汇总了C++中PropertyMap::SetProperty方法的典型用法代码示例。如果您正苦于以下问题:C++ PropertyMap::SetProperty方法的具体用法?C++ PropertyMap::SetProperty怎么用?C++ PropertyMap::SetProperty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PropertyMap
的用法示例。
在下文中一共展示了PropertyMap::SetProperty方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main ()
{
printf ("Results of user_test:\n");
try
{
User user;
printf ("default user\n");
dump (user);
user.SetId ("Id1");
user.SetNickname ("Nickname");
user.SetFriend (true);
user.SetHandle ((const void*)1);
PropertyMap properties;
properties.SetProperty ("String", "StringValue");
properties.SetProperty ("IntValue", 10);
user.SetProperties (properties);
printf ("filled user\n");
dump (user);
}
catch (std::exception& exception)
{
printf ("exception: %s\n", exception.what ());
}
return 0;
}
示例2: main
int main ()
{
printf ("Results of parse_resolve3_test:\n");
try
{
Parser parser (file_name);
PropertyMap properties;
properties.SetProperty ("A.D", "Hello");
printf ("Parse successfull\n");
ParseNode root = resolve_references (parser.Root (), properties);
print (root, 0);
parser.Log ().Print (&print_log);
}
catch (std::exception& e)
{
printf ("exception: %s\n", e.what ());
}
return 0;
}
示例3: update_entity_frame_transformations
void update_entity_frame_transformations (Frame& frame, Entity& entity, void* user_data, EntityDrawParams& out_params)
{
PropertyMap properties = out_params.properties;
math::mat4f model_view_tm = frame.Properties ().GetMatrix ("myViewMatrix") * entity.WorldMatrix ();
out_params.mvp_matrix = frame.Properties ().GetMatrix ("myProjMatrix") * model_view_tm;
properties.SetProperty ("myObjectMatrix", entity.WorldMatrix ());
}
示例4: main
int main ()
{
printf ("Results of transaction_test:\n");
try
{
Transaction transaction;
printf ("default transaction\n");
dump (transaction);
transaction.SetState (TransactionState_Purchased);
transaction.SetStatus ("Success");
transaction.SetProductId ("ProductId");
transaction.SetQuantity (4);
transaction.SetReceipt (xtl::xstrlen (RECEIPT), RECEIPT);
transaction.SetHandle ((const void*)1);
PropertyMap properties;
properties.SetProperty ("String", "StringValue");
properties.SetProperty ("IntValue", 10);
transaction.SetProperties (properties);
printf ("filled transaction\n");
dump (transaction);
transaction.Finish ();
}
catch (std::exception& exception)
{
printf ("exception: %s\n", exception.what ());
}
return 0;
}
示例5: node_decl
NodeDeclPtr XmlSceneParser::Impl::PrepareNode (const ParseNode& decl)
{
try
{
//попытка найти параметры в кеше
if (NodeDeclPtr* node_decl_ptr = cache.FindValue<NodeDeclPtr> (decl))
return *node_decl_ptr;
NodeDeclPtr node_decl (new NodeDecl, false);
//парсинг базовых свойств
node_decl->name = get<const char*> (decl, "id", "");
//парсинг точки поворота
if (decl.First ("pivot"))
{
stl::auto_ptr<NodeDecl::Pivot> pivot (new NodeDecl::Pivot);
ParseAttribute (decl, "pivot", pivot->position);
pivot->has_orientation_pivot = strcmp (get<const char*> (decl, "orientation_pivot", "true"), "true") == 0;
pivot->has_scale_pivot = strcmp (get<const char*> (decl, "scale_pivot", "true"), "true") == 0;
node_decl->pivot = pivot;
}
//парсинг трансформаций
node_decl->is_world_transform = strcmp (get<const char*> (decl, "bind_space", "local"), "world") == 0;
if (ParseNode tm_node = decl.First ("transform"))
{
math::mat4f tm;
ParseAttribute (tm_node, "", tm);
affine_decompose (tm, node_decl->position, node_decl->orientation, node_decl->scale);
}
else
{
ParseAttribute (decl, "position", node_decl->position);
ParseAttribute (decl, "scale", node_decl->scale);
if (ParseNode rotation_node = decl.First ("rotation"))
{
float rotation [3] = {0.0f, 0.0f, 0.0f};
ParseAttribute (rotation_node, "", 3, &rotation [0]);
node_decl->orientation = to_quat (degree (rotation [0]), degree (rotation [1]), degree (rotation [2]));
}
else
{
ParseAttribute (decl, "orientation", node_decl->orientation);
}
}
node_decl->orientation_inherit = strcmp (get<const char*> (decl, "orientation_inherit", "true"), "true") == 0;
node_decl->scale_inherit = strcmp (get<const char*> (decl, "scale_inherit", "true"), "true") == 0;
//парсинг пользовательских свойств
PropertyMap* properties = 0;
if (decl.First ("property"))
node_decl->properties.reset (properties = new PropertyMap);
for (Parser::NamesakeIterator iter = decl.First ("property"); iter; ++iter)
{
ParseNode property_decl = *iter;
const char* name = get<const char*> (property_decl, "name");
PropertyType type = get_property_type (property_decl.First ("type"));
size_t property_index = properties->AddProperty (name, type, 1);
stl::string value = get<const char*> (property_decl, "value");
properties->SetProperty (property_index, value.c_str ());
}
//парсинг after node
if (ParseNode before_node_decl = decl.First ("before_node"))
{
node_decl->before_node.reset (new stl::string);
*node_decl->before_node = get<const char*> (before_node_decl, "");
}
//парсинг привязки к родителю
if (ParseNode parent_name_decl = decl.First ("parent"))
{
node_decl->parent_name.reset (new stl::string);
*node_decl->parent_name = get<const char*> (parent_name_decl, "");
//.........这里部分代码省略.........