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


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

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


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

示例1: GlxVisual

Visual *
createVisual(bool doubleBuffer, unsigned samples, Profile profile) {
    GlxVisual *visual = new GlxVisual(profile);

    if (glxVersion >= 0x0103) {
        Attributes<int> attribs;
        attribs.add(GLX_DRAWABLE_TYPE, GLX_WINDOW_BIT);
        attribs.add(GLX_RENDER_TYPE, GLX_RGBA_BIT);
        attribs.add(GLX_RED_SIZE, 1);
        attribs.add(GLX_GREEN_SIZE, 1);
        attribs.add(GLX_BLUE_SIZE, 1);
        attribs.add(GLX_ALPHA_SIZE, 1);
        attribs.add(GLX_DOUBLEBUFFER, doubleBuffer ? GL_TRUE : GL_FALSE);
        attribs.add(GLX_DEPTH_SIZE, 1);
        attribs.add(GLX_STENCIL_SIZE, 1);
        if (samples > 1) {
            attribs.add(GLX_SAMPLE_BUFFERS, 1);
            attribs.add(GLX_SAMPLES_ARB, samples);
        }
        attribs.end();

        int num_configs = 0;
        GLXFBConfig * fbconfigs;
        fbconfigs = glXChooseFBConfig(display, screen, attribs, &num_configs);
        if (!num_configs || !fbconfigs) {
            return NULL;
        }
        visual->fbconfig = fbconfigs[0];
        assert(visual->fbconfig);
        visual->visinfo = glXGetVisualFromFBConfig(display, visual->fbconfig);
        assert(visual->visinfo);
    } else {
        Attributes<int> attribs;
        attribs.add(GLX_RGBA);
        attribs.add(GLX_RED_SIZE, 1);
        attribs.add(GLX_GREEN_SIZE, 1);
        attribs.add(GLX_BLUE_SIZE, 1);
        attribs.add(GLX_ALPHA_SIZE, 1);
        if (doubleBuffer) {
            attribs.add(GLX_DOUBLEBUFFER);
        }
        attribs.add(GLX_DEPTH_SIZE, 1);
        attribs.add(GLX_STENCIL_SIZE, 1);
        if (samples > 1) {
            attribs.add(GLX_SAMPLE_BUFFERS, 1);
            attribs.add(GLX_SAMPLES_ARB, samples);
        }
        attribs.end();

        visual->visinfo = glXChooseVisual(display, screen, attribs);
    }

    return visual;
}
开发者ID:SunnyBeike,项目名称:apitrace,代码行数:54,代码来源:glws_glx.cpp

示例2: GlxContext

Context *
createContext(const Visual *_visual, Context *shareContext, Profile profile)
{
    const GlxVisual *visual = static_cast<const GlxVisual *>(_visual);
    GLXContext share_context = NULL;
    GLXContext context;

    if (profile != PROFILE_COMPAT) {
        return NULL;
    }

    if (shareContext) {
        share_context = static_cast<GlxContext*>(shareContext)->context;
    }

    if (glxVersion >= 0x0104 && has_GLX_ARB_create_context) {
        Attributes<int> attribs;
        attribs.add(GLX_RENDER_TYPE, GLX_RGBA_TYPE);
        if (debug) {
            attribs.add(GLX_CONTEXT_FLAGS_ARB, GLX_CONTEXT_DEBUG_BIT_ARB);
        }
        attribs.end();

        context = glXCreateContextAttribsARB(display, visual->fbconfig, share_context, True, attribs);
    } else 
           if (glxVersion >= 0x103) {
        context = glXCreateNewContext(display, visual->fbconfig, GLX_RGBA_TYPE, share_context, True);
    } else {
        context = glXCreateContext(display, visual->visinfo, share_context, True);
    }

    return new GlxContext(visual, profile, context);
}
开发者ID:prahal,项目名称:apitrace,代码行数:33,代码来源:glws_glx.cpp

示例3: runtime_error

