$include_dir="/home/hyper-archives/boost-commit/include"; include("$include_dir/msg-header.inc") ?>
Subject: [Boost-commit] svn:boost r55046 - in trunk/boost/spirit/home/karma: . directive
From: hartmut.kaiser_at_[hidden]
Date: 2009-07-20 11:37:11
Author: hkaiser
Date: 2009-07-20 11:37:09 EDT (Mon, 20 Jul 2009)
New Revision: 55046
URL: http://svn.boost.org/trac/boost/changeset/55046
Log:
Spirit: added karma::omit[] directive
Added:
   trunk/boost/spirit/home/karma/directive/omit.hpp   (contents, props changed)
Text files modified: 
   trunk/boost/spirit/home/karma/directive.hpp |     6 ++++++                                  
   1 files changed, 6 insertions(+), 0 deletions(-)
Modified: trunk/boost/spirit/home/karma/directive.hpp
==============================================================================
--- trunk/boost/spirit/home/karma/directive.hpp	(original)
+++ trunk/boost/spirit/home/karma/directive.hpp	2009-07-20 11:37:09 EDT (Mon, 20 Jul 2009)
@@ -43,4 +43,10 @@
 ///////////////////////////////////////////////////////////////////////////////
 #include <boost/spirit/home/karma/directive/repeat.hpp>
 
+///////////////////////////////////////////////////////////////////////////////
+//  omit directive
+//  omit[...]
+///////////////////////////////////////////////////////////////////////////////
+#include <boost/spirit/home/karma/directive/omit.hpp>
+
 #endif
Added: trunk/boost/spirit/home/karma/directive/omit.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/spirit/home/karma/directive/omit.hpp	2009-07-20 11:37:09 EDT (Mon, 20 Jul 2009)
@@ -0,0 +1,90 @@
+//  Copyright (c) 2001-2009 Hartmut Kaiser
+//
+//  Distributed under the Boost Software License, Version 1.0. (See accompanying
+//  file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+#if !defined(SPIRIT_KARMA_OMIT_JUL_20_2009_1008AM)
+#define SPIRIT_KARMA_OMIT_JUL_20_2009_1008AM
+
+#if defined(_MSC_VER)
+#pragma once
+#endif
+
+#include <boost/spirit/home/karma/meta_compiler.hpp>
+#include <boost/spirit/home/karma/generator.hpp>
+#include <boost/spirit/home/karma/domain.hpp>
+#include <boost/spirit/home/support/unused.hpp>
+#include <boost/spirit/home/support/info.hpp>
+#include <boost/spirit/home/support/common_terminals.hpp>
+
+namespace boost { namespace spirit
+{
+    ///////////////////////////////////////////////////////////////////////////
+    // Enablers
+    ///////////////////////////////////////////////////////////////////////////
+    template <>
+    struct use_directive<karma::domain, tag::omit> // enables omit
+      : mpl::true_ {};
+
+}}
+
+namespace boost { namespace spirit { namespace karma
+{
+    using spirit::omit;
+    using spirit::omit_type;
+
+    ///////////////////////////////////////////////////////////////////////////
+    // omit_directive consumes the attribute of subject generator without
+    // generating anything
+    ///////////////////////////////////////////////////////////////////////////
+    template <typename Subject>
+    struct omit_directive : unary_generator<omit_directive<Subject> >
+    {
+        typedef Subject subject_type;
+
+        omit_directive(Subject const& subject)
+          : subject(subject) {}
+
+        template <typename Context, typename Iterator>
+        struct attribute
+        {
+            typedef typename
+                traits::attribute_of<subject_type, Context>::type
+            type;
+        };
+
+        template <typename OutputIterator, typename Context, typename Delimiter
+          , typename Attribute>
+        bool generate(OutputIterator& sink, Context& ctx, Delimiter const& d
+          , Attribute const& attr) const
+        {
+            return true;
+        }
+
+        template <typename Context>
+        info what(Context& context) const
+        {
+            return info("omit", subject.what(context));
+
+        }
+
+        Subject subject;
+    };
+
+    ///////////////////////////////////////////////////////////////////////////
+    // Generator generators: make_xxx function (objects)
+    ///////////////////////////////////////////////////////////////////////////
+    template <typename Subject, typename Modifiers>
+    struct make_directive<tag::omit, Subject, Modifiers>
+    {
+        typedef omit_directive<Subject> result_type;
+        result_type operator()(unused_type, Subject const& subject
+          , unused_type) const
+        {
+            return result_type(subject);
+        }
+    };
+
+}}}
+
+#endif