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


C++ KeyValue类代码示例

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


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

示例1: _consumeValue

void QuantumTSTaggedStringAttributeHandler::_consumeValue(const std::string& key,
                                                          const KeyValue& value) {
    consumeTSTaggedValue(key,
                         attribute,
                         value->getUInt64Value(ts_attribute),
                         value->getStringValue(attribute));
}
开发者ID:,项目名称:,代码行数:7,代码来源:

示例2: MR_kv_add_multi_dynamic

void MR_kv_add_multi_dynamic(void *KVptr, int n, 
           char *key, int *keybytes,
           char *value, int *valuebytes)
{
  KeyValue *kv = (KeyValue *) KVptr;
  kv->add(n,key,keybytes,value,valuebytes);
}
开发者ID:151706061,项目名称:VTK,代码行数:7,代码来源:cmapreduce.cpp

示例3: HandleKey

bool KeyboardControl::HandleKey(unsigned int keyCode)
{
	bool retVal = false;
	for (int o = 0; o < numObjects; o++)
	{
		KeyboardObject *obj = keyObjects[o];
		if (obj)
		{
			int numVars = obj->GetNumValues();
			for (int n = 0; n < numVars; n++)
			{
				KeyValue *key = obj->GetKeyValue(n);
				if (keyCode == key->GetKeyDecrease())
				{
					key->Decrement();
					retVal = true;
				}
				else if (keyCode == key->GetKeyIncrease())
				{
					key->Increment();
					retVal = true;
				}
			}
		}
	}
	return retVal;
}
开发者ID:ttrask,项目名称:staubliserver,代码行数:27,代码来源:KeyboardControl.cpp

示例4: 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

示例5: window

TextureSystem::TextureSystem(sf::RenderWindow& rw, entityx::EntityManager& entities, KeyValue& keys)
    : window(rw)
    , imageRenderEnabled(false)
    , randomTexturesEnabled(true)
    , positionTextEnabled(false)
    , entities(entities)
{
    /* This doesn't change. It maps the type shape to the vector of textures aviliable
     * under random texturing, or we use the first for no random textures */
    texturemap = {
        {    SpawnComponent::BOX, {&boxTextures,  conf::box_halfwidth*2}},
        { SpawnComponent::CIRCLE, {&ballTextures, conf::circle_radius*2}}
    };

    /* Textures for physics objects
     * `loadTextures` reads a key from an .ini consisting of colon-delimited
     * textures, and loads them into a vector */
    loadTextures(boxTextures,  keys.GetString("BOX_TEXTURES"));
    loadTextures(ballTextures, keys.GetString("BALL_TEXTURES"));

    //Load background texture and make it repeating
    bgTexture.loadFromFile(keys.GetString("BACKGROUND_TEXTURE"));
    bgTexture.setRepeated(true);
    bgSprite.setTexture(bgTexture);
    auto windsz = rw.getSize();
    bgSprite.setTextureRect(sf::IntRect(0, 0, windsz.x, windsz.y));

    //Font for displaying positions and other things
    boxFont.loadFromFile(keys.GetString("OBJECT_FONT"));
}
开发者ID:TehPwns,项目名称:SDL2D3,代码行数:30,代码来源:TextureSystem.cpp

示例6: getConnection

bool JPWiFly::getConnection(String& method, String& url, KeyValue& data) {
	String line;
	int8_t index = buffer.readToFirst_P(kProtocolMethodStrings, 3);
	if (index == -1)
		return false;
	method = prog_mem_string(kProtocolMethodStrings[index], 0, -1);
	if (!buffer.readTo_P(PSTR(" "), &url))
		return false;
	if (!buffer.readTo_P(kNewLineString))
		return false;
	
	while (true) {
		String key, value;
		int8_t index;
		if ((index = buffer.readToFirst_P(kColonNewLineStrings, 2, &key)) == -1)
			return false;
		if (index == 1)
			break;
		if (!buffer.readTo_P(kNewLineString, &value))
			return false;
		data.setValueForKey(key, value);
	}
	const String* content_length_str = data.valueForKey_P(PSTR("Content-Length"));
	if (!content_length_str)
		return true;
	int content_length = atoi(content_length_str->c_str());
	buffer.readNCharacters(content_length, &line);
	data.setValueForKey("", line);
	return true;
}
开发者ID:jasminlapalme,项目名称:JPWiFly,代码行数:30,代码来源:JPWiFly.cpp

