本文整理汇总了C++中AttributeMap::end方法的典型用法代码示例。如果您正苦于以下问题:C++ AttributeMap::end方法的具体用法?C++ AttributeMap::end怎么用?C++ AttributeMap::end使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AttributeMap
的用法示例。
在下文中一共展示了AttributeMap::end方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: onObserve
void onObserve(const HeaderOptions &headerOption , const OCRepresentation& rep , const int& eCode, const int& sequenceNumber)
{
std::cout << "onObserve" << std::endl;
// if(eCode == SUCCESS_RESPONSE)
if(eCode <= OC_STACK_RESOURCE_DELETED)
{
AttributeMap attributeMap = rep.getAttributeMap();
for(auto it = attributeMap.begin() ; it != attributeMap.end() ; ++it)
{
if(attributeMap.find(it->first) == attributeMap.end())
{
return;
}
}
if(rep.getUri().empty())
{
cout << "uri is null\n";
return;
}
std::cout << std::endl;
std::cout << "========================================================" << std::endl;
std::cout << "Receive OBSERVE RESULT:" << std::endl;
std::cout << "\tSequenceNumber: " << sequenceNumber << std::endl;
for(auto it = attributeMap.begin() ; it != attributeMap.end() ; ++it)
{
std::cout << "\tAttribute name: " << it->first << " value: ";
for(auto valueItr = it->second.begin() ; valueItr != it->second.end() ; ++valueItr)
{
std::cout << "\t" << *valueItr << " ";
}
std::cout << std::endl;
}
if(observe_count() > 30)
{
std::cout << "Cancelling Observe..." << std::endl;
OCStackResult result = g_curResource->cancelObserve();
std::cout << "Cancel result: " << result << std::endl;
sleep(10);
std::cout << "DONE" << std::endl;
std::exit(0);
}
}
else
{
std::cout << "onObserve Response error: " << eCode << std::endl;
std::exit(-1);
}
}
示例2: startElement
void KeyHandler::startElement(const QName& qname, const AttributeMap& attributes) {
_result.reset(new Key());
auto number = attributes.find(kNumberAttribute);
if (number != attributes.end())
_result->setNumber(lxml::IntegerHandler::parseInteger(number->second));
auto print = attributes.find(kPrintObjectAttribute);
if (print != attributes.end())
_result->setPrintObject(print->second == "no" ? false : true);
}
示例3: startElement
void MordentHandler::startElement(const lxml::QName& qname, const AttributeMap& attributes) {
_result.reset(new Mordent());
auto placement = attributes.find(kPlacementAttribute);
if (placement != attributes.end())
_result->setPlacement(presentOptional(EmptyPlacementHandler::placementFromString(placement->second)));
auto longv = attributes.find(kLongAttribute);
if (longv != attributes.end())
_result->setLong(longv->second == "yes");
}
示例4: onPut
void onPut(const OCRepresentation& rep , const int eCode)
{
if(eCode == SUCCESS_RESPONSE)
{
std::cout << "PUT request was successful" << std::endl;
AttributeMap attributeMap = rep.getAttributeMap();
for(auto it = attributeMap.begin() ; it != attributeMap.end() ; ++it)
{
std::cout << "\tAttribute name: " << it->first << " value: ";
for(auto valueItr = it->second.begin() ; valueItr != it->second.end() ; ++valueItr)
{
std::cout << "\t" << *valueItr << " ";
}
std::cout << std::endl;
}
std::vector< OCRepresentation > children = rep.getChildren();
for(auto oit = children.begin() ; oit != children.end() ; ++oit)
{
attributeMap = oit->getAttributeMap();
for(auto it = attributeMap.begin() ; it != attributeMap.end() ; ++it)
{
std::cout << "\tAttribute name: " << it->first << " value: ";
for(auto valueItr = it->second.begin() ; valueItr != it->second.end() ; ++valueItr)
{
std::cout << "\t" << *valueItr << " ";
}
std::cout << std::endl;
}
}
if(OBSERVE_TYPE_TO_USE == ObserveType::Observe)
std::cout << std::endl << "Observe is used." << std::endl << std::endl;
else if(OBSERVE_TYPE_TO_USE == ObserveType::ObserveAll)
std::cout << std::endl << "ObserveAll is used." << std::endl << std::endl;
QueryParamsMap test;
g_curResource->observe(ObserveType::Observe , test , &onObserve);
}
else
{
std::cout << "onPut Response error: " << eCode << std::endl;
std::exit(-1);
}
}
示例5: onobserve
void onobserve()
{
oicappData *ad = g_oicObserveAd;
AttributeMap attributeMap = g_curAttributeMap;
std::string tmpStr[2];
int index = 0;
for(auto it = attributeMap.begin() ; it != attributeMap.end() ; ++it)
{
tmpStr[index] = it->first;
tmpStr[index].append(" : ");
for(auto value = it->second.begin() ; value != it->second.end() ; ++value)
{
tmpStr[index].append(*value);
}
index++;
}
DBG("%s" , tmpStr[0].c_str());
DBG("%s" , tmpStr[1].c_str());
_gl_update_item(ad , strdup(tmpStr[0].c_str()) , ad->itemConsumerTemp);
_gl_update_item(ad , strdup(tmpStr[1].c_str()) , ad->itemConsumerHumid);
}
示例6:
bool
TemplateBuilder::hasAttribute(
const AttributeMap& attributes,
const std::string& name)
{
return attributes.find(name) != attributes.end();
}
示例7: setLength
void StyleSheetTable::setLength(ZLTextStyleEntry &entry, ZLTextStyleEntry::Feature featureId, const AttributeMap &map, const std::string &attributeName) {
StyleSheetTable::AttributeMap::const_iterator it = map.find(attributeName);
if (it != map.end()) {
::trySetLength(entry, featureId, it->second);
return;
}
}
示例8: onGet
// callback handler on GET request
void onGet(const HeaderOptions &headerOption , const OCRepresentation& rep , const int eCode)
{
if(eCode == SUCCESS_RESPONSE)
{
std::cout << "GET request was successful" << std::endl;
AttributeMap attributeMap = rep.getAttributeMap();
std::cout << "Resource URI: " << rep.getUri() << std::endl;
for(auto it = attributeMap.begin() ; it != attributeMap.end() ; ++it)
{
std::cout << "\tAttribute name: " << it->first << " value: ";
for(auto valueItr = it->second.begin() ; valueItr != it->second.end() ; ++valueItr)
{
std::cout << "\t" << *valueItr << " ";
}
std::cout << std::endl;
}
std::vector< OCRepresentation > children = rep.getChildren();
for(auto oit = children.begin() ; oit != children.end() ; ++oit)
{
std::cout << "Child Resource URI: " << oit->getUri() << std::endl;
attributeMap = oit->getAttributeMap();
for(auto it = attributeMap.begin() ; it != attributeMap.end() ; ++it)
{
std::cout << "\tAttribute name: " << it->first << " value: ";
for(auto valueItr = it->second.begin() ; valueItr != it->second.end() ; ++valueItr)
{
std::cout << "\t" << *valueItr << " ";
}
std::cout << std::endl;
}
}
}
else
{
std::cout << "onGET Response error: " << eCode << std::endl;
std::exit(-1);
}
}
示例9: startElement
void PartHandler::startElement(const QName& qname, const AttributeMap& attributes) {
_result.reset(new Part());
_measureIndex = 0;
auto id = attributes.find(kIdTag);
if (id != attributes.end())
_result->setId(id->second);
}
示例10: printAttributeMap
void printAttributeMap(const AttributeMap attributeMap)
{
for(auto it = attributeMap.begin() ; it != attributeMap.end() ; ++it)
{
DBG("\tAttribute name: %s" , it->first.c_str());
for(auto valueItr = it->second.begin() ; valueItr != it->second.end() ; ++valueItr)
{
DBG("\t\tAttribute value: %s" , (*valueItr).c_str());
}
}
}
示例11: startElement
void PedalHandler::startElement(const lxml::QName& qname, const AttributeMap& attributes) {
using dom::presentOptional;
using lxml::DoubleHandler;
using lxml::StringHandler;
_result.reset(new Pedal{});
_result->position = PositionFactory::buildFromAttributes(attributes);
auto type = attributes.find(kTypeAttribute);
if (type != attributes.end())
_result->setType(typeFromString(type->second));
auto line = attributes.find(kLineAttribute);
if (line != attributes.end())
_result->setLine(presentOptional(line->second == "yes"));
auto sign = attributes.find(kSignAttribute);
if (sign != attributes.end())
_result->setSign(presentOptional(sign->second == "yes"));
}
示例12: setLength
void StyleSheetTable::setLength(ZLTextStyleEntry &entry, ZLTextStyleEntry::Length name, const AttributeMap &map, const std::string &attributeName) {
StyleSheetTable::AttributeMap::const_iterator it = map.find(attributeName);
if (it == map.end()) {
return;
}
const std::vector<std::string> &values = it->second;
if (!values.empty() && !values[0].empty()) {
short size;
ZLTextStyleEntry::SizeUnit unit;
parseLength(values[0], size, unit);
entry.setLength(name, size, unit);
}
}
示例13: handleStartElement
void SerializingParser::handleStartElement(const std::string& tag, const std::string& ns, const AttributeMap& attributes) {
boost::shared_ptr<XMLElement> element(new XMLElement(tag, ns));
for (AttributeMap::const_iterator i = attributes.begin(); i != attributes.end(); ++i) {
element->setAttribute((*i).first, (*i).second);
}
if (elementStack_.empty()) {
rootElement_ = element;
}
else {
(*(elementStack_.end() - 1))->addNode(element);
}
elementStack_.push_back(element);
}
示例14: TemplateDefinitionError
bool
TemplateBuilder::getRequiredBooleanAttribute(
const AttributeMap& attributes,
const std::string& name)
{
AttributeMap::const_iterator it = attributes.find(name);
if(it == attributes.end())
{
std::string errMsg;
errMsg +=
"[ERR S1] Missing required attribute \"" + name + "\"";
throw TemplateDefinitionError(errMsg);
}
return getOptionalBooleanAttribute(attributes, name, false);
}
示例15: writeSparse
void writeSparse(QFile& file, const AttributeMap& data)
{
FNTRACE("ini", "", "writeSparse", QString("file %1, %2 rows of data").arg(file.fileName()).arg(data.size()));
if (!file.open(QIODevice::WriteOnly | QIODevice::Text | QIODevice::Truncate))
ETHROW(Exception(QString("Unable to open %1 for writing.").arg(file.fileName())));
file.resize(0);
QTextStream fout(&file);
int max_key_length = 0;
for (AttributeMap::const_iterator iter = data.begin(); iter != data.end(); ++iter)
{
if (iter.key().length() > max_key_length)
max_key_length = iter.key().length();
}
for (AttributeMap::const_iterator iter = data.begin(); iter != data.end(); ++iter)
{
fout << iter.key();
for (int i = iter.key().length(); i < max_key_length; ++i)
fout << ' ';
fout << " = " << iter.value() << "\n";
}
}