context.hxx | context.hxx | |||
---|---|---|---|---|
skipping to change at line 12 | skipping to change at line 12 | |||
// author : Boris Kolpackov <boris@codesynthesis.com> | // author : Boris Kolpackov <boris@codesynthesis.com> | |||
// copyright : Copyright (c) 2009-2011 Code Synthesis Tools CC | // copyright : Copyright (c) 2009-2011 Code Synthesis Tools CC | |||
// license : MIT; see accompanying LICENSE file | // license : MIT; see accompanying LICENSE file | |||
#ifndef CUTL_COMPILER_CONTEXT_HXX | #ifndef CUTL_COMPILER_CONTEXT_HXX | |||
#define CUTL_COMPILER_CONTEXT_HXX | #define CUTL_COMPILER_CONTEXT_HXX | |||
#include <map> | #include <map> | |||
#include <string> | #include <string> | |||
#include <cstddef> // std::size_t | #include <cstddef> // std::size_t | |||
#include <typeinfo> | ||||
#include <cutl/exception.hxx> | #include <cutl/exception.hxx> | |||
#include <cutl/container/any.hxx> | #include <cutl/container/any.hxx> | |||
#include <cutl/details/export.hxx> | #include <cutl/details/export.hxx> | |||
namespace cutl | namespace cutl | |||
{ | { | |||
namespace compiler | namespace compiler | |||
{ | { | |||
skipping to change at line 82 | skipping to change at line 83 | |||
} | } | |||
template <typename X> | template <typename X> | |||
X const& | X const& | |||
get (std::string const& key) const; | get (std::string const& key) const; | |||
template <typename X> | template <typename X> | |||
X const& | 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); | return get<X> (std::string (key), default_value); | |||
} | } | |||
template <typename X> | template <typename X> | |||
X const& | X const& | |||
get (std::string const& key, X const& default_value) const; | get (std::string const& key, X const& default_value) const; | |||
template <typename X> | template <typename X> | |||
void | void | |||
set (char const* key, X const& value) | set (char const* key, X const& value) | |||
{ | { | |||
skipping to change at line 109 | skipping to change at line 110 | |||
void | void | |||
remove (char const* key) | remove (char const* key) | |||
{ | { | |||
remove (std::string (key)); | remove (std::string (key)); | |||
} | } | |||
void | void | |||
remove (std::string const& key); | remove (std::string const& key); | |||
std::type_info const& | ||||
type_info (char const* key) const | ||||
{ | ||||
return type_info (std::string (key)); | ||||
} | ||||
std::type_info const& | ||||
type_info (std::string const& key) const; | ||||
private: | private: | |||
typedef std::map<std::string, container::any> map; | typedef std::map<std::string, container::any> map; | |||
map map_; | map map_; | |||
}; | }; | |||
} | } | |||
} | } | |||
#include <cutl/compiler/context.txx> | #include <cutl/compiler/context.txx> | |||
End of changes. 3 change blocks. | ||||
1 lines changed or deleted | 11 lines changed or added | |||
traversal.hxx | traversal.hxx | |||
---|---|---|---|---|
skipping to change at line 39 | skipping to change at line 39 | |||
trampoline (B&) = 0; | trampoline (B&) = 0; | |||
}; | }; | |||
// | // | |||
// | // | |||
template<typename B> | template<typename B> | |||
class traverser_map | class traverser_map | |||
{ | { | |||
public: | public: | |||
typedef std::vector<traverser<B>*> traversers; | typedef std::vector<traverser<B>*> traversers; | |||
typedef std::map<type_id, traversers> map_type; | ||||
struct map_type: std::map<type_id, traversers> | ||||
{ | ||||
map_type () {} | ||||
// Don't copy traverser maps. We do it here instead of in | ||||
// traverser_map to pacify GCC's -Wextra insisting we must | ||||
// explicitly initialize virtual bases in copy constructor. | ||||
// | ||||
map_type (map_type const&): std::map<type_id, traversers> () {} | ||||
map_type& operator= (map_type const&) {return *this;} | ||||
}; | ||||
typedef typename map_type::const_iterator iterator; | typedef typename map_type::const_iterator iterator; | |||
iterator | iterator | |||
begin () const | begin () const | |||
{ | { | |||
return map_.begin (); | return map_.begin (); | |||
} | } | |||
iterator | iterator | |||
end () const | end () const | |||
skipping to change at line 79 | skipping to change at line 91 | |||
public virtual traverser_map<B> | public virtual traverser_map<B> | |||
{ | { | |||
public: | public: | |||
typedef X type; | typedef X type; | |||
traverser_impl () | traverser_impl () | |||
{ | { | |||
add (typeid (type), *this); | add (typeid (type), *this); | |||
} | } | |||
traverser_impl (traverser_impl const&) | ||||
{ | ||||
add (typeid (type), *this); | ||||
} | ||||
virtual void | virtual void | |||
traverse (type&) = 0; | traverse (type&) = 0; | |||
public: | public: | |||
virtual void | virtual void | |||
trampoline (B&); | trampoline (B&); | |||
}; | }; | |||
// | // | |||
// | // | |||
End of changes. 2 change blocks. | ||||
1 lines changed or deleted | 18 lines changed or added | |||