5 #include "IntegerValue.h"
11 MapValue::MapValue(Databoard::Type::DataType* dataBoard) : Value(dataBoard)
17 for(MKVMap::iterator it = values.begin(); it != values.end(); ++it)
26 bool MapValue::put(Value* key, Value* value)
28 if(containsKey(key) == false)
36 MKVMap::iterator it = values.find(key);
51 return (int)values.size();
54 Value* MapValue::get(Value* key)
56 if(containsKey(key) == true)
66 bool MapValue::containsKey(Value* key)
68 return (values.find(key) != values.end());
71 Value* MapValue::remove(Value* key)
73 if(containsKey(key) == true)
75 Value* oldValue = values[key];
87 void MapValue::removeRange(Value* startKey, Value* endKey)
89 if(containsKey(startKey) && containsKey(endKey))
91 MKVMap::iterator iBegin = values.find(startKey);
92 MKVMap::iterator iEnd = values.find(endKey);
99 for(MKVMap::iterator it = values.begin(); it != values.end(); ++i, ++it)
112 if(indexBegin == -1 || indexEnd == -1 ||
113 (indexBegin > indexEnd))
118 MKVMap::iterator it = values.begin();
120 for(int j = 0; j < indexBegin; ++j)
125 for(i = indexBegin; i < indexEnd; ++i)
133 values.erase(iBegin, iEnd);
137 void MapValue::clear()
142 std::string MapValue::writeOut(int /*indent*/)
148 // counter is inside the block
149 for(MKVMap::iterator it = values.begin(); it != values.end(); )
151 s += it->first->writeOut();
153 s += it->second->writeOut();
155 if(++it != values.end())
166 bool MapValue::equals(const Value* other)
168 MapValue* o = (MapValue*)other;
170 return true;//(this->value < o->value);
174 std::string MapValue::isValid()
176 for(MKVMap::iterator it = values.begin(); it != values.end(); ++it)
180 s = it->first->isValid();
187 s = it->second->isValid();
198 bool ValueComparison::operator()(Value* const &a, Value* const &b) const