diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2009-09-20 06:39:17 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2009-09-20 06:39:17 +0200 |
commit | ebfe8dc9d7093e932f91a649636e2202630cc16f (patch) | |
tree | 9d468f7f94d90d5de072f9d4da7bbf6bf9cf4f06 /cli | |
parent | 3b64eb05fd0b139d9f6e4701c2f191bed72328bc (diff) | |
download | cli-ebfe8dc9d7093e932f91a649636e2202630cc16f.tar.gz cli-ebfe8dc9d7093e932f91a649636e2202630cc16f.tar.xz cli-ebfe8dc9d7093e932f91a649636e2202630cc16f.zip |
Add standard namespace traverser
Diffstat (limited to 'cli')
-rw-r--r-- | cli/context.cxx | 20 | ||||
-rw-r--r-- | cli/context.hxx | 16 |
2 files changed, 36 insertions, 0 deletions
diff --git a/cli/context.cxx b/cli/context.cxx index d90df99..96eec1c 100644 --- a/cli/context.cxx +++ b/cli/context.cxx @@ -178,3 +178,23 @@ escape (string const& name) const return r; } + +// namespace +// + +void namespace_:: +pre (type& ns) +{ + string name (ns.name ()); + + if (!name.empty ()) + os << "namespace " << escape (name) + << "{"; +} + +void namespace_:: +post (type& ns) +{ + if (!ns.name ().empty ()) + os << "}"; +} diff --git a/cli/context.hxx b/cli/context.hxx index 8dc9fff..c3caa73 100644 --- a/cli/context.hxx +++ b/cli/context.hxx @@ -53,4 +53,20 @@ private: operator= (context const&); }; +// Standard namespace traverser. +// +struct namespace_: traversal::namespace_, context +{ + namespace_ (context& c) + : context (c) + { + } + + virtual void + pre (type&); + + virtual void + post (type&); +}; + #endif // CLI_CONTEXT_HXX |