aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cutl/compiler/context.cxx2
-rw-r--r--cutl/compiler/context.hxx50
-rw-r--r--cutl/compiler/context.txx8
3 files changed, 50 insertions, 10 deletions
diff --git a/cutl/compiler/context.cxx b/cutl/compiler/context.cxx
index 7238b33..0488e1f 100644
--- a/cutl/compiler/context.cxx
+++ b/cutl/compiler/context.cxx
@@ -10,7 +10,7 @@ namespace cutl
namespace compiler
{
void context::
- remove (char const* key)
+ remove (std::string const& key)
{
map::iterator i (map_.find (key));
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;
diff --git a/cutl/compiler/context.txx b/cutl/compiler/context.txx
index ba73b6d..7f47cd9 100644
--- a/cutl/compiler/context.txx
+++ b/cutl/compiler/context.txx
@@ -9,7 +9,7 @@ namespace cutl
{
template <typename X>
X& context::
- get (char const* key)
+ get (std::string const& key)
{
map::iterator i (map_.find (key));
@@ -28,7 +28,7 @@ namespace cutl
template <typename X>
X const& context::
- get (char const* key) const
+ get (std::string const& key) const
{
map::const_iterator i (map_.find (key));
@@ -47,7 +47,7 @@ namespace cutl
template <typename X>
X const& context::
- get (char const* key, X const& default_value) const
+ get (std::string const& key, X const& default_value) const
{
map::const_iterator i (map_.find (key));
@@ -66,7 +66,7 @@ namespace cutl
template <typename X>
void context::
- set (char const* key, X const& value)
+ set (std::string const& key, X const& value)
{
try
{