本文整理汇总了C++中Attributes::begin方法的典型用法代码示例。如果您正苦于以下问题:C++ Attributes::begin方法的具体用法?C++ Attributes::begin怎么用?C++ Attributes::begin使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Attributes
的用法示例。
在下文中一共展示了Attributes::begin方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
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;
}
示例2: 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;
}
示例3: 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;
}
示例4: 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;
}
示例5: 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);
}
}
}
示例6: 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);
}
示例7: 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;
}
示例8: 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;
}
示例9: 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());
}
示例10: 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));
}
示例11: 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++;
}
}
}
}
示例12: 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());
}
}
示例13: istr
void AttributesParserTest::testParser1()
{
Attributes attrs;
std::istringstream istr("");
AttributesParser parser(attrs, istr);
parser.parse();
assert (attrs.begin() == attrs.end());
}
示例14: startElement
virtual Status startElement(const string& name,
const Attributes& attributes,
stream_offset position)
{
os_ << "[0x" << hex << position << "] startElement: " << name;
for_each(attributes.begin(), attributes.end(), PrintAttribute(os_));
os_ << endl;
return Status::Ok;
};
示例15: writeAttributes
void Writer::writeAttributes(const Attributes& attributes)
{
XML::Attributes::const_iterator it = attributes.begin();
XML::Attributes::const_iterator end = attributes.end();
for (; it != end; ++it)
{
m_buffer += Core::fmt(TXT(" %s=\"%s\""), (*it)->name().c_str(), (*it)->value().c_str());
}
}