diff --git a/uppsrc/Core/ValueUtil.h b/uppsrc/Core/ValueUtil.h index 0b2f0ed4a..95ab76e3a 100644 --- a/uppsrc/Core/ValueUtil.h +++ b/uppsrc/Core/ValueUtil.h @@ -357,6 +357,8 @@ public: bool IsEmpty() const { return data->value.IsEmpty(); } const Value& GetKey(int i) const { return data->key[i]; } const Value& GetValue(int i) const { return data->value[i]; } + int Find(const Value& key) const { return data ? data->key.Find(key) : -1; } + int FindNext(int ii) const { return data ? data->key.FindNext(ii) : -1; } void Add(const Value& key, const Value& value); void Add(const String& key, const Value& value) { Add(Value(key), value); } diff --git a/uppsrc/Core/src.tpp/ValueMap$en-us.tpp b/uppsrc/Core/src.tpp/ValueMap$en-us.tpp index 6b03eceb2..f861010b9 100644 --- a/uppsrc/Core/src.tpp/ValueMap$en-us.tpp +++ b/uppsrc/Core/src.tpp/ValueMap$en-us.tpp @@ -135,6 +135,17 @@ etKey]([@(0.0.255) int]_[*@3 i])_[@(0.0.255) const]&] [s2; Returns value at index [%-*@3 i].&] [s3; &] [s4;%- &] +[s5;:Upp`:`:ValueMap`:`:Find`(const Upp`:`:Value`&`)const:%- [@(0.0.255) int]_[* Find]([@(0.0.255) c +onst]_[_^Upp`:`:Value^ Value][@(0.0.255) `&]_[*@3 key])_[@(0.0.255) const]&] +[s2; Returns the index of first [%-*@3 key] or `-1 if not present.&] +[s3; &] +[s4;%- &] +[s5;:Upp`:`:ValueMap`:`:FindNext`(int`)const:%- [@(0.0.255) int]_[* FindNext]([@(0.0.255) i +nt]_[*@3 ii])_[@(0.0.255) const]&] +[s2; Returns the index of next key with the same value as key at +index [%-*@3 ii] or `-1 if not present.&] +[s3; &] +[s4;%- &] [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])&]