XmlRpc: Extended to deal with Array/Vector/ArrayMap/VectorMap of xmlrpc compatible structures (thanks zsolt)

git-svn-id: svn://ultimatepp.org/upp/trunk@3341 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
cxl 2011-04-14 08:02:39 +00:00
parent bbc2ef5b80
commit 35dbcfbd92

View file

@ -108,12 +108,20 @@ void ValuePut(Value& v, const Value& t);
void ValuePut(Value& v, const ValueArray& va);
void ValuePut(Value& v, const ValueMap& vm);
template <class T>
Value AsXmlRpcValue(const T& x)
{
Value vs;
ValuePut(vs, x);
return vs;
}
template <class T>
void ValuePut(Value& v, const Array<T>& x)
{
ValueArray va;
for(int i = 0; i < x.GetCount(); i++)
va.Add(x[i]);
va.Add(AsXmlRpcValue(x[i]));
v = va;
}
@ -122,7 +130,7 @@ void ValuePut(Value& v, const Vector<T>& x)
{
ValueArray va;
for(int i = 0; i < x.GetCount(); i++)
va.Add(x[i]);
va.Add(AsXmlRpcValue(x[i]));
v = va;
}
@ -132,7 +140,7 @@ void ValuePut(Value& v, const ArrayMap<String, T>& x)
ValueMap vm;
for(int i = 0; i < x.GetCount(); i++)
if(!x.IsUnlinked(i))
vm.Add(x.GetKey(i), x[i]);
vm.Add(x.GetKey(i), AsXmlRpcValue(x[i]));
v = vm;
}
@ -142,7 +150,7 @@ void ValuePut(Value& v, const VectorMap<String, T>& x)
ValueMap vm;
for(int i = 0; i < x.GetCount(); i++)
if(!x.IsUnlinked(i))
vm.Add(x.GetKey(i), x[i]);
vm.Add(x.GetKey(i), AsXmlRpcValue(x[i]));
v = vm;
}
@ -152,7 +160,7 @@ void ValuePut(Value& v, const ArrayMap<int, T>& x)
ValueMap vm;
for(int i = 0; i < x.GetCount(); i++)
if(!x.IsUnlinked(i))
vm.Add(AsString(x.GetKey(i)), x[i]);
vm.Add(AsString(x.GetKey(i)), AsXmlRpcValue(x[i]));
v = vm;
}
@ -162,7 +170,7 @@ void ValuePut(Value& v, const VectorMap<int, T>& x)
ValueMap vm;
for(int i = 0; i < x.GetCount(); i++)
if(!x.IsUnlinked(i))
vm.Add(AsString(x.GetKey(i)), x[i]);
vm.Add(AsString(x.GetKey(i)), AsXmlRpcValue(x[i]));
v = vm;
}