示例7: operator

    void operator()(std::pair<GridClientVariant, GridClientVariant> pair) {
        KeyValue* keyValue = protoMap.add_entry();
        ObjectWrapper* key = keyValue->mutable_key();
        ObjectWrapper* value = keyValue->mutable_value();

        GridClientObjectWrapperConvertor::wrapSimpleType(pair.first, *key);
        GridClientObjectWrapperConvertor::wrapSimpleType(pair.second, *value);
    }
开发者ID:anujsrc,项目名称:gridgain,代码行数:8,代码来源:gridclientprotobufmarshaller.cpp

示例8: GetKeyValue

float KeyboardControl::GetMaxValue(const char *name)
{
	KeyValue *key = GetKeyValue(name);
	if (key)
		return key->GetMaxValue();
	else
		return 0.0f;
}
开发者ID:ttrask,项目名称:staubliserver,代码行数:8,代码来源:KeyboardControl.cpp

示例9:

const char *Section::getDataValueAt(int index) const
{
	KeyValue *kv = d_kv_vector[index];
	if(kv)
	{
		return kv->getValue();
	}
	return "";
}
开发者ID:dotminic,项目名称:actionaz,代码行数:9,代码来源:Section.cpp

示例10: CalcSignature

// https://developer.twitter.com
// /en/docs/basics/authentication/guides/creating-a-signature.html
std::string Network::CalcSignature(
	const std::string &http_method, const std::string &base_url,
	const KeyValue &oauth_param, const KeyValue &query_param,
	const std::string &consumer_secret, const std::string &token_secret)
{
	// "Collecting parameters"
	// percent encode しつつ合成してキーでソートする
	KeyValue param;
	auto encode_insert = [this, &param](const KeyValue &map) {
		for (const auto &entry : map) {
			param.emplace(Escape(entry.first), Escape(entry.second));
		}
	};
	encode_insert(oauth_param);
	encode_insert(query_param);
	// 文字列にする
	// key1=value1&key2=value2&...
	std::string param_str;
	bool is_first = true;
	for (const auto &entry : param) {
		if (is_first) {
			is_first = false;
		}
		else {
			param_str += '&';
		}
		param_str += entry.first;
		param_str += '=';
		param_str += entry.second;
	}

	// "Creating the signature base string"
	// 署名対象
	std::string base = http_method;
	base += '&';
	base += Escape(base_url);
	base += '&';
	base += Escape(param_str);

	// "Getting a signing key"
	// 署名鍵は consumer_secret と token_secret をエスケープして & でつなぐだけ
	std::string key = Escape(consumer_secret);
	key += '&';
	key += Escape(token_secret);

	// "Calculating the signature"
	ShaDigest signature;
	HmacSha1(
		key.data(), key.size(),
		reinterpret_cast<const unsigned char *>(base.data()), base.size(),
		signature);

	return Base64Encode(signature, sizeof(signature));
}
开发者ID:yappy,项目名称:DollsKit,代码行数:56,代码来源:net.cpp

示例11: setComment

// MAPPED
//
void Section::setComment(const char *name, const char *comment)
{
	if(name)
	{
		std::string myname=name;
		KeyValue *mydata = d_kv_map[myname];
		if(mydata)
		{
			mydata->setComment(comment);
		} 
	}
}
开发者ID:dotminic,项目名称:actionaz,代码行数:14,代码来源:Section.cpp

