• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ TagMap类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中TagMap的典型用法代码示例。如果您正苦于以下问题:C++ TagMap类的具体用法?C++ TagMap怎么用?C++ TagMap使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



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

示例1: pdal_error

std::vector<Stage *> PipelineReaderJSON::extractInputs(Json::Value& node,
    TagMap& tags)
{
    std::vector<Stage *> inputs;
    std::string filename;

    if (node.isMember("inputs"))
    {
        Json::Value& val = node["filename"];
        if (!val.isNull())
        {
            for (const Json::Value& input : node["inputs"])
            {
                if (input.isString())
                {
                    std::string tag = input.asString();
                    auto ii = tags.find(tag);
                    if (ii == tags.end())
                        throw pdal_error("JSON pipeline: Invalid pipeline: "
                            "undefined stage tag '" + tag + "'.");
                    else
                        inputs.push_back(ii->second);
                }
                else
                    throw pdal_error("JSON pipeline: 'inputs' tag must "
                        " be specified as a string.");
            }
        }
        node.removeMember("inputs");
        if (node.isMember("inputs"))
            throw pdal_error("JSON pipeline: found duplicate 'inputs' "
               "entry in stage definition.");
    }
    return inputs;
}
开发者ID:EricAlex,项目名称:PDAL,代码行数:35,代码来源:PipelineReaderJSON.cpp


示例2: extractTag

std::string PipelineReaderJSON::extractTag(Json::Value& node, TagMap& tags)
{
    std::string tag;

    if (node.isMember("tag"))
    {
        Json::Value& val = node["tag"];
        if (!val.isNull())
        {
            if (val.isString())
            {
                tag = val.asString();
                if (tags.find(tag) != tags.end())
                    throw pdal_error("JSON pipeline: duplicate tag '" +
                        tag + "'.");
            }
            else
                throw pdal_error("JSON pipeline: tag must be "
                    "specified as a string.");
        }
        node.removeMember("tag");
        if (node.isMember("tag"))
            throw pdal_error("JSON pipeline: found duplicate 'tag' "
               "entry in stage definition.");
        std::string::size_type pos = 0;
        if (!Stage::parseTagName(tag, pos) || pos != tag.size())
            throw pdal_error("JSON pipeline: Invalid tag name '" + tag + "'.  "
                "Must start with letter.  Remainder can be letters, "
                "digits or underscores.");
    }
    return tag;
}
开发者ID:chambbj,项目名称:PDAL,代码行数:32,代码来源:PipelineReaderJSON.cpp


示例3: PrintTagMap

void PrintTagMap(const TagMap &tagMap)
{
	for(TagMap::const_iterator it = tagMap.begin(); it != tagMap.end(); it++)
	{
		std::cout << it->first << "=" << it->second << std::endl;
	}
}
开发者ID:TimSC,项目名称:cppo5m,代码行数:7,代码来源:o5m.cpp


示例4: extractTag

std::string PipelineReaderJSON::extractTag(Json::Value& node, TagMap& tags)
{
    std::string tag;

    if (node.isMember("tag"))
    {
        Json::Value& val = node["tag"];
        if (!val.isNull())
        {
            if (val.isString())
            {
                tag = val.asString();
                if (tags.find(tag) != tags.end())
                    throw pdal_error("JSON pipeline: duplicate tag '" +
                        tag + "'.");
            }
            else
                throw pdal_error("JSON pipeline: 'tag' must be "
                    "specified as a string.");
        }
        node.removeMember("tag");
        if (node.isMember("tag"))
            throw pdal_error("JSON pipeline: found duplicate 'tag' "
               "entry in stage definition.");
    }
    return tag;
}
开发者ID:EricAlex,项目名称:PDAL,代码行数:27,代码来源:PipelineReaderJSON.cpp


示例5: EncodeZigzag

