mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-05-16 14:16:09 -06:00
Core: Fixed missing ValueMap constructor (from ValueArray), docs
git-svn-id: svn://ultimatepp.org/upp/trunk@10550 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
parent
567f5d09ac
commit
68dba879f5
4 changed files with 618 additions and 322 deletions
|
|
@ -473,14 +473,18 @@ ValueMap::operator Value() const {
|
|||
return Value(data);
|
||||
}
|
||||
|
||||
void ValueMap::FromArray(const ValueArray& va)
|
||||
{
|
||||
Init0();
|
||||
for(int i = 0; i < va.GetCount(); i++)
|
||||
Add(i, va[i]);
|
||||
}
|
||||
|
||||
ValueMap::ValueMap(const Value& src)
|
||||
{
|
||||
if(!IsNull(src)) {
|
||||
if(IsType<ValueArray>(src)) {
|
||||
ValueArray va = src;
|
||||
Init0();
|
||||
for(int i = 0; i < va.GetCount(); i++)
|
||||
Add(i, va[i]);
|
||||
FromArray(src);
|
||||
return;
|
||||
}
|
||||
else {
|
||||
|
|
|
|||
|
|
@ -340,6 +340,7 @@ class ValueMap : public ValueType<ValueMap, VALUEMAP_V, Moveable<ValueMap> >{
|
|||
static ValueMap::Data& UnShare(ValueMap::Data *&ptr) { if(ptr->GetRefCount() != 1) Clone(ptr); return *ptr; }
|
||||
Data& UnShare() { return UnShare(data); }
|
||||
void Init0();
|
||||
void FromArray(const ValueArray& va);
|
||||
|
||||
friend Value::Void *ValueMapDataCreate();
|
||||
friend class Value;
|
||||
|
|
@ -347,6 +348,7 @@ class ValueMap : public ValueType<ValueMap, VALUEMAP_V, Moveable<ValueMap> >{
|
|||
public:
|
||||
ValueMap() { Init0(); }
|
||||
ValueMap(const ValueMap& v);
|
||||
ValueMap(const ValueArray& va) { FromArray(va); }
|
||||
ValueMap(Index<Value>&& k, Vector<Value>&& v);
|
||||
ValueMap(VectorMap<Value, Value>&& m);
|
||||
ValueMap(const Index<Value>& k, const Vector<Value>& v, int deep);
|
||||
|
|
|
|||
|
|
@ -46,6 +46,12 @@ p][@(0.0.255) `&]_[*@3 v])&]
|
|||
[s2; Copy constructor.&]
|
||||
[s3; &]
|
||||
[s4;%- &]
|
||||
[s5;:Upp`:`:ValueMap`:`:ValueMap`(const Upp`:`:ValueArray`&`):%- [* ValueMap]([@(0.0.255) c
|
||||
onst]_[_^Upp`:`:ValueArray^ ValueArray][@(0.0.255) `&]_[*@3 va])&]
|
||||
[s2; Creates ValueMap from ValueArray. ValueArray elements become
|
||||
values with keys equal to indices.&]
|
||||
[s3; &]
|
||||
[s4;%- &]
|
||||
[s5;:Upp`:`:ValueMap`:`:ValueMap`(Upp`:`:Index`<Upp`:`:Value`>`&`&`,Upp`:`:Vector`<Upp`:`:Value`>`&`&`):%- [* V
|
||||
alueMap]([_^Upp`:`:Index^ Index]<[_^Upp`:`:Value^ Value]>`&`&_[*@3 k],
|
||||
[_^Upp`:`:Vector^ Vector]<[_^Upp`:`:Value^ Value]>`&`&_[*@3 v])&]
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
Loading…
Add table
Add a link
Reference in a new issue