SAXParser::Handler::Status HandlerPeak::startElement(const string& name, 
                                const Attributes& attributes,
                                stream_offset position)
{
    if (!peak)
        throw runtime_error("[PeakData::HandlerPeak::startElement()]  Null peak.");

    if (name == "peak")
    {
        for (Attributes::attribute_list::const_iterator it=attributes.begin(); it!=attributes.end(); ++it)
        {
            if (it->matchName("id")) peak->id = lexical_cast<int>(it->getValue());
            else if (it->matchName("mz")) peak->mz = lexical_cast<double>(it->getValue(NoXMLUnescape)); 
            else if (it->matchName("retentionTime")) peak->retentionTime = lexical_cast<double>(it->getValue(NoXMLUnescape));
            else if (it->matchName("intensity")) peak->intensity = lexical_cast<double>(it->getValue(NoXMLUnescape));
            else if (it->matchName("area")) peak->area = lexical_cast<double>(it->getValue(NoXMLUnescape));
            else if (it->matchName("error")) peak->error = lexical_cast<double>(it->getValue(NoXMLUnescape));
            else
            {
                Peak::Attribute a = stringToAttribute(it->getName());
                peak->attributes[a] = lexical_cast<double>(it->getValue(NoXMLUnescape)); 
            }
        }

        return Status::Ok;
    }
    else if (name == "data")
    {
        return Status::Ok;
    }

    throw runtime_error(("[HandlerPeak] Unexpected element name: " + name).c_str());
}
开发者ID:AlexandreBurel,项目名称:pwiz-mzdb,代码行数:33,代码来源:PeakData.cpp

示例4: return

std::list<std::string>*  	Node::attributesNames(attributeNameType tname)
{
  std::list<std::string>*	result;
  Attributes*			attr;
  Attributes::iterator		attrit;

  attr = NULL;
  result = NULL;
  if ((result = new std::list<std::string>) != NULL)
    {
      if ((attr = this->attributes()) != NULL)
	{
	  for (attrit = attr->begin(); attrit != attr->end(); attrit++)
	    {
	      result->push_back(attrit->first);
	      if (tname == ABSOLUTE_ATTR_NAME)
		this->attributesNamesFromVariant(attrit->second, result, attrit->first);
	      else
		this->attributesNamesFromVariant(attrit->second, result);
	      delete attrit->second;
	    }
	  delete attr;
	}
    }
  return (result);
}
开发者ID:halbbob,项目名称:dff,代码行数:26,代码来源:node.cpp

示例5: loadUnlawfulInfo

bool ManageConfig::loadUnlawfulInfo(Element * root_element)
{
	if (NULL == root_element)
	{
		std::cout << ("The root element is NULL\n");
		return false;
	}
	Element * unlawfulWord_ele = root_element->get_element("unlawfulWord");
	if (NULL == unlawfulWord_ele)
	{
		std::cout << ("Failed to get sql element\n");
		return false;
	}
	Attributes attrs = unlawfulWord_ele->get_attributes();
	for (Attributes::iterator it = attrs.begin(); it != attrs.end(); ++it)
	{
		Attribute * attr = *it;
		if (attr->get_name() == "file")
		{
			m_unlawful_file = attr->as_cstr();
		}
	}

	return true;
}
开发者ID:BianJian,项目名称:steppingstone,代码行数:25,代码来源:ManageConfig.cpp

示例6: while

void		Node::__compatibleModulesByType(const std::map<std::string, Constant*>& cmime, Attributes& dtypes, std::list<std::string>* result)
{
  std::map<std::string, Constant*>::const_iterator	cit;
  list<Variant*>					lvalues;
  list<Variant*>::iterator				lit;
  Attributes::iterator					dit;
  bool							match;

  for (cit = cmime.begin(); cit != cmime.end(); cit++)
    {
      match = false;
      if ((cit->second != NULL) && (cit->second->type() == typeId::String))
  	{
  	  lvalues = cit->second->values();
	  lit = lvalues.begin();
  	  while (lit != lvalues.end() && !match)
  	    {
	      dit = dtypes.begin();
  	      while (dit != dtypes.end() && !match)
  		{
  		  std::string	cval = (*lit)->value<std::string>();
  		  if ((dit->second != NULL) && (dit->second->type() == typeId::String)
  		      && (dit->second->value<std::string>().find(cval) != std::string::npos))
  		    {
  		      match = true;
  		      result->push_back(cit->first);
  		    }
  		  dit++;
  		}
  	      lit++;
  	    }
  	}
    }
}
开发者ID:halbbob,项目名称:dff,代码行数:34,代码来源:node.cpp

示例7: findAttribute

AttributeIterator findAttribute(Attributes& attributes, const std::string& name) {
	CAF_CM_STATIC_FUNC_VALIDATE("MarkupParser", "findAttribute");
	CAF_CM_VALIDATE_STRING(name);
	return std::find_if(attributes.begin(),
						attributes.end(),
						std::bind2nd(AttributeName(), name));
}
开发者ID:bzed,项目名称:pkg-open-vm-tools,代码行数:7,代码来源:CMarkupParser.cpp

示例8: 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

示例9:

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

示例10: loadCacheConfig

bool ManageConfig::loadCacheConfig(Element * root_element)
{
	if (NULL == root_element)
	{
		std::cout << ("The root element is NULL\n");
		return false;
	}

	Element * cache_ele = root_element->get_element("hash-cache");
	if (NULL == cache_ele)
	{
		std::cout << ("Failed to get hash-cache element\n");
		return false;
	}

	Elements cache_list = cache_ele->get_elements();

	for (Elements::iterator cache_it = cache_list.begin(); cache_it != cache_list.end(); ++cache_it)
	{
		CacheConfig cache_cfg;
		Attributes attrs = (*cache_it)->get_attributes();
		for (Attributes::iterator it = attrs.begin(); it != attrs.end(); ++it)
		{
			Attribute * attr = *it;
			if (attr->get_name() == "ip")
			{
				cache_cfg.ip = attr->as_cstr();
			}
		}
		m_cache_cfg.push_back(cache_cfg);
	}
	return true;
}
开发者ID:BianJian,项目名称:steppingstone,代码行数:33,代码来源:ManageConfig.cpp

示例11: loadLogsysInfo

bool ManageConfig::loadLogsysInfo(Element * root_element)
{
	if (NULL == root_element)
	{
		std::cout << ("The root element is NULL\n");
		return false;
	}

	Element * logsys_ele = root_element->get_element("logsys");
	if (NULL == logsys_ele)
	{
		std::cout << ("Failed to get hash-cache element\n");
		return false;
	}

	Attributes attrs = logsys_ele->get_attributes();
	for (Attributes::iterator it = attrs.begin(); it != attrs.end(); ++it)
	{
		Attribute * attr = *it;
		if (attr->get_name() == "ip")
		{
			m_logsys_cfg.ip = attr->as_cstr();
		}
		else if (attr->get_name() == "port")
		{
			m_logsys_cfg.port = attr->as_cstr();
		}
	}
	return true;
}
开发者ID:BianJian,项目名称:steppingstone,代码行数:30,代码来源:ManageConfig.cpp

示例12: if

void	Node::attributesNamesFromVariant(Variant* variant, std::list<std::string > *names, std::string current)
{
  if (!(variant))
    return ;
  if (variant->type() == typeId::List)
    {
      std::list<Variant*> lvariant = variant->value<std::list< Variant*> >();
      std::list<Variant*>::iterator it = lvariant.begin();
      for (; it != lvariant.end(); it++)
	this->attributesNamesFromVariant((*it), names, current);
    }
  else if (variant->type() == typeId::Map)
    {
      Attributes mvariant = variant->value<Attributes >();
      Attributes::iterator it = mvariant.begin();
      std::string	abs;
      for (; it != mvariant.end(); it++)
	{
	  if (current.empty())
	    abs = it->first;
	  else
	    abs = current + '.' + it->first;
	  names->push_back(abs);
	  this->attributesNamesFromVariant(it->second, names, abs);
	}
    }
}
开发者ID:halbbob,项目名称:dff,代码行数:27,代码来源:node.cpp

示例13: loadGUIDAddr

bool ManageConfig::loadGUIDAddr(Element * root_element)
{
	if (NULL == root_element)
	{
		std::cout << ("The root element is NULL\n");
		return false;
	}
	Element * guid_ele = root_element->get_element("guid");
	if (NULL == guid_ele)
	{
		std::cout << ("Failed to get sql element\n");
		return false;
	}
	Attributes attrs = guid_ele->get_attributes();
	for (Attributes::iterator it = attrs.begin(); it != attrs.end(); ++it)
	{
		Attribute * attr = *it;
		if (attr->get_name() == "addr")
		{
			m_guid_addr = attr->as_cstr();
		}
	}

	return true;
}
开发者ID:BianJian,项目名称:steppingstone,代码行数:25,代码来源:ManageConfig.cpp

示例14: Show_attributes

/**
 * Function: Show_attributes
 *
 * Display both the key and value for an Attributes map.
 *
 * Since this is a non-critical message, it is only shown when the debug value
 * is set high enough.
 *
 * Parameter: attributes Defined as std::map<std::string, std::string> pair.
 *            Most commonly found in data as a "name = value" pair.
 */
void Show_attributes(std::ostream& os, Attributes& attributes)
{
	Monday_out(VERBOSE_LEVEL2, os, "- Num attributes: %d\n", attributes.size());
	for(Attributes::iterator i = attributes.begin(); i != attributes.end(); ++i)
	{
		Monday_out(VERBOSE_LEVEL2, os, "  \"%s\" = \"%s\"\n", i->first.c_str(), i->second.c_str());
	}
}
开发者ID:bambams,项目名称:Monday,代码行数:19,代码来源:Debug.cpp

示例15: istr

void AttributesParserTest::testParser1()
{
	Attributes attrs;
	std::istringstream istr("");
	AttributesParser parser(attrs, istr);
	parser.parse();
	assert (attrs.begin() == attrs.end());
}
开发者ID:JoneXie,项目名称:macchina.io,代码行数:8,代码来源:AttributesParserTest.cpp


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