void O5mEncodeBase::StoreNode(int64_t objId, const class MetaData &metaData, 
		const TagMap &tags, double latIn, double lonIn)
{
	this->write("\x10",1);

	//Object ID
	std::stringstream tmpStream;
	int64_t deltaId = objId - this->lastObjId;
	tmpStream << EncodeZigzag(deltaId);
	this->lastObjId = objId;

	this->EncodeMetaData(metaData, tmpStream);

	//Position
	int64_t lon = round(lonIn * 1e7);
	int64_t deltaLon = lon - this->lastLon;
	tmpStream << EncodeZigzag(deltaLon);
	this->lastLon = lon;
	int64_t lat = round(latIn * 1e7);
	int64_t deltaLat = lat - this->lastLat;
	tmpStream << EncodeZigzag(deltaLat);
	this->lastLat = lat;

	for (TagMap::const_iterator it=tags.begin(); it != tags.end(); it++)
		this->WriteStringPair(it->first, it->second, tmpStream);

	std::string binData = tmpStream.str();
	std::string len = EncodeVarint(binData.size());
	*this << len;
	*this << binData;
}
开发者ID:TimSC,项目名称:cppo5m,代码行数:31,代码来源:o5m.cpp


示例6: StoreRelation

void OsmXmlEncodeBase::StoreRelation(int64_t objId, const class MetaData &metaData, const TagMap &tags, 
	const std::vector<std::string> &refTypeStrs, const std::vector<int64_t> &refIds,
	const std::vector<std::string> &refRoles)
{
	if(refTypeStrs.size() != refIds.size() || refTypeStrs.size() != refRoles.size())
		throw std::invalid_argument("Length of ref vectors must be equal");

	stringstream ss;
	ss << "  <relation id=\""<<objId<<"\"";
	this->EncodeMetaData(metaData, ss);
	if(tags.size() == 0 && refTypeStrs.size() == 0)
		ss <<" />" << endl;
	else
	{
		ss <<">" << endl;

		//Write node IDs
		for(size_t i=0; i<refTypeStrs.size(); i++)
			ss << "    <member type=\""<<escapexml(refTypeStrs[i])<<"\" ref=\""<<refIds[i]<<"\" role=\""<<escapexml(refRoles[i])<<"\" />" << endl;

		//Write tags
		for(TagMap::const_iterator it=tags.begin(); it!=tags.end(); it++)
			ss << "    <tag k=\""<<escapexml(it->first)<<"\" v=\""<<escapexml(it->second)<<"\" />" << endl;

		ss << "  </relation>" << endl;
	}
	*this << ss.str();
}
开发者ID:TimSC,项目名称:cppo5m,代码行数:28,代码来源:osmxml.cpp


示例7: handleInputTag

void PipelineReaderJSON::handleInputTag(const std::string& tag,
    const TagMap& tags, std::vector<Stage *>& inputs)
{
    auto ii = tags.find(tag);
    if (ii == tags.end())
        throw pdal_error("JSON pipeline: Invalid pipeline: "
            "undefined stage tag '" + tag + "'.");
    else
        inputs.push_back(ii->second);
}
开发者ID:chambbj,项目名称:PDAL,代码行数:10,代码来源:PipelineReaderJSON.cpp


示例8: Evaluate

  bool TagIsInCondition::Evaluate(const TagMap& tagMap) const
  {
    auto t=tagMap.find(tag);

    if (t==tagMap.end()) {
      return false;
    }

    return tagValues.find(t->second)!=tagValues.end();
  }
开发者ID:camiloMS,项目名称:libosmscout,代码行数:10,代码来源:Tag.cpp


示例9: buf

