本文整理汇总了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));
}
示例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);
}
示例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;
}
示例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;
}
示例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"));
}
示例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;
}
示例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);
}
示例8: GetKeyValue
float KeyboardControl::GetMaxValue(const char *name)
{
KeyValue *key = GetKeyValue(name);
if (key)
return key->GetMaxValue();
else
return 0.0f;
}
示例9:
const char *Section::getDataValueAt(int index) const
{
KeyValue *kv = d_kv_vector[index];
if(kv)
{
return kv->getValue();
}
return "";
}
示例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, ¶m](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));
}
示例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);
}
}
}
示例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 (...) { }
}
}
示例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]));
}
示例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();
}
示例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;
}