*Core: Fixed ValueMap.Add(0, ..) issue (was converting 0 to (const char *)NULL)

git-svn-id: svn://ultimatepp.org/upp/trunk@5600 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
cxl 2012-11-30 09:58:26 +00:00
parent 7dd5d6058e
commit 6520d7c4fc
3 changed files with 7 additions and 36 deletions

View file

@ -69,6 +69,7 @@ public:
operator const String&() const { return ToString(); }
const String& operator~() const { return ToString(); }
operator Value() const { return ToString(); }
bool operator==(const Id& b) const { return id == b.id; }
bool operator!=(const Id& b) const { return id != b.id; }
@ -306,20 +307,11 @@ public:
const Value& GetValue(int i) const { return data->value[i]; }
void Add(const Value& key, const Value& value);
void Add(const String& s, const Value& value) { Add(Value(s), value); }
void Add(const char *s, const Value& value) { Add(Value(s), value); }
void Add(Id id, const Value& value) { Add(Value(id.ToString()), value); }
void Set(const Value& key, const Value& value);
void Set(const String& s, const Value& value) { Set(Value(s), value); }
void Set(const char *s, const Value& value) { Set(Value(s), value); }
void Set(Id id, const Value& value) { Set(Value(id.ToString()), value); }
void SetAt(int i, const Value& v);
void SetKey(int i, const Value& k);
void SetKey(int i, const String& s) { SetKey(i, Value(s)); }
void SetKey(int i, const char* s) { SetKey(i, Value(s)); }
void SetKey(int i, Id id) { SetKey(i, Value(id.ToString())); }
void Remove(int i);
const Index<Value>& GetKeys() const { return data->key; }
@ -328,9 +320,6 @@ public:
operator ValueArray() const { return GetValues(); }
const Value& operator[](const Value& k) const;
const Value& operator[](const String& s) const{ return operator[](Value(s)); }
const Value& operator[](const char *s) const { return operator[](Value(s)); }
const Value& operator[](const Id& k) const { return operator[](Value(k.ToString())); }
Value GetAndClear(const Value& key);

View file

@ -46,6 +46,10 @@ tor`~]()_[@(0.0.255) const]&]
[s2;%% Same as ToString().&]
[s3; &]
[s4; &]
[s5;:Id`:`:operator Value`(`)const: [* operator_Value]()_[@(0.0.255) const]&]
[s2;%% Converts Id to String Value.&]
[s3; &]
[s4; &]
[s5;:Id`:`:operator`=`=`(const Id`&`)const: [@(0.0.255) bool]_[* operator`=`=]([@(0.0.255) c
onst]_[_^Id^ Id][@(0.0.255) `&]_[*@3 b])_[@(0.0.255) const]&]
[s2;%% Returns true if both Id contain the same text.&]
@ -68,4 +72,4 @@ onst]_[_^Id^ Id][@(0.0.255) `&]_[*@3 b])_[@(0.0.255) const]&]
[*@3 s])&]
[s5;:Id`:`:Id`(const char`*`): [* Id]([@(0.0.255) const]_[@(0.0.255) char]_`*[*@3 s])&]
[s2;%% Constructs Id with text [%-*@3 s].&]
[s3;%% ]
[s3;%% ]]

View file

