本文整理汇总了C++中ValueArray类的典型用法代码示例。如果您正苦于以下问题:C++ ValueArray类的具体用法?C++ ValueArray怎么用?C++ ValueArray使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ValueArray类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: CheckValueMap
void CheckValueMap()
{
RLOG("------------------------------");
RLOG("CheckValueMap");
Value x = 123;
Value y = x;
ValueMap h;
h.Add("0", 123);
RDUMP(h["0"]);
h.Add("1", Date(2001, 12, 1));
h.Add("2", "test");
Value v = h;
ASSERT(v.GetCount() == 3);
RDUMP(v["0"]);
ASSERT(v["0"] == 123);
ASSERT(v["1"] == Date(2001, 12, 1));
ASSERT(v["2"] == "test");
ASSERT(IsValueMap(v));
ASSERT(IsValueArray(v));
ValueMap hh = v;
ASSERT(hh == h);
hh.Add(123, "foo");
ASSERT(hh.GetCount() == 4);
ASSERT(v.GetCount() == 3);
ASSERT(hh[123] == "foo");
ValueArray va = v;
ASSERT(va.GetCount() == 3);
ASSERT(va[0] == 123);
ASSERT(va[1] == Date(2001, 12, 1));
ASSERT(va[2] == "test");
}
开发者ID:guowei8412,项目名称:upp-mirror,代码行数:34,代码来源:Checks.cpp
示例2: test_set_diff
void test_set_diff(Ardb& db)
{
DBID dbid = 0;
db.SClear(dbid, "myset1");
db.SClear(dbid, "myset2");
db.SClear(dbid, "myset3");
db.SAdd(dbid, "myset1", "a");
db.SAdd(dbid, "myset1", "b");
db.SAdd(dbid, "myset1", "c");
db.SAdd(dbid, "myset1", "d");
db.SAdd(dbid, "myset2", "c");
db.SAdd(dbid, "myset3", "a");
db.SAdd(dbid, "myset3", "c");
db.SAdd(dbid, "myset3", "e");
std::string str;
SliceArray keys;
keys.push_back("myset1");
keys.push_back("myset2");
keys.push_back("myset3");
ValueArray values;
db.SDiff(dbid, keys, values);
CHECK_FATAL(values.size() != 2, "Sdiff failed:");
CHECK_FATAL(values.begin()->ToString(str) != "b", "Sdiff store failed:");
//CHECK_FATAL(FATAL, values[1] != "d") << "Sdiff store failed:";
int len = db.SDiffStore(dbid, "myset2", keys);
CHECK_FATAL(len != 2, "SDiffStore myset2 failed:%d", len);
len = db.SCard(dbid, "myset2");
CHECK_FATAL(len != 2, "SDiffStore myset2 failed:%d", len);
}
开发者ID:kouhate,项目名称:ardb,代码行数:30,代码来源:sets_testcase.cpp
示例3: test_set_inter
void test_set_inter(Ardb& db)
{
DBID dbid = 0;
db.SClear(dbid, "myset1");
db.SClear(dbid, "myset2");
db.SClear(dbid, "myset3");
db.SAdd(dbid, "myset1", "a");
db.SAdd(dbid, "myset1", "b");
db.SAdd(dbid, "myset1", "c");
db.SAdd(dbid, "myset1", "d");
db.SAdd(dbid, "myset2", "c");
db.SAdd(dbid, "myset3", "a");
db.SAdd(dbid, "myset3", "c");
db.SAdd(dbid, "myset3", "e");
SliceArray keys;
keys.push_back("myset1");
keys.push_back("myset2");
keys.push_back("myset3");
ValueArray values;
db.SInter(dbid, keys, values);
std::string str;
CHECK_FATAL( values.size() != 1, "Sinter failed:");
CHECK_FATAL(values.begin()->ToString(str) != "c", "Sinter store failed.");
db.SInterStore(dbid, "myset4", keys);
CHECK_FATAL( db.SCard(dbid, "myset4") != 1, "SInterStore myset4 failed");
}
开发者ID:kouhate,项目名称:ardb,代码行数:27,代码来源:sets_testcase.cpp
示例4:
Value Compiler::ExeArray::Eval(ExeContext& x) const
{
ValueArray va;
for(int i = 0; i < item.GetCount(); i++)
va.Add(item[i]->Eval(x));
return va;
}
开发者ID:AbdelghaniDr,项目名称:mirror,代码行数:7,代码来源:Exe.cpp
示例5: test_set_union
void test_set_union(Ardb& db)
{
DBID dbid = 0;
db.SClear(dbid, "myset1");
db.SClear(dbid, "myset2");
db.SClear(dbid, "myset3");
db.SAdd(dbid, "myset1", "a");
db.SAdd(dbid, "myset1", "b");
db.SAdd(dbid, "myset1", "c");
db.SAdd(dbid, "myset1", "d");
db.SAdd(dbid, "myset2", "c");
db.SAdd(dbid, "myset3", "a");
db.SAdd(dbid, "myset3", "c");
db.SAdd(dbid, "myset3", "e");
SliceArray keys;
keys.push_back("myset1");
keys.push_back("myset2");
keys.push_back("myset3");
ValueArray values;
db.SUnion(dbid, keys, values);
CHECK_FATAL(values.size() != 5, "SUnion failed:");
std::string str;
CHECK_FATAL( values.begin()->ToString(str) != "a", "SUnion store failed:");
db.SUnionStore(dbid, "myset2", keys);
CHECK_FATAL(db.SCard(dbid, "myset2") != 5, "SUnionStore myset2 failed:");
}
开发者ID:kouhate,项目名称:ardb,代码行数:27,代码来源:sets_testcase.cpp
示例6: Select
ValueArray Client::FetchResults(const CommitFilter& f) const {
SQLR * Select(SqlAll(RESULT),
DT, CMT, BRANCH,
UID, ToSqlVal(Regexp(PATH,data["SRC"])).As("FITS"))
.From(COMMITS)
.LeftJoin(RESULT).On(UID == CMT_UID && CLIENT_ID == data["ID"])
.Where(f)
.OrderBy(Descending(DT))
.Limit(f.offset, f.limit);
ValueArray res;
ValueMap vm;
Time t = GetUtcTime();
int maxage = int(data["MAX_AGE"])*24*60*60;
while(SQLR.Fetch(vm)){
SetComputedAttributes(vm);
SetDuration(vm, vm["STATUS"]);
if (IsNull(vm["STATUS"])) {
if (!vm["FITS"])
vm.Set("STATUSSTR", "Not interested");
else if (t-Time(vm["DT"]) > maxage)
vm.Set("STATUSSTR", "Too old");
else
vm.Set("STATUSSTR", "Ready");
}
res.Add(vm);
}
return res;
}
开发者ID:dolik-rce,项目名称:thewatchdog,代码行数:28,代码来源:Entity.cpp
示例7: UscMacros
void Ide::MacroMenu(Bar& menu)
{
const Array<IdeMacro>& mlist = UscMacros();
if(!mlist.IsEmpty() && menu.IsMenuBar()) {
VectorMap< String, Vector<int> > submenu_map;
for(int i = 0; i < mlist.GetCount(); i++) {
const IdeMacro& m = mlist[i];
if(!IsNull(m.menu)) {
if(IsNull(m.submenu))
submenu_map.GetAdd(Null).Add(i);
else
submenu_map.GetAdd(m.menu).Add(i);
}
}
if(!submenu_map.IsEmpty()) {
Vector<int> order = GetSortOrder(submenu_map.GetKeys());
for(int o = 0; o < order.GetCount(); o++) {
String m = submenu_map.GetKey(order[o]);
Vector<int>& mx = submenu_map[order[o]];
ValueArray va;
for(int i = 0; i < mx.GetCount(); i++)
va.Add(mx[i]);
if(!IsNull(m))
menu.Add(m, THISBACK1(EditMacroMenu, va));
else
EditMacroMenu(menu, va);
}
}
}
}
开发者ID:guowei8412,项目名称:upp-mirror,代码行数:30,代码来源:idebar.cpp
示例8: min
void ValueMap::Data::Jsonize(JsonIO& jio)
{
if(jio.IsStoring()) {
ValueArray va;
int n = min(value.GetCount(), key.GetCount());
for(int i = 0; i < n; i++) {
ValueMap m;
m.Add("key", StoreAsJsonValue(key[i]));
m.Add("value", StoreAsJsonValue(value[i]));
va.Add(m);
}
jio.Set(va);
}
else {
Value va = jio.Get();
key.Clear();
value.Clear();
for(int i = 0; i < va.GetCount(); i++) {
Value k, v;
LoadFromJsonValue(k, va[i]["key"]);
LoadFromJsonValue(v, va[i]["value"]);
key.Add(k);
value.Add(v);
}
}
}
开发者ID:AbdelghaniDr,项目名称:mirror,代码行数:26,代码来源:ValueUtil.cpp
示例9: EscFromStdValue
EscValue EscFromStdValue(const Value& v)
{
EscValue r;
Time t;
if(!IsNull(v))
switch(v.GetType()) {
case BOOL_V:
case INT_V:
case INT64_V:
case DOUBLE_V:
r = (double)v;
break;
case STRING_V:
case WSTRING_V:
r = (WString)v;
break;
case TIME_V:
t = v;
r.MapSet("hour", t.hour);
r.MapSet("minute", t.minute);
r.MapSet("second", t.second);
case DATE_V:
t = v;
r.MapSet("year", t.year);
r.MapSet("month", t.month);
r.MapSet("day", t.day);
break;
case VALUEARRAY_V:
ValueArray va = v;
r.SetEmptyArray();
for(int i = 0; i < va.GetCount(); i++)
r.ArrayAdd(EscFromStdValue(va[i]));
}
return r;
}
开发者ID:ultimatepp,项目名称:mirror,代码行数:35,代码来源:Value.cpp
示例10: ParseXmlRpcParams
ValueArray ParseXmlRpcParams(XmlParser& p)
{
ValueArray va;
if(p.Tag("params"))
while(!p.End())
va.Add(ParseXmlRpcParam(p));
return va;
}
开发者ID:guowei8412,项目名称:upp-mirror,代码行数:8,代码来源:Xml.cpp
示例11: ValueArray
CountPtr<Value> ValueArray::iterator(void) const
{
ValueArray* tmp = new ValueArray();
tmp->m_val = m_val;
tmp->resetIterator();
return CountPtr<Value>(tmp);
}
开发者ID:sdasgup3,项目名称:gri,代码行数:9,代码来源:valuearray.cpp
示例12:
ValueArray Sql::operator/(const SqlStatement& q)
{
ValueArray va;
Execute(q);
ValueMap m;
while(Fetch(m))
va.Add(m);
return va;
}
开发者ID:ultimatepp,项目名称:mirror,代码行数:9,代码来源:Sql.cpp
示例13: ParseArray
/**
* parse the special value "array". this method parses the complexer value "array" and returns it
* @param p XmlParser holding the xml document
* @return the parsed array as Value (not ValueArray!)
*/
Value XmlRpcParser::ParseArray(XmlParser& p) {
ValueArray va;
p.PassTag("data");
while(!p.End()) {
Value v = Parse(p);
va.Add(v);
}
return Value(va);
}
开发者ID:dreamsxin,项目名称:ultimatepp,代码行数:14,代码来源:XmlRpcParser.cpp
示例14: Format
Value FormatConvert::Format(const Value& v) const
{
ValueArray va;
if(IsValueArray(v))
va = v;
else
va.Add(v);
return UPP::Format(format, va.Get());
}
开发者ID:AbdelghaniDr,项目名称:mirror,代码行数:9,代码来源:Convert.cpp
示例15: selfTemplateArgs
ValueArray Alias::selfTemplateArgs() const {
ValueArray templateArgs;
templateArgs.reserve(templateVariables().size());
for (const auto templateVar: templateVariables()) {
// Refer to the template variables of this type alias.
templateArgs.push_back(templateVar->selfRefValue());
}
return templateArgs;
}
开发者ID:PuerkitoBio,项目名称:locic,代码行数:11,代码来源:Alias.cpp
示例16: FormatXmlRpcValue
String FormatXmlRpcValue(const Value& _v)
{
String r;
Value v = _v;
if(v.GetType() == INT64_V) {
int64 x = v;
if((int)x == x)
v = (int)x;
}
if(IsNull(v) && !IsString(v) && !IsValueArray(v))
r = XmlTag("nil")();
else
if(v.GetType() == INT_V)
r = XmlTag("int")(Format("%d", (int)v));
else
if(v.GetType() == BOOL_V)
r = XmlTag("boolean")(AsString((int)(bool)v));
else
if(IsNumber(v))
r = XmlTag("double")(Format("%.16g", (double)v));
else
if(IsDateTime(v)) {
Time t = v;
r = XmlTag("dateTime.iso8601")
(Format("%04.4d%02.2d%02.2d`T%02.2d`:%02.2d`:%02.2d",
t.year, t.month, t.day, t.hour, t.minute, t.second));
}
else
if(v.GetType() == VALUEMAP_V) {
r = "<struct>";
ValueMap vm = v;
const Index<Value>& k = vm.GetKeys();
ValueArray va = vm.GetValues();
for(int i = 0; i < k.GetCount(); i++)
r << XmlTag("member")(XmlTag("name")(k[i]) + FormatXmlRpcValue(va[i]));
r << "</struct>";
}
else
if(v.GetType() == VALUEARRAY_V) {
r = "<array><data>";
ValueArray va = v;
for(int i = 0; i < va.GetCount(); i++)
r << FormatXmlRpcValue(va[i]);
r << "</data></array>";
}
else
if(v.Is<RawJsonText>())
r = XmlTag("string").Text(v.To<RawJsonText>().json);
else
r = XmlTag("string").Text(v);
return XmlTag("value")(r);
}
开发者ID:guowei8412,项目名称:upp-mirror,代码行数:52,代码来源:Xml.cpp
示例17: ParseJSON
NAMESPACE_UPP
Value ParseJSON(CParser& p)
{
p.UnicodeEscape();
if(p.IsDouble())
return p.ReadDouble();
if(p.IsString()) {
bool dt = p.IsChar2('\"', '\\');
String s = p.ReadString();
if(dt) {
CParser p(s);
if(p.Char('/') && p.Id("Date") && p.Char('(') && p.IsInt()) {
int64 n = p.ReadInt64();
if(!IsNull(n))
return Time(1970, 1, 1) + n / 1000;
}
}
return s;
}
if(p.Id("null"))
return Null;
if(p.Id("true"))
return true;
if(p.Id("false"))
return false;
if(p.Char('{')) {
ValueMap m;
while(!p.Char('}')) {
String key = p.ReadString();
p.PassChar(':');
m.Add(key, ParseJSON(p));
if(p.Char('}')) // Stray ',' at the end of list is allowed...
break;
p.PassChar(',');
}
return m;
}
if(p.Char('[')) {
ValueArray va;
while(!p.Char(']')) {
va.Add(ParseJSON(p));
if(p.Char(']')) // Stray ',' at the end of list is allowed...
break;
p.PassChar(',');
}
return va;
}
p.ThrowError("Unrecognized JSON element");
return Null;
}
开发者ID:kolyden,项目名称:mirror,代码行数:51,代码来源:JSON.cpp
示例18: test_set_member
void test_set_member(Ardb& db)
{
DBID dbid = 0;
std::string str;
db.SClear(dbid, "myset");
db.SAdd(dbid, "myset", "v1");
db.SAdd(dbid, "myset", "v2");
db.SAdd(dbid, "myset", "v3");
CHECK_FATAL(db.SIsMember(dbid, "myset", "v0") != false,
"SIsMember myset failed:");
ValueArray members;
db.SMembers(dbid, "myset", members);
CHECK_FATAL( members.size() != 3, "SMembers myset failed:");
CHECK_FATAL( members[0].ToString(str) != "v1", "SMembers myset failed:");
}
开发者ID:ericcapricorn,项目名称:ardb,代码行数:15,代码来源:sets_testcase.cpp
示例19:
inline bool operator==(const ValueArray& x, const ValueArray& y)
{
if (x.size() != y.size())
{
return false;
}
for (uint32 i = 0; i < x.size(); i++)
{
if (x[i].Compare(y[i]) != 0)
{
return false;
}
}
return true;
}
开发者ID:ericcapricorn,项目名称:ardb,代码行数:15,代码来源:ardb_data.hpp
示例20: OnPrivateChatUserListReceived
void CAniClientConnection::OnPrivateChatUserListReceived( int iChatID, ValueArray<int>& arUsers )
{
ASSERT( m_pDialog );
CDlgUserList* pChat = m_pDialog->CreateChatWindow( iChatID );
for ( int iUser = 0; iUser < arUsers.GetSize( ); iUser++ )
AddUserToPrivateChat( pChat, arUsers[ iUser ] );
}
开发者ID:Schala,项目名称:AniClient,代码行数:7,代码来源:AniClientConnection.cpp
注:本文中的ValueArray类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论