size_t
GenericHeader::read(IDataReader &reader)
{
    size_t bufLen = 1024 * 32;
    DataBuffer buf(bufLen, ALIGNMENT);
    size_t numBytesRead = reader.getData(buf.getFree(), bufLen);
    buf.moveFreeToData(numBytesRead);

    if (numBytesRead < 4 /* magic */ + 4 /* size */) {
        throw IllegalHeaderException("Failed to read header info.");
    }
    uint32_t magic = buf.readInt32();
    if (magic != MAGIC) {
        throw IllegalHeaderException("Failed to verify magic bits.");
    }
    uint32_t numBytesTotal = buf.readInt32();
    if (numBytesTotal == 0) {
        throw IllegalHeaderException("Failed to read header size.");
    }
    if (numBytesTotal < getMinSize()) {
        throw IllegalHeaderException("Failed to verify header size.");
    }
    if (numBytesRead < numBytesTotal) {
        LOG(debug, "Read %d of %d header bytes, performing backfill.",
            (uint32_t)numBytesRead, numBytesTotal);
        uint32_t numBytesRemain = numBytesTotal - numBytesRead;
        buf.ensureFree(numBytesRemain);
        LOG(debug, "Reading remaining %d bytes of header.", numBytesRemain);
        numBytesRead += reader.getData(buf.getFree(), numBytesRemain);
        if (numBytesRead != numBytesTotal) {
            throw IllegalHeaderException("Failed to read full header.");
        }
        buf.moveFreeToData(numBytesRemain);
    } else {
        buf.moveDataToFree(numBytesRead - numBytesTotal);
    }

    uint32_t version = buf.readInt32();
    if (version != VERSION) {
        throw IllegalHeaderException("Failed to verify header version.");
    }
    uint32_t numTags = buf.readInt32();
    TagMap tags;
    for (uint32_t i = 0; i < numTags; ++i) {
        Tag tag;
        tag.read(buf);
        tags.insert(TagMap::value_type(tag.getName(), tag));
    }
    _tags.swap(tags);
    return numBytesTotal;
}
开发者ID:songhtdo,项目名称:vespa,代码行数:51,代码来源:fileheader.cpp


示例10: GetName

  std::string ImportErrorReporter::GetName(const ObjectOSMRef& object,
                                           const TagMap& tags) const
  {
    std::stringstream buffer;

    buffer << object.GetName();

    if (nameTagId!=tagIgnore) {
      const auto entry=tags.find(nameTagId);

      if (entry!=tags.end()) {
        buffer << " \"" << entry->second << "\"";
      }
    }

    return buffer.str();
  }
开发者ID:Framstag,项目名称:libosmscout,代码行数:17,代码来源:ImportErrorReporter.cpp


示例11:

  bool Preprocess::Callback::IsMultipolygon(const TagMap& tags,
                                            TypeInfoRef& type)
  {
    type=typeConfig->GetRelationType(tags);

    if (type!=typeConfig->typeInfoIgnore &&
        type->GetIgnore()) {
      return false;
    }

    bool isArea=type!=typeConfig->typeInfoIgnore &&
                type->GetMultipolygon();

    if (!isArea) {
      auto typeTag=tags.find(typeConfig->tagType);

      isArea=typeTag!=tags.end() && typeTag->second=="multipolygon";
    }

    return isArea;
  }
开发者ID:kolosov,项目名称:libosmscout,代码行数:21,代码来源:Preprocess.cpp


示例12: init