@ -114,14 +114,6 @@ etKey]([@(0.0.255) int]_[*@3 i])_[@(0.0.255) const]&]
[s5;:ValueMap`:`:Add`(const Value`&`,const Value`&`):%- [@(0.0.255) void]_[* Add]([@(0.0.255) c
onst]_[_^Value^ Value][@(0.0.255) `&]_[*@3 key], [@(0.0.255) const]_[_^Value^ Value][@(0.0.255) `&
]_[*@3 value])&]
[s5;:ValueMap`:`:Add`(const String`&`,const Value`&`): [%-@(0.0.255) void][%- _][%-* Add][%- (
][%-@(0.0.255) const][%- _][%-_^String^ String][%-@(0.0.255) `&][%- _][%-*@3 key][%- ,
][%-@(0.0.255) const][%- _][%-_^Value^ Value][%-@(0.0.255) `&][%- _][%-*@3 value][%- )].&]
[s5;:ValueMap`:`:Add`(const char`*`,const Value`&`):%- [@(0.0.255) void]_[* Add]([@(0.0.255) c
onst]_[@(0.0.255) char]_`*[*@3 key], [@(0.0.255) const]_[_^Value^ Value][@(0.0.255) `&]_[*@3 v
alue])&]
[s5;:ValueMap`:`:Add`(Id`,const Value`&`):%- [@(0.0.255) void]_[* Add]([_^Id^ Id]_[*@3 key],
[@(0.0.255) const]_[_^Value^ Value][@(0.0.255) `&]_[*@3 value])&]
[s2;%- Adds a new key`-value pair to ValueMap. ValueMap can contain
multiple same keys.&]
[s3;%- &]
@ -129,14 +121,6 @@ multiple same keys.&]
[s5;:ValueMap`:`:Set`(const Value`&`,const Value`&`):%- [@(0.0.255) void]_[* Set]([@(0.0.255) c
onst]_[_^Value^ Value][@(0.0.255) `&]_[*@3 key], [@(0.0.255) const]_[_^Value^ Value][@(0.0.255) `&
]_[*@3 value])&]
[s5;:ValueMap`:`:Set`(const String`&`,const Value`&`):%- [@(0.0.255) void]_[* Set]([@(0.0.255) c
onst]_[_^String^ String][@(0.0.255) `&]_[*@3 key], [@(0.0.255) const]_[_^Value^ Value][@(0.0.255) `&
]_[*@3 value])&]
[s5;:ValueMap`:`:Set`(const char`*`,const Value`&`):%- [@(0.0.255) void]_[* Set]([@(0.0.255) c
onst]_[@(0.0.255) char]_`*[*@3 key], [@(0.0.255) const]_[_^Value^ Value][@(0.0.255) `&]_[*@3 v
alue])&]
[s5;:ValueMap`:`:Set`(Id`,const Value`&`):%- [@(0.0.255) void]_[* Set]([_^Id^ Id]_[*@3 key],
[@(0.0.255) const]_[_^Value^ Value][@(0.0.255) `&]_[*@3 value])&]
[s2; If there is [%-*@3 key] in ValueMap, its associated Value is replaced
by [%-*@3 value]. If there is none such key, key`-value is added.
If there is more than single such key, only first one (the one
@ -150,12 +134,6 @@ with lowest index) is replaced.&]
[s4;%- &]
[s5;:ValueMap`:`:SetKey`(int`,const Value`&`):%- [@(0.0.255) void]_[* SetKey]([@(0.0.255) i
nt]_[*@3 i], [@(0.0.255) const]_[_^Value^ Value][@(0.0.255) `&]_[*@3 key])&]
[s5;:ValueMap`:`:SetKey`(int`,const String`&`):%- [@(0.0.255) void]_[* SetKey]([@(0.0.255) i
nt]_[*@3 i], [@(0.0.255) const]_[_^String^ String][@(0.0.255) `&]_[*@3 key])&]
[s5;:ValueMap`:`:SetKey`(int`,const char`*`):%- [@(0.0.255) void]_[* SetKey]([@(0.0.255) in
t]_[*@3 i], [@(0.0.255) const]_[@(0.0.255) char`*]_[*@3 key])&]
[s5;:ValueMap`:`:SetKey`(int`,Id`):%- [@(0.0.255) void]_[* SetKey]([@(0.0.255) int]_[*@3 i],
[_^Id^ Id]_[*@3 key])&]
[s2; Replaces key at given index..&]
[s3; &]
[s4;%- &]
@ -231,4 +209,4 @@ same key`-value pairs [*/ in the same order].&]
]([@(0.0.255) const]_[_^ValueMap^ ValueMap][@(0.0.255) `&]_[*@3 v])_[@(0.0.255) const]&]
[s2; Same as !operator`=`=(v).&]
[s3; &]
[s0; ]
[s0; ]]