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


C++ Attributes::insert方法代码示例

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


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

示例1:

Attributes*			Node::attributes()
{
  Attributes* attr;
  std::set<AttributesHandler*>::iterator handler;
  Variant*	vptr = NULL;
  Attributes	nodeAttributes;


  attr = NULL;
  if ((attr = new std::map<std::string, Variant*>) != NULL)
    {
      if ((vptr = this->dataType()) != NULL)
        attr->insert(std::pair<std::string, Variant*>(std::string("type"), vptr));

      if (this->__fsobj != NULL)
	{
	  nodeAttributes = this->_attributes();
	  if (!nodeAttributes.empty())
	    {
	      if ((vptr = new Variant(nodeAttributes)) != NULL)
	       	attr->insert(std::pair<std::string, Variant*>(this->__fsobj->name, vptr));
	    }
	}
      for (handler = this->__attributesHandlers.begin(); handler != this->__attributesHandlers.end(); handler++)
        {
          if ((vptr = new Variant((*handler)->attributes(this))) != NULL)
      	    attr->insert(std::pair<std::string, Variant*>((*handler)->name(), vptr));
        }
    }
  return attr;
}
开发者ID:halbbob,项目名称:dff,代码行数:31,代码来源:node.cpp

示例2: Variant

Attributes*			Node::attributesByType(uint8_t type, attributeNameType tname)
{
  Attributes*			attr;
  Attributes*			result;
  Attributes::iterator		attrit;
  Variant*			vptr;
  
  result = NULL;
  attr = NULL;
  if ((result = new Attributes) != NULL)
    {
      if ((attr = this->attributes()) != NULL)
	{
	  for (attrit = attr->begin(); attrit != attr->end(); attrit++)
	    {
	      vptr = new Variant(attrit->second);
	      result->insert(std::pair<std::string, Variant*>(attrit->first, vptr));
	      if (tname == ABSOLUTE_ATTR_NAME)
		this->attributesByTypeFromVariant(attrit->second, type, result, attrit->first);
	      else
		this->attributesByTypeFromVariant(attrit->second, type, result);
	      delete attrit->second;
	    }
	  delete attr;
	}
    }
  return result;
}
开发者ID:halbbob,项目名称:dff,代码行数:28,代码来源:node.cpp

示例3: parseAttributes

   // parses tag attributes
   bool Parser::parseAttributes(Attributes& attr)
   {
      while(true)
      {
         ++mTokenizer;
         Token token1 = *mTokenizer;

         if (token1.isLiteral())
         {
            mTokenizer.putBack();
            return false;
         }

         // guru: get value name here
         std::string name = token1.getGeneric();

         ++mTokenizer;
         if (*mTokenizer != '=')
         {
            throw CPPDOM_ERROR(xml_attr_equal_expected, "");
         }

         ++mTokenizer;
         Token token2 = *mTokenizer;

         if (token2.isLiteral())
         {
            throw CPPDOM_ERROR(xml_attr_value_expected, "");
         }

         // remove "" from attribute value
         std::string value(token2.getGeneric());
         value.erase(0, 1);
         value.erase(value.length()-1, 1);

         // Clean up any escaping in value
         if(textContainsXmlEscaping(value))
         {  value = removeXmlEscaping(value, false); }

         // insert attribute into the map
         // guru: we got the name already
         Attributes::value_type attrpair(name, value);
         attr.insert(attrpair);
      }
      return true;
   }
开发者ID:godbyk,项目名称:cppdom,代码行数:47,代码来源:xmlparser.cpp

示例4: save

void Settings::save() {
	Attributes attr;
	attr.insert(std::pair<std::string,std::string>("username",username));
	attr.insert(std::pair<std::string,std::string>("chat_font",chat_font));
	attr.insert(std::pair<std::string,std::string>("menu_font",menu_font));
	attr.insert(std::pair<std::string,std::string>("server_address",serverAddress));
	attr.insert(std::make_pair("fpslimit",Tools::toString(fpsLimit)));
	
	attr.insert(std::pair<std::string,std::string>("Player_Red",Tools::toString((int)playerColor.r)));
	attr.insert(std::pair<std::string,std::string>("Player_Green",Tools::toString((int)playerColor.g)));
	attr.insert(std::pair<std::string,std::string>("Player_Blue",Tools::toString((int)playerColor.b)));

	std::fstream file;
	file.open("Settings.ini",std::ios_base::out);

	file << Tools::packAttributes(attr);

	file.close();
}
开发者ID:masonh,项目名称:onlinednd,代码行数:19,代码来源:Settings.cpp


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