// file : cutl/compiler/context.hxx // author : Boris Kolpackov // copyright : Copyright (c) 2009-2010 Code Synthesis Tools CC // license : MIT; see accompanying LICENSE file #ifndef CUTL_COMPILER_CONTEXT_HXX #define CUTL_COMPILER_CONTEXT_HXX #include #include #include // std::size_t #include #include namespace cutl { namespace compiler { class context { public: struct no_entry: exception {}; struct typing: exception {}; public: context () {} private: context (context const&); context& operator= (context const&); public: std::size_t count (char const* key) const { return map_.count (key); } template X& get (char const* key); template X const& get (char const* key) const; template X const& get (char const* key, X const& default_value) const; template void set (char const* key, X const& value); void remove (char const* key); private: typedef std::map map; map map_; }; } } #include #endif // CUTL_COMPILER_CONTEXT_HXX