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

C++ Tags类代码示例

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

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



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

示例1: uni

void PertyRemoveTagVisitor::visit(const shared_ptr<Element>& e)
{
  boost::uniform_real<> uni(0.0, 1.0);

  Tags t = e->getTags();
  for (Tags::const_iterator it = t.constBegin(); it != t.constEnd(); ++it)
  {
    const QString tagKey = it.key();
    if (uni(*_rng) <= _p && !_exemptTagKeys.contains(tagKey))
    {
      if (!_replacementTagKeys.contains(tagKey))
      {
        LOG_DEBUG("Removing tag with key: " << tagKey << " ...");
        e->getTags().remove(tagKey);
      }
      else
      {
        const int tagIndex = _replacementTagKeys.indexOf(tagKey);
        const QString tagValue = _replacementTagValues.at(tagIndex);
        LOG_DEBUG("Substituting value: " << tagValue << " for tag with key: " << tagKey);
        e->getTags().set(tagKey, tagValue);
      }
    }
  }
}
开发者ID:giserh,项目名称:hootenanny,代码行数:25,代码来源:PertyRemoveTagVisitor.cpp


示例2: writeElement

void OgrWriter::writeElement(ElementPtr &element, bool debug)
{
  //Unfortunately, this check also has to happen in addition to checking hasMoreElements.  See
  //explanation in ServicesDbReader::readNextElement.
  if (element.get())
  {
    Tags sourceTags = element->getTags();
    Tags destTags;
    for (Tags::const_iterator it = element->getTags().begin();
         it != element->getTags().end(); ++it)
    {
      if (sourceTags[it.key()] != "")
      {
        destTags.appendValue(it.key(), it.value());
      }
    }
    // Now that all the empties are gone, update our element
    element->setTags(destTags);

    if ( debug == true )
    {
      LOG_DEBUG(element->toString());
    }

    PartialOsmMapWriter::writePartial(element);
  }
}
开发者ID:digideskio,项目名称:hootenanny,代码行数:27,代码来源:OgrWriter.cpp


示例3: GetOutputBuffer

//------------------------------------------------------------------------------------------------------------------------------------
// Helper for ErrorMessenger.
//------------------------------------------------------------------------------------------------------------------------------------
LogMgr::ErrorDialogResult LogMgr::Error(const std::string& errorMessage, bool isFatal, const char* funcName, const char* sourceFile, unsigned int lineNum)
{
	string tag = ((isFatal) ? ("FATAL") : ("ERROR"));

	// buffer for our final output string
	string buffer;
	GetOutputBuffer(buffer, tag, errorMessage, funcName, sourceFile, lineNum);

	// write the final buffer to all the various logs
	m_tagCriticalSection.Lock();
	Tags::iterator findIt = m_tags.find(tag);
	if (findIt != m_tags.end())
		OutputFinalBufferToLogs(buffer, findIt->second);
	m_tagCriticalSection.Unlock();

    // show the dialog box
    int result = ::MessageBoxA(NULL, buffer.c_str(), tag.c_str(), MB_ABORTRETRYIGNORE|MB_ICONERROR|MB_DEFBUTTON3);

	// act upon the choice
	switch (result)
	{
		case IDIGNORE : return LogMgr::LOGMGR_ERROR_IGNORE;
		case IDABORT  : __debugbreak(); return LogMgr::LOGMGR_ERROR_RETRY;  // assembly language instruction to break into the debugger
		case IDRETRY :	return LogMgr::LOGMGR_ERROR_RETRY;
		default :       return LogMgr::LOGMGR_ERROR_RETRY;
	}
}
开发者ID:AsbjoernS,项目名称:gamecode4,代码行数:30,代码来源:Logger.cpp


示例4: toTags

ItemTagsLoader::Tags ItemTagsLoader::toTags(const QStringList &tagList)
{
    Tags tags;

    for (const auto &tagText : tagList) {
        QString tagName = tagText.trimmed();
        Tag tag = findMatchingTag(tagName, m_tags);

        if (isTagValid(tag)) {
            if (tag.match.isEmpty()) {
                tag.name = tagName;
            } else {
                const QRegExp re(tag.match);
                tag.name = QString(tagName).replace(re, tag.name);
            }
        } else {
            tag.name = tagName;

            // Get default tag style from theme.
            const QSettings settings;
            tag.color = settings.value("Theme/num_fg").toString();
        }

        tags.append(tag);
    }

    return tags;
}
开发者ID:amosbird,项目名称:CopyQ,代码行数:28,代码来源:itemtags.cpp


示例5: runEscapeTags

  void runEscapeTags()
  {
    OsmMapPtr map(new OsmMap());
    Coordinate coords[] = { Coordinate(0, 0), Coordinate(0, 1), Coordinate(1, 1), Coordinate(1, 0), Coordinate::getNull() };
    Tags tags;
    tags.set("note", "<2>");
    tags.set("aerialway", "t-bar");
    tags.set("first name", "first name goes here");
    tags.set("full_name", "\"Hacksaw\" Jim Duggan");
    WayPtr way = TestUtils::createWay(map, Status::Unknown1, coords);
    way->setTags(tags);

    QList<ElementPtr> nodes;
    NodePtr node1(new Node(Status::Unknown1, map->createNextNodeId(), Coordinate(0.0, 0.1), 15));
    node1->getTags().appendValue("name", "test1");
    nodes.append(node1);

    NodePtr node2(new Node(Status::Unknown1, map->createNextNodeId(), Coordinate(0.1, 0.0), 15));
    node2->getTags().appendValue("name", "test2");
    nodes.append(node2);

    RelationPtr relation = TestUtils::createRelation(map, nodes);
    relation->setType("review");
    relation->getTags().appendValue("name", "Test Review");
    std::vector<RelationData::Entry> members = relation->getMembers();
    members[0].role = "reviewee";
    members[1].role = "reviewee";
    relation->setMembers(members);

    QString output = OsmPgCsvWriter::toString(map);
    //  Compare the results
    HOOT_STR_EQUALS(expected_runEscapeTags, output);
  }
开发者ID:ngageoint,项目名称:hootenanny,代码行数:33,代码来源:OsmPgCsvWriterTest.cpp


示例6: _addNonConflictingTags

void TagComparator::_addNonConflictingTags(Tags& t1, const Tags& t2, Tags& result)
{
  OsmSchema& schema = OsmSchema::getInstance();

  // we're deleting as we iterate so be careful making changes.
  for (Tags::iterator it1 = t1.begin(); it1 != t1.end(); )
  {
    QString kvp1 = it1.key() + "=" + it1.value();
    bool conflict = false;
    for (Tags::const_iterator it2 = t2.begin(); it2 != t2.end(); ++it2)
    {
      QString kvp2 = it2.key() + "=" + it2.value();
      if (schema.score(kvp1, kvp2) > 0.0)
      {
        conflict = true;
        break;
      }
    }

    if (conflict)
    {
      ++it1;
    }
    else
    {
      result[it1.key()] = it1.value();
      t1.erase(it1++);
    }
  }
}
开发者ID:bpross-52n,项目名称:hootenanny,代码行数:30,代码来源:TagComparator.cpp


示例7: _overwriteUnrecognizedTags

void TagComparator::_overwriteUnrecognizedTags(Tags& t1, Tags& t2, Tags& result)
{
  OsmSchema& schema = OsmSchema::getInstance();

  const Tags t1Copy = t1;
  for (Tags::ConstIterator it1 = t1Copy.begin(); it1 != t1Copy.end(); ++it1)
  {
    // if this is an unknown type
    if (schema.getTagVertex(it1.key() + "=" + it1.value()).isEmpty() &&
        schema.getTagVertex(it1.key()).isEmpty())
    {
      // if this is also in t2.
      if (t2.contains(it1.key()))
      {
        result[it1.key()] = it1.value();
        t1.remove(it1.key());
        t2.remove(it1.key());
      }
    }
  }

  // go through any remaining tags in t2
  const Tags t2Copy = t2;
  for (Tags::ConstIterator it2 = t2Copy.begin(); it2 != t2Copy.end(); ++it2)
  {
    // if this is an unknown type
    if (schema.getTagVertex(it2.key() + "=" + it2.value()).isEmpty())
    {
      // we know it isn't in t1, or it would have been handled in the above loop so just deal with
      // t2
      t2.remove(it2.key());
      result[it2.key()] = it2.value();
    }
  }
}
开发者ID:bpross-52n,项目名称:hootenanny,代码行数:35,代码来源:TagComparator.cpp


示例8: fn

bool ExportMultiple::DoExport(bool stereo,
                              wxString name,
                              bool selectedOnly,
                              double t0,
                              double t1,
                              int trackNumber)
{
   wxFileName fn(mDir->GetValue(), name, mPlugins[mFormatIndex]->GetExtension());

   // Generate a unique name if we're not allowed to overwrite
   if (!mOverwrite->GetValue()) {
      int i = 2;
      while (fn.FileExists()) {
         fn.SetName(wxString::Format(wxT("%s-%d"), name.c_str(), i++));
      }
   }

   // If the format supports tags, then set the name and track number
   if (mPlugins[mFormatIndex]->GetCanMetaData()) {
      Tags *tags = mProject->GetTags();
      tags->SetTitle(name);
      tags->SetTrackNumber(trackNumber);
   }

   // Call the format export routine
   return mPlugins[mFormatIndex]->Export(mProject,
                                         stereo ? 2 : 1,
                                         fn.GetFullPath(),
                                         selectedOnly,
                                         t0,
                                         t1);
}
开发者ID:ruthmagnus,项目名称:audacity,代码行数:32,代码来源:ExportMultiple.cpp


示例9: getMostEnglishName

QString MostEnglishName::getMostEnglishName(const Tags& tags)
{
  if (tags.contains("name:en") && tags.get("name:en").isEmpty() == false)
  {
    return tags.get("name:en");
  }

  QStringList names = tags.getNames();

  double bestScore = -numeric_limits<double>::max();
  QString bestName;

  for (int i = 0; i < names.size(); i++)
  {
    double score = scoreName(names[i]);

    if (score > bestScore)
    {
      bestScore = score;
      bestName = names[i];
    }
  }

  return bestName;
}
开发者ID:ngageoint,项目名称:hootenanny,代码行数:25,代码来源:MostEnglishName.cpp


示例10: ElementConverter

void TranslatedTagCountVisitor::visit(ElementType type, long id)
{
  shared_ptr<const Element> e = _map->getElement(type, id);

  if (e->getTags().getInformationCount() > 0)
  {
    shared_ptr<Geometry> g = ElementConverter(_map->shared_from_this()).convertToGeometry(e);

    Tags t = e->getTags();
    t["error:circular"] = QString::number(e->getCircularError());
    t["hoot:status"] = e->getStatusString();

    // remove all the empty tags.
    for (Tags::const_iterator it = e->getTags().begin(); it != e->getTags().end(); ++it)
    {
      if (t[it.key()] == "")
      {
        t.remove(it.key());
      }
    }

    QString layerName;
    vector<ScriptToOgrTranslator::TranslatedFeature> f = _translator->translateToOgr(t,
      e->getElementType(), g->getGeometryTypeId());

    // only write the feature if it wasn't filtered by the translation script.
    for (size_t i = 0; i < f.size(); i++)
    {
      _countTags(f[i].feature);
    }
  }
}
开发者ID:mitulvpatel,项目名称:hootenanny,代码行数:32,代码来源:TranslatedTagCountVisitor.cpp


示例11: person_ref

void TestTags::test_item_tags_model() {
	Tags tags;
	tags.append("Work");
	tags.append("Home");

	Person *person = new Person;
	person->setName("Moe stein");
	person->save();

	RelationalObjectRef person_ref(person);
	RelationalObjectRef tag1 = tags.getObjectRef(0);
	RelationalObjectRef tag2 = tags.getObjectRef(1);

	ItemTags *item_tags = tags.itemTagsModelFactory(person_ref);

	item_tags->tag(tag1);
	QCOMPARE(item_tags->rowCount(), 1);

	item_tags->untag(tag2);
	QCOMPARE(item_tags->rowCount(), 1);

	item_tags->tag(tag2);
	QCOMPARE(item_tags->rowCount(), 2);

	item_tags->untag(tag1);
	QCOMPARE(item_tags->rowCount(), 1);

	item_tags->untag(tag2);
	QCOMPARE(item_tags->rowCount(), 0);

	delete item_tags;
	delete person;
}
开发者ID:Jellofishi,项目名称:JBLib2,代码行数:33,代码来源:test_tags.cpp


示例12: parseTags

    inline Tags parseTags(DBFHandle dbfFile, int k) const
    {
        char title[12];
        int fieldCount = DBFGetFieldCount(dbfFile);
        Tags tags;
        tags.reserve(fieldCount);
        for (int i = 0; i < fieldCount; i++)
        {
            if (DBFIsAttributeNULL(dbfFile, k, i))
                continue;

            utymap::formats::Tag tag;
            int width, decimals;
            DBFFieldType eType = DBFGetFieldInfo(dbfFile, i, title, &width, &decimals);
            tag.key = std::string(title);
            {
                switch (eType)
                {
                    case FTString:
                        tag.value = DBFReadStringAttribute(dbfFile, k, i);
                        break;
                    case FTInteger:
                        tag.value = to_string(DBFReadIntegerAttribute(dbfFile, k, i));
                        break;
                    case FTDouble:
                        tag.value = to_string(DBFReadDoubleAttribute(dbfFile, k, i));
                        break;
                    default:
                        break;
                }
            }
            tags.push_back(tag);
        }
        return std::move(tags);
    }
开发者ID:Euphe,项目名称:utymap,代码行数:35,代码来源:ShapeParser.hpp


示例13: _addExtraNames

void SplitNameVisitor::_addExtraNames(Tags& t, const QStringList& extraNames)
{
    int lastNameId = -1;
    int size = 0;
    QStringList names;

    for (int i = 0; i < extraNames.size(); i++)
    {
        int thisSize = extraNames[i].size();
        if (size + thisSize > _maxSize)
        {
            lastNameId = _getNextNameId(t, lastNameId);
            QString k = QString("name:%1").arg(lastNameId);
            t.setList(k, names);
            names.clear();
            size = 0;
        }

        names.append(extraNames[i]);
        size += thisSize + 1;
    }

    if (names.size() > 0)
    {
        lastNameId = _getNextNameId(t, lastNameId);
        QString k = QString("name:%1").arg(lastNameId);
        t.setList(k, names);
    }
}
开发者ID:mitulvpatel,项目名称:hootenanny,代码行数:29,代码来源:SplitNameVisitor.cpp


示例14: SelectedItems

Tags List::SelectedItems(int group) const {

	Tags selItems;

	for (ListItems::const_iterator i = items.begin(); i != items.end(); ++i)
		if ((i->state == litPressed) && (i->group & group))
			selItems.push_back(i->tag);

	return selItems;
}
开发者ID:bcace,项目名称:ochre,代码行数:10,代码来源:list.cpp


示例15: _mergeText

void TagComparator::_mergeText(Tags& t1, Tags& t2, Tags& result)
{
  OsmSchema& schema = OsmSchema::getInstance();

  const Tags t1Copy = t1;
  for (Tags::ConstIterator it1 = t1Copy.begin(); it1 != t1Copy.end(); ++it1)
  {
    const SchemaVertex& tv = schema.getTagVertex(it1.key());

    // if this is a text field and it exists in both tag sets.
    if (tv.valueType == Text && t2.contains(it1.key()))
    {
      // only keep the unique text fields
      QStringList values = t1.getList(it1.key());
      values.append(t2.getList(it1.key()));

      // append all unique values in the existing order.
      for (int i = 0; i < values.size(); i++)
      {
        if (values[i].isEmpty() == false)
        {
          result.appendValueIfUnique(it1.key(), values[i]);
        }
      }

      t1.remove(it1.key());
      t2.remove(it1.key());
    }
  }
}
开发者ID:bpross-52n,项目名称:hootenanny,代码行数:30,代码来源:TagComparator.cpp


示例16: HootException

void OgrWriter::_writePartial(ElementProviderPtr& provider, const ConstElementPtr& e)
{
  if (_translator.get() == 0)
  {
    throw HootException("You must call open before attempting to write.");
  }

  if (e->getTags().getInformationCount() > 0)
  {
    // There is probably a cleaner way of doing this.
    // convertToGeometry calls  getGeometryType which will throw an exception if it gets a relation
    // that it doesn't know about. E.g. "route", "superroute", " turnlanes:turns" etc

    shared_ptr<Geometry> g;

    try
    {
      g = ElementConverter(provider).convertToGeometry(e);
    }
    catch (IllegalArgumentException& err)
    {
      LOG_WARN("Error converting geometry: " << err.getWhat() << " (" << e->toString() << ")");
      g.reset((GeometryFactory::getDefaultInstance()->createEmptyGeometry()));
    }

    /*
    LOG_DEBUG("After conversion to geometry, element is now a " <<
             g->getGeometryType() );
    */

    Tags t = e->getTags();
    t["error:circular"] = QString::number(e->getCircularError());
    t["hoot:status"] = e->getStatusString();
    for (Tags::const_iterator it = e->getTags().begin(); it != e->getTags().end(); ++it)
    {
      if (t[it.key()] == "")
      {
        t.remove(it.key());
      }
    }

    vector<ScriptToOgrTranslator::TranslatedFeature> tf = _translator->translateToOgr(t,
      e->getElementType(), g->getGeometryTypeId());

    // only write the feature if it wasn't filtered by the translation script.
    for (size_t i = 0; i < tf.size(); i++)
    {
      OGRLayer* layer = _getLayer(tf[i].tableName);
      if (layer != 0)
      {
        _addFeature(layer, tf[i].feature, g);
      }
    }
  }
}
开发者ID:giserh,项目名称:hootenanny,代码行数:55,代码来源:OgrWriter.cpp


示例17: untag

	void ItemTags::untag(RelationalObjectRef tag) {
		if (not m_item.isValid())
			throw new InvalidObjectReference;

		Tags *tags = dynamic_cast<Tags*>(QObject::parent());

		if (tags == NULL)
			throw new NoTaggingEngine;

		tags->untag(m_item, tag);
	}
开发者ID:Jellofishi,项目名称:JBLib2,代码行数:11,代码来源:itemtags.cpp


示例18: Log

void LogManager::Log(const std::string& tag, const std::string& msg, const char* funcName, const char* fileName, unsigned int lineNum) 
{
	m_CritSection.Lock();
	Tags::iterator findIt = m_Tags.find(tag);
	if (findIt != m_Tags.end())
	{
		std::string buffer;
		GetOutputBuffer(buffer, tag, msg, funcName, fileName, lineNum);
		OutputBufferToLogs(buffer, findIt->second);
	}
	m_CritSection.Unlock();
}
开发者ID:Hesh0,项目名称:Sabre3D,代码行数:12,代码来源:Logger.cpp


示例19: main

int main() {

    string dir,title;
    Equip_Necessary b;
    cout<<" \n *** ALANG CONVERTER ***\n";
    cout<<"\n\n\nEnter Alang file path: ";
    string path;
    cin>>path;
    cout<<"\nEnter Website Title: ";
    cin>>title;
    cout<<"\nWhere do you Want to Create the Website Directory? (Eg: C:\\Test) :  ";
    cin>>dir;
    b.create(dir);
    ofstream file;
    file.open("Index.html", ios:: out);
    string str,str1,str2,str3;

    provide_htmlcss a;
    str1=a.header(title);
    str2=a.footer();

    /* Aniruddha's content goes here */
    string text=getinputandsend(path);
    /*char *c=new char[text.size()+1];
    memcpy(c,text.c_str(),text.size());*/
    char *ch=&text[0] ;

    //char st[]="#1Head one\nThis is a paragraph with *bold*`code` and ~italics~\n ";
    string s="";
    Tags t;
    int i=0;
    while(i<sizeof(text)){
            s+=t.start_s(ch,i);
    }

    str=str1+s+str2;                                     //+str3 - Body Contents
    file<<str;
    //file<<Body Contents of Index.html from Aniruddha//
    /*The Following code relates to the css style append fn alone*/
    ofstream file1;
    string style="/* Style.css Generated by ALANG */";      //style string passes all the code
    file1.open("style.css", ios::out);                     //relatd to style.css
    a.File_append(style,file1);
    file1.close();
    cout<<dir;
    move_file(dir, file);
    file.close();


}
开发者ID:adityah1,项目名称:AAA,代码行数:50,代码来源:all.cpp


示例20: visit

void KeepTagsVisitor::visit(const shared_ptr<Element>& e)
{
  //get a copy of the tags for modifying
  Tags tags;
  tags.addTags(e->getTags());
  for (Tags::const_iterator it = e->getTags().begin(); it != e->getTags().end(); ++it)
  {
    if (!_keys.contains(it.key()))
    {
      tags.remove(it.key());
    }
  }
  e->setTags(tags);
}
开发者ID:Nanonid,项目名称:hootenanny,代码行数:14,代码来源:KeepTagsVisitor.cpp



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ TaintedTrace类代码示例发布时间:2022-05-31
下一篇:
C++ TagStack类代码示例发布时间: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