当前位置: 首页>>代码示例>>C++>>正文


C++ KeyValue::isDeleted方法代码示例

本文整理汇总了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;
    }
开发者ID:CadeLaRen,项目名称:MUSIC-1,代码行数:36,代码来源:Section.cpp

示例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;
		}
	}
}
开发者ID:dotminic,项目名称:actionaz,代码行数:25,代码来源:Section.cpp

示例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;
		}
//.........这里部分代码省略.........
开发者ID:CadeLaRen,项目名称:MUSIC-1,代码行数:101,代码来源:Writer.cpp


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