本文整理汇总了C++中block::element_const_iterator::elements_begin方法的典型用法代码示例。如果您正苦于以下问题:C++ element_const_iterator::elements_begin方法的具体用法?C++ element_const_iterator::elements_begin怎么用?C++ element_const_iterator::elements_begin使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类block::element_const_iterator
的用法示例。
在下文中一共展示了element_const_iterator::elements_begin方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: while
void
Schedule::wireDecode(const Block& wire)
{
if (wire.type() != tlv::Schedule)
BOOST_THROW_EXCEPTION(tlv::Error("Unexpected TLV type when decoding RepetitiveInterval"));
m_wire = wire;
m_wire.parse();
if (m_wire.elements_size() != 2)
BOOST_THROW_EXCEPTION(tlv::Error("RepetitiveInterval tlv does not have two sub-TLVs"));
Block::element_const_iterator it = m_wire.elements_begin();
if (it != m_wire.elements_end() && it->type() == tlv::WhiteIntervalList) {
it->parse();
Block::element_const_iterator tempIt = it->elements_begin();
while (tempIt != it->elements_end() && tempIt->type() == tlv::RepetitiveInterval) {
m_whiteIntervalList.insert(RepetitiveInterval(*tempIt));
tempIt++;
}
it++;
}
if (it != m_wire.elements_end() && it->type() == tlv::BlackIntervalList) {
it->parse();
Block::element_const_iterator tempIt = it->elements_begin();
while (tempIt != it->elements_end() && tempIt->type() == tlv::RepetitiveInterval) {
m_blackIntervalList.insert(RepetitiveInterval(*tempIt));
tempIt++;
}
it++;
}
}
示例2: Error
void
StrategyChoice::wireDecode(const Block& block)
{
if (block.type() != tlv::nfd::StrategyChoice) {
throw Error("expecting StrategyChoice block");
}
m_wire = block;
m_wire.parse();
Block::element_const_iterator val = m_wire.elements_begin();
if (val != m_wire.elements_end() && val->type() == tlv::Name) {
m_name.wireDecode(*val);
++val;
}
else {
throw Error("missing required Name field");
}
if (val != m_wire.elements_end() && val->type() == tlv::nfd::Strategy) {
val->parse();
if (val->elements().empty()) {
throw Error("expecting Strategy/Name");
}
else {
m_strategy.wireDecode(*val->elements_begin());
}
++val;
}
else {
throw Error("missing required Strategy field");
}
}
示例3: name
void
Manifest::decode()
{
Block content = getContent();
content.parse();
// Manifest ::= CONTENT-TLV TLV-LENGTH
// Catalogue?
// Name*
// KeyValuePair*
for ( Block::element_const_iterator val = content.elements_begin();
val != content.elements_end(); ++val)
{
if (val->type() == tlv::ManifestCatalogue)
{
val->parse();
for ( Block::element_const_iterator catalogueNameElem = val->elements_begin();
catalogueNameElem != val->elements_end(); ++catalogueNameElem)
{
if (catalogueNameElem->type() == tlv::Name)
{
Name name(*catalogueNameElem);
m_catalogueNames.push_back(name);
}
}
}
else if (val->type() == tlv::KeyValuePair)
{
std::string str((char*)val->value(), val->value_size());
size_t index = str.find_first_of('=');
if (index == std::string::npos || index == 0 || (index == str.size() - 1))
continue;
std::string key = str.substr(0, index);
std::string value = str.substr(index + 1, str.size() - index - 1);
addKeyValuePair(key, value);
}
}
}
示例4: Error
void
ControlParameters::wireDecode(const Block& block)
{
if (block.type() != tlv::nfd::ControlParameters) {
throw Error("expecting TLV-TYPE ControlParameters");
}
m_wire = block;
m_wire.parse();
Block::element_const_iterator val;
val = m_wire.find(tlv::Name);
m_hasFields[CONTROL_PARAMETER_NAME] = val != m_wire.elements_end();
if (this->hasName()) {
m_name.wireDecode(*val);
}
val = m_wire.find(tlv::nfd::FaceId);
m_hasFields[CONTROL_PARAMETER_FACE_ID] = val != m_wire.elements_end();
if (this->hasFaceId()) {
m_faceId = static_cast<uint64_t>(readNonNegativeInteger(*val));
}
val = m_wire.find(tlv::nfd::Uri);
m_hasFields[CONTROL_PARAMETER_URI] = val != m_wire.elements_end();
if (this->hasUri()) {
m_uri.assign(reinterpret_cast<const char*>(val->value()), val->value_size());
}
val = m_wire.find(tlv::nfd::LocalControlFeature);
m_hasFields[CONTROL_PARAMETER_LOCAL_CONTROL_FEATURE] = val != m_wire.elements_end();
if (this->hasLocalControlFeature()) {
m_localControlFeature = static_cast<LocalControlFeature>(readNonNegativeInteger(*val));
}
val = m_wire.find(tlv::nfd::Origin);
m_hasFields[CONTROL_PARAMETER_ORIGIN] = val != m_wire.elements_end();
if (this->hasOrigin()) {
m_origin = static_cast<uint64_t>(readNonNegativeInteger(*val));
}
val = m_wire.find(tlv::nfd::Cost);
m_hasFields[CONTROL_PARAMETER_COST] = val != m_wire.elements_end();
if (this->hasCost()) {
m_cost = static_cast<uint64_t>(readNonNegativeInteger(*val));
}
val = m_wire.find(tlv::nfd::Flags);
m_hasFields[CONTROL_PARAMETER_FLAGS] = val != m_wire.elements_end();
if (this->hasFlags()) {
m_flags = static_cast<uint64_t>(readNonNegativeInteger(*val));
}
val = m_wire.find(tlv::nfd::Strategy);
m_hasFields[CONTROL_PARAMETER_STRATEGY] = val != m_wire.elements_end();
if (this->hasStrategy()) {
val->parse();
if (val->elements().empty()) {
throw Error("expecting Strategy/Name");
}
else {
m_strategy.wireDecode(*val->elements_begin());
}
}
val = m_wire.find(tlv::nfd::ExpirationPeriod);
m_hasFields[CONTROL_PARAMETER_EXPIRATION_PERIOD] = val != m_wire.elements_end();
if (this->hasExpirationPeriod()) {
m_expirationPeriod = time::milliseconds(readNonNegativeInteger(*val));
}
}