void QFieldDefinitionData::init(TagMap &tagMap, FieldMap &fieldMap, ActionMap &actionMap, QTranslatableSettings &config)
{
    QList<QFieldDefinition> fields;
    QMap<QString, QFieldAction> actions;

    fields = QFieldDefinitionData::readFields(config);
    actions = QFieldDefinitionData::readActions(config);

    foreach(QFieldDefinition def, fields) {
        if (!fieldMap.contains(def.id())) {
            fieldMap.insert(def.id(), def);
            QStringList tags = def.tags();
            foreach(QString tag, tags)
            {
                QSet<QString> taggedFields;
                if (tagMap.contains(tag))
                    taggedFields = tagMap.value(tag);
                taggedFields.insert(def.id());
                tagMap.insert(tag, taggedFields);
            }
        }
开发者ID:Camelek,项目名称:qtmoko,代码行数:21,代码来源:qfielddefinition.cpp


示例13: Tags

// ---------------------------------------------------------------------------
//	EnvelopeReader Find
// ---------------------------------------------------------------------------
//	May return NULL if no reader with the specified owner and index
//	is found.
//
const EnvelopeReader * 
EnvelopeReader::Find( INSDS * owner, int idx )
{
	TagMap & readers = Tags();
	TagMap::iterator it = readers.find( Tag( owner, idx ) );
	if ( it != readers.end() )
	{
#ifdef DEBUG_LORISGENS
		std::cerr << "** found EnvelopeReader with owner " << owner << " and index " << idx;
		std::cerr << " having " << it->second->size() << " envelopes." << std::endl; 
#endif
		return it->second;
	}
	else
	{
#ifdef DEBUG_LORISGENS
		std::cerr << "** could not find EnvelopeReader with owner " << owner << " and index " << idx << std::endl; 
#endif
		return NULL;
	}
}
开发者ID:gesellkammer,项目名称:loris14-extended,代码行数:27,代码来源:lorisgens.C


示例14: if

  bool Preprocess::Callback::IsTurnRestriction(const TagMap& tags,
                                               TurnRestriction::Type& type) const
  {
    auto typeValue=tags.find(typeConfig->tagType);

    if (typeValue==tags.end()) {
      return false;
    }

    if (typeValue->second!="restriction") {
      return false;
    }

    auto restrictionValue=tags.find(typeConfig->tagRestriction);

    if (restrictionValue==tags.end()) {
      return false;
    }

    type=TurnRestriction::Allow;

    if (restrictionValue->second=="only_left_turn" ||
        restrictionValue->second=="only_right_turn" ||
        restrictionValue->second=="only_straight_on") {
      type=TurnRestriction::Allow;

      return true;
    }
    else if (restrictionValue->second=="no_left_turn" ||
             restrictionValue->second=="no_right_turn" ||
             restrictionValue->second=="no_straight_on" ||
             restrictionValue->second=="no_u_turn") {
      type=TurnRestriction::Forbit;

      return true;
    }

    return false;
  }
开发者ID:kolosov,项目名称:libosmscout,代码行数:39,代码来源:Preprocess.cpp


示例15: StoreNode

void OsmXmlEncodeBase::StoreNode(int64_t objId, const class MetaData &metaData, 
	const TagMap &tags, double lat, double lon)
{
	stringstream ss;
	ss.precision(9);
	ss << "  <node id=\""<<objId<<"\"";
	this->EncodeMetaData(metaData, ss);
	ss << fixed << " lat=\""<<lat<<"\" lon=\""<<lon<<"\"";
	if(tags.size() == 0)
		ss <<" />" << endl;
	else
	{
		ss <<">" << endl;

		//Write tags
		for(TagMap::const_iterator it=tags.begin(); it!=tags.end(); it++)
		{
			ss << "    <tag k=\""<<escapexml(it->first)<<"\" v=\""<<escapexml(it->second)<<"\" />" << endl;
		}
		ss << "  </node>" << endl;
	}
	*this << ss.str();
}
开发者ID:TimSC,项目名称:cppo5m,代码行数:23,代码来源:osmxml.cpp


示例16: StoreWay

void OsmXmlEncodeBase::StoreWay(int64_t objId, const class MetaData &metaData, 
	const TagMap &tags, const std::vector<int64_t> &refs)
{
	stringstream ss;
	ss << "  <way id=\""<<objId<<"\"";
	this->EncodeMetaData(metaData, ss);
	if(tags.size() == 0 && refs.size() == 0)
		ss <<" />" << endl;
	else
	{
		ss <<">" << endl;

		//Write node IDs
		for(size_t i=0; i<refs.size(); i++)
			ss << "    <nd ref=\""<<refs[i]<<"\" />" << endl;

		//Write tags
		for(TagMap::const_iterator it=tags.begin(); it!=tags.end(); it++)
			ss << "    <tag k=\""<<escapexml(it->first)<<"\" v=\""<<escapexml(it->second)<<"\" />" << endl;

		ss << "  </way>" << endl;
	}
	*this << ss.str();
}
开发者ID:TimSC,项目名称:cppo5m,代码行数:24,代码来源:osmxml.cpp


示例17: WriteStart

void OsmXmlEncodeBase::WriteStart(const TagMap &customAttribs)
{
	*this << "<?xml version='1.0' encoding='UTF-8'?>\n";
	*this << "<osm";
	TagMap::const_iterator it = customAttribs.find("version");
	if(it != customAttribs.end())
	{
		*this << " version=\""; 
		*this << escapexml(it->second);
		*this << "\"";
	}
	else
		*this << " version=\"0.6\"";

	it = customAttribs.find("generator");
	if(it != customAttribs.end())
	{
		*this << " generator=\"";
		*this << escapexml(it->second);
		*this << "\"";
	}
	else
		*this << " generator=\"cppo5m\"";

	for(it = customAttribs.begin(); it != customAttribs.end(); it++)
	{
		if(it->first == "version" || it->first == "generator")
			continue;
		if(it->second.length() == 0)
			continue;
		*this << " ";
		*this << escapexml(it->first);
		*this <<"=\"";
		*this << escapexml(it->second);
		*this <<"\"";
	}

	*this << ">\n";
}
开发者ID:TimSC,项目名称:cppo5m,代码行数:39,代码来源:osmxml.cpp


示例18: wxGetTranslation

bool TagsEditor::TransferDataToWindow()
{
   size_t i;
   TagMap popTagMap;

   // Disable redrawing until we're done
   mGrid->BeginBatch();

   // Delete all rows
   if (mGrid->GetNumberRows()) {
      mGrid->DeleteRows(0, mGrid->GetNumberRows());
   }

   // Populate the static rows
   for (i = 0; i < STATICCNT; i++) {
      mGrid->AppendRows();

      mGrid->SetReadOnly(i, 0);
      // The special tag name that's displayed and translated may not match
      // the key string used for internal lookup.
      mGrid->SetCellValue(i, 0, wxGetTranslation( labelmap[i].label ) );
      mGrid->SetCellValue(i, 1, mLocal.GetTag(labelmap[i].name));

      if (!mEditTitle &&
          mGrid->GetCellValue(i, 0).CmpNoCase(wxGetTranslation(LABEL_TITLE)) == 0) {
         mGrid->SetReadOnly(i, 1);
      }

      if (!mEditTrack &&
          mGrid->GetCellValue(i, 0).CmpNoCase(wxGetTranslation(LABEL_TRACK)) == 0) {
         mGrid->SetReadOnly(i, 1);
      }

      popTagMap[ labelmap[i].name ] = mGrid->GetCellValue(i, 1);
   }

   // Populate the rest
   for (const auto &pair : mLocal.GetRange()) {
      const auto &n = pair.first;
      const auto &v = pair.second;
      if (popTagMap.find(n) == popTagMap.end()) {
         mGrid->AppendRows();
         mGrid->SetCellValue(i, 0, n);
         mGrid->SetCellValue(i, 1, v);
         i++;
      }
   }

   // Add an extra one to help with initial sizing and to show it can be done
   mGrid->AppendRows(1);

   // We're done, so allow the grid to redraw
   mGrid->EndBatch();

   // Set the editors
   SetEditors();
   Layout();
   Fit();

   return true;
}
开发者ID:SteveDaulton,项目名称:audacity,代码行数:61,代码来源:Tags.cpp


示例19: EndElement

 void EndElement(const xmlChar *name)
 {
   if (strcmp((const char*)name,"node")==0) {
     callback.ProcessNode(id,
                          lon,
                          lat,
                          tags);
     tags.clear();
     context=contextUnknown;
   }
   else if (strcmp((const char*)name,"way")==0) {
     callback.ProcessWay(id,
                         nodes,
                         tags);
     nodes.clear();
     tags.clear();
     context=contextUnknown;
   }
   else if (strcmp((const char*)name,"relation")==0) {
     callback.ProcessRelation(id,
                              members,
                              tags);
     members.clear();
     tags.clear();
     context=contextUnknown;
   }
 }
开发者ID:jojva,项目名称:libosmscout,代码行数:27,代码来源:PreprocessOSM.cpp


示例20: StartElement

    void StartElement(const xmlChar *name, const xmlChar **atts)
    {
      if (strcmp((const char*)name,"node")==0) {
        const xmlChar *idValue=NULL;
        const xmlChar *latValue=NULL;
        const xmlChar *lonValue=NULL;

        context=contextNode;
        tags.clear();

        for (size_t i=0; atts[i]!=NULL && atts[i+1]!=NULL; i+=2) {
          if (strcmp((const char*)atts[i],"id")==0) {
            idValue=atts[i+1];
          }
          else if (strcmp((const char*)atts[i],"lat")==0) {
            latValue=atts[i+1];
          }
          else if (strcmp((const char*)atts[i],"lon")==0) {
            lonValue=atts[i+1];
          }
        }

        if (idValue==NULL || lonValue==NULL || latValue==NULL) {
          std::cerr << "Not all required attributes found" << std::endl;
        }

        if (!StringToNumber((const char*)idValue,id)) {
          std::cerr << "Cannot parse id: '" << idValue << "'" << std::endl;
          return;
        }
        if (!StringToNumber((const char*)latValue,lat)) {
          std::cerr << "Cannot parse latitude: '" << latValue << "'" << std::endl;
          return;
        }
        if (!StringToNumber((const char*)lonValue,lon)) {
          std::cerr << "Cannot parse longitude: '" << lonValue << "'" << std::endl;
          return;
        }
      }
      else if (strcmp((const char*)name,"way")==0) {
        const xmlChar *idValue=NULL;

        context=contextWay;
        nodes.clear();
        members.clear();
        tags.clear();

        for (size_t i=0; atts[i]!=NULL && atts[i+1]!=NULL; i+=2) {
          if (strcmp((const char*)atts[i],"id")==0) {
            idValue=atts[i+1];
          }
        }

        if (!StringToNumber((const char*)idValue,id)) {
          std::cerr << "Cannot parse id: '" << idValue << "'" << std::endl;
          return;
        }
      }
      if (strcmp((const char*)name,"relation")==0) {
        const xmlChar *idValue=NULL;

        context=contextRelation;
        tags.clear();
        nodes.clear();
        members.clear();

        for (size_t i=0; atts[i]!=NULL && atts[i+1]!=NULL; i+=2) {
          if (strcmp((const char*)atts[i],"id")==0) {
            idValue=atts[i+1];
          }
        }

        if (!StringToNumber((const char*)idValue,id)) {
          std::cerr << "Cannot parse id: '" << idValue << "'" << std::endl;
          return;
        }
      }
      else if (strcmp((const char*)name,"tag")==0) {
        if (context!=contextWay && context!=contextNode && context!=contextRelation) {
          return;
        }

        const xmlChar *keyValue=NULL;
        const xmlChar *valueValue=NULL;

        for (size_t i=0; atts[i]!=NULL && atts[i+1]!=NULL; i+=2) {
          if (strcmp((const char*)atts[i],"k")==0) {
            keyValue=atts[i+1];
          }
          else if (strcmp((const char*)atts[i],"v")==0) {
            valueValue=atts[i+1];
          }
        }

        if (keyValue==NULL || valueValue==NULL) {
          std::cerr << "Cannot parse tag, skipping..." << std::endl;
          return;
        }

        TagId id=typeConfig.GetTagId((const char*)keyValue);
//.........这里部分代码省略.........
开发者ID:jojva,项目名称:libosmscout,代码行数:101,代码来源:PreprocessOSM.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ TagParameterList类代码示例发布时间:2022-05-31
下一篇:
C++ TagEntryPtrVector_t类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap