本文整理汇总了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;
}
示例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);
}
示例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());
}
示例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);
}
示例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;
}
示例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++;
}
}
}
}
示例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));
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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);
}
}
}
示例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;
}
示例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());
}
}
示例15: istr
void AttributesParserTest::testParser1()
{
Attributes attrs;
std::istringstream istr("");
AttributesParser parser(attrs, istr);
parser.parse();
assert (attrs.begin() == attrs.end());
}