本文整理汇总了C++中TagMap::insert方法的典型用法代码示例。如果您正苦于以下问题:C++ TagMap::insert方法的具体用法?C++ TagMap::insert怎么用?C++ TagMap::insert使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TagMap
的用法示例。
在下文中一共展示了TagMap::insert方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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;
}
示例2: 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);
}
}