本文整理汇总了C++中DynamicObject::reverse方法的典型用法代码示例。如果您正苦于以下问题:C++ DynamicObject::reverse方法的具体用法?C++ DynamicObject::reverse怎么用?C++ DynamicObject::reverse使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DynamicObject
的用法示例。
在下文中一共展示了DynamicObject::reverse方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: _setDecodedParam
static bool _setDecodedParam(
Statement* s, unsigned int index,
DynamicObject& param, DynamicObject& value)
{
bool rval = true;
if(param->hasMember("encode"))
{
// FIXME: could use streams here and handle types other than string,
// but the DatabaseClient API might be abandoned before this actually
// ever really gets used to that extent
// fill byte buffer with initial data
ByteBuffer b;
b.put(value->getString(), value->length(), true);
// apply each decoding
// FIXME: optimize this by doing it once and storing it when
// defining the schema
DynamicObject decode = param["encode"].clone();
decode->reverse();
DynamicObjectIterator i = decode.getIterator();
while(rval && i->hasNext())
{
const char* type = i->next()->getString();
// convert hex to binary
if(strcmp(type, "hex") == 0)
{
const char* hex = b.bytes();
unsigned int len = b.length();
unsigned int binLen = (len >> 1) + 1;
char bin[binLen];
rval = Convert::hexToBytes(hex, len, bin, binLen);
if(rval)
{
b.clear();
b.put(bin, binLen, true);
}
}
}
// only blobs are supported at the moment
rval = rval && s->setBlob(index, b.bytes(), b.length());
}