| 1 | // Copyright (c) 2001-2011 Hartmut Kaiser |
| 2 | // |
| 3 | // Distributed under the Boost Software License, Version 1.0. (See accompanying |
| 4 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) |
| 5 | |
| 6 | #if !defined(BOOST_SPIRIT_KARMA_CREATE_NOV_21_2009_0340PM) |
| 7 | #define BOOST_SPIRIT_KARMA_CREATE_NOV_21_2009_0340PM |
| 8 | |
| 9 | #if defined(_MSC_VER) |
| 10 | #pragma once |
| 11 | #endif |
| 12 | |
| 13 | #include <boost/spirit/home/karma/auto/meta_create.hpp> |
| 14 | |
| 15 | /////////////////////////////////////////////////////////////////////////////// |
| 16 | namespace boost { namespace spirit { namespace result_of |
| 17 | { |
| 18 | /////////////////////////////////////////////////////////////////////////// |
| 19 | template <typename T> |
| 20 | struct create_generator |
| 21 | : spirit::traits::meta_create<karma::domain, T> {}; |
| 22 | }}} |
| 23 | |
| 24 | /////////////////////////////////////////////////////////////////////////////// |
| 25 | namespace boost { namespace spirit { namespace karma |
| 26 | { |
| 27 | // Main API function for generator creation from data type |
| 28 | template <typename T> |
| 29 | typename result_of::create_generator<T>::type |
| 30 | create_generator() |
| 31 | { |
| 32 | return spirit::traits::meta_create<karma::domain, T>::call(); |
| 33 | } |
| 34 | }}} |
| 35 | |
| 36 | /////////////////////////////////////////////////////////////////////////////// |
| 37 | namespace boost { namespace spirit { namespace traits |
| 38 | { |
| 39 | // Meta function returning true if create_generator does return a valid |
| 40 | // generator for the given type T. |
| 41 | template <typename T> |
| 42 | struct create_generator_exists |
| 43 | : meta_create_exists<karma::domain, T> {}; |
| 44 | }}} |
| 45 | |
| 46 | #endif |
| 47 | |