From ebfe8dc9d7093e932f91a649636e2202630cc16f Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Sun, 20 Sep 2009 06:39:17 +0200 Subject: Add standard namespace traverser --- cli/context.cxx | 20 ++++++++++++++++++++ cli/context.hxx | 16 ++++++++++++++++ 2 files changed, 36 insertions(+) (limited to 'cli') 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 -- cgit