diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2010-04-02 14:28:37 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2010-04-02 14:28:37 +0200 |
commit | 7385921ace0e0b130de43709cd09bb973915657f (patch) | |
tree | b2006aa8585289b9734db1756df771d8020b1b68 /cutl/compiler/context.hxx | |
parent | 3af115d488289abfaec2635029f5efe3978d77f4 (diff) |
Add std::string overload for context functions
Diffstat (limited to 'cutl/compiler/context.hxx')
-rw-r--r-- | cutl/compiler/context.hxx | 50 |
1 files changed, 45 insertions, 5 deletions
diff --git a/cutl/compiler/context.hxx b/cutl/compiler/context.hxx index 120986c..e603f97 100644 --- a/cutl/compiler/context.hxx +++ b/cutl/compiler/context.hxx @@ -36,27 +36,67 @@ namespace cutl std::size_t count (char const* key) const { + return count (std::string (key)); + } + + std::size_t + count (std::string const& key) const + { return map_.count (key); } template <typename X> X& - get (char const* key); + get (char const* key) + { + return get<X> (std::string (key)); + } + + template <typename X> + X& + get (std::string const& key); + + template <typename X> + X const& + get (char const* key) const + { + return get<X> (std::string (key)); + } template <typename X> X const& - get (char const* key) const; + get (std::string const& key) const; template <typename X> X const& - get (char const* key, X const& default_value) const; + get (char const* key, X const& default_value) const + { + return get<X> (std::string (key) ,default_value); + } + + template <typename X> + X const& + get (std::string const& key, X const& default_value) const; + + template <typename X> + void + set (char const* key, X const& value) + { + set<X> (std::string (key), value); + } template <typename X> void - set (char const* key, X const& value); + set (std::string const& key, X const& value); + + void + remove (char const* key) + { + remove (std::string (key)); + } void - remove (char const* key); + remove (std::string const& key); private: typedef std::map<std::string, container::any> map; |