Core: MapConvert::Default

git-svn-id: svn://ultimatepp.org/upp/trunk@5574 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
cxl 2012-11-21 20:04:18 +00:00
parent e296c7d9ab
commit 3f166c25c8
2 changed files with 3 additions and 1 deletions

View file

@ -493,7 +493,7 @@ GLOBAL_VAR_INIT(const ConvertString, StdConvertString);
GLOBAL_VARP_INIT(const ConvertString, StdConvertStringNotNull, (INT_MAX, true))
Value MapConvert::Format(const Value& q) const {
return map.Get(q, Null);
return map.Get(q, default_value);
}
NoConvertClass::NoConvertClass() {}

View file

@ -233,10 +233,12 @@ public:
protected:
VectorMap<Value, Value> map;
Value default_value;
public:
void Clear() { map.Clear(); }
MapConvert& Add(const Value& a, const Value& b) { map.Add(a, b); return *this; }
MapConvert& Default(const Value& v) { default_value = v; return *this; }
int GetCount() const { return map.GetCount(); }
int Find(const Value& v) const { return map.Find(v); }