本文整理汇总了C++中KeyValue::isDeleted方法的典型用法代码示例。如果您正苦于以下问题:C++ KeyValue::isDeleted方法的具体用法?C++ KeyValue::isDeleted怎么用?C++ KeyValue::isDeleted使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KeyValue
的用法示例。
在下文中一共展示了KeyValue::isDeleted方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: deleteData
// MAPPED
//
bool Section::deleteData(const char *name)
{
// Since we are keeping deleted data in the d_allDataVector,
// multiple set/deletes will require lots of memory!!
//
if(name)
{
std::string myname=name;
KeyValue *mydata = d_kv_map[myname];
if(mydata)
{
// Remain in d_allDataVector, but as deleted
//
mydata->isDeleted(true);
// remove from keyvalue vector and map
//
std::vector<KeyValue*>::iterator iter;
for(iter = d_kv_vector.begin(); iter != d_kv_vector.end(); iter ++)
{
if( *iter == mydata )
{
d_kv_vector.erase(iter);
break;
}
}
d_kv_map.erase(myname);
return true;
}
}
return false;
}
示例2: setValue
// MAPPED
//
void Section::setValue(const char *name, const char *value)
{
if(name)
{
std::string myname=name;
KeyValue *mydata = d_kv_map[myname];
if(mydata)
{
mydata->setValue(value);
mydata->isDeleted(false);
}
else
{
KeyValue *newdata = new KeyValue();
newdata->setName(name);
newdata->setValue(value);
d_allDataVector.push_back(newdata);
d_kv_vector.push_back(newdata);
d_kv_map[myname] = newdata;
}
}
}
示例3: visitKeyValue
void Writer::visitKeyValue(const KeyValue& dataline) const
{
if(dataline.isDeleted() && ( !d_commentchar || !d_preservedeleted))
{
// Don't preserve deleted data when comments are null
// or we don't want to preserve them
return;
}
else
{
string key = dataline.getName();
string value = dataline.getValue();
string comment = dataline.getComment();
string commentchar(1,d_commentchar);
if(dataline.isDeleted())
{
// print the comment character
//
*d_outputstream << d_commentchar << " ";
}
if(key != "")
{
int position = 0;
size_t location;
// escape all backslashes
//
while( (location = key.find("\\", position)) != string::npos )
{
// location points right at the '\'
key.insert(location, "\\");
position = (int) location + 2;
}
// escape comment characters
// unless the comment character is a backslash, which we've already escaped....
//
if(d_commentchar && d_commentchar != '\\')
{
position = 0;
while( (location = key.find(commentchar, position)) != string::npos )
{
// location points right at the '"'
key.insert(location, "\\");
position = (int) location + 2;
}
}
// escape all delimiters, unless the delimiter is a backslash or the same as the comment, god forbid.
//
//
if(d_delimiter != '\\' && d_delimiter != d_commentchar)
{
if(d_delimiter)
{
string delimiter(1, d_delimiter);
position = 0;
while( (location = key.find(delimiter, position)) != string::npos )
{
// location points right at the '"'
key.insert(location, "\\");
position = (int) location + 2;
}
}
else
{
position = 0;
while( (location = key.find("\t", position)) != string::npos )
{
// location points right at the '"'
key.insert(location, "\\");
position = (int) location + 2;
}
position = 0;
while( (location = key.find(" ", position)) != string::npos )
{
// location points right at the '"'
key.insert(location, "\\");
position = (int) location + 2;
}
}
}
// print the key
//
*d_outputstream << key;
}
//.........这里部分代码省略.........