示例12: INFO

    void Config::init ()
    {
      if (Path::is_file (MRTRIX_SYS_CONFIG_FILE)) {
        INFO ("reading config file \"" MRTRIX_SYS_CONFIG_FILE "\"...");
        try {
          KeyValue kv (MRTRIX_SYS_CONFIG_FILE);
          while (kv.next()) {
            config[kv.key()] = kv.value();
          }
        }
        catch (...) { }
      }

      std::string path = Path::join (Path::home(), MRTRIX_USER_CONFIG_FILE);
      if (Path::is_file (path)) {
        INFO ("reading config file \"" + path + "\"...");
        try {
          KeyValue kv (path);
          while (kv.next()) {
            config[kv.key()] = kv.value();
          }
        }
        catch (...) { }
      }
    }
开发者ID:echohenry2006,项目名称:mrtrix3,代码行数:25,代码来源:config.cpp

示例13: return

IKeyValue * VectorKeyValue::get(int index)
{
	KeyValue *temp;
	temp = &(this->buffer[index]);
	temp->getKey();
	temp->getValue();
	temp->getvalues();
	return(temp);

	
	/*KeyValue *temp= new KeyValue();
	temp->setKey(this->buffer[index].getKey());
	temp->setValues(this->buffer[index].getvalues());
	return temp;*/
	//return(&(this->buffer[index]));
}
开发者ID:sahidesu25,项目名称:DataStructures,代码行数:16,代码来源:VectorKeyValue.cpp

示例14: reset

void LookupService::reset()
{
  MapIterator i;
  for (i = _maps.begin(); i != _maps.end(); i++) {
    KeyValueMap &kvmap = i->second;
    KeyValueMap::iterator it;
    for (it = kvmap.begin(); it != kvmap.end(); it++) {
      KeyValue *k = (KeyValue*)&(it->first);
      KeyValue *v = it->second;
      k->destroy();
      v->destroy();
      delete v;
    }
    kvmap.clear();
  }
  _maps.clear();
}
开发者ID:FrancoisAi,项目名称:dmtcp,代码行数:17,代码来源:lookup_service.cpp

示例15: CreateOAuthField

// https://developer.twitter.com
// /en/docs/basics/authentication/guides/authorizing-a-request
Network::KeyValue Network::CreateOAuthField(
	const std::string &consumer_key, const std::string &access_token)
{
	KeyValue param;

	// oauth_consumer_key: アプリの識別子
	param.emplace("oauth_consumer_key", consumer_key);

	// oauth_nonce: ランダム値
	// OAuth spec ではリプレイ攻撃対策との記述あり
	// 暗号学的安全性は要らない気もするが一応そうしておく
	// Twitter によるとランダムな英数字なら何でもいいらしいが、例に挙げられている
	// 32byte の乱数を BASE64 にして英数字のみを残したものとする
	std::array<uint8_t, 32> nonce;
	for (auto &b : nonce) {
		b = static_cast<uint8_t>(m_secure_rand());
	}
	std::string nonce_b64 = net.Base64Encode(&nonce, sizeof(nonce));
	std::string nonce_str;
	std::copy_if(nonce_b64.begin(), nonce_b64.end(),
		std::back_inserter(nonce_str),
		[](unsigned char c) { return std::isalnum(c); });
	param.emplace("oauth_nonce", nonce_str);

	// 署名は署名以外のフィールドに対しても行うので後で追加する
	// param.emplace("oauth_signature", sha1(...));

	param.emplace("oauth_signature_method", "HMAC-SHA1");
	param.emplace("oauth_timestamp", std::to_string(std::time(nullptr)));
	param.emplace("oauth_token", access_token);
	param.emplace("oauth_version", "1.0");

	return param;
}
开发者ID:yappy,项目名称:DollsKit,代码行数:36,代码来源:net.cpp


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