| 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_QI_CREATE_NOV_21_2009_0444PM) |
| 7 | #define BOOST_SPIRIT_QI_CREATE_NOV_21_2009_0444PM |
| 8 | |
| 9 | #if defined(_MSC_VER) |
| 10 | #pragma once |
| 11 | #endif |
| 12 | |
| 13 | #include <boost/spirit/home/qi/auto/meta_create.hpp> |
| 14 | |
| 15 | /////////////////////////////////////////////////////////////////////////////// |
| 16 | namespace boost { namespace spirit { namespace result_of |
| 17 | { |
| 18 | template <typename T> |
| 19 | struct create_parser |
| 20 | : spirit::traits::meta_create<qi::domain, T> {}; |
| 21 | }}} |
| 22 | |
| 23 | /////////////////////////////////////////////////////////////////////////////// |
| 24 | namespace boost { namespace spirit { namespace qi |
| 25 | { |
| 26 | // Main API function for parser creation from data type |
| 27 | template <typename T> |
| 28 | typename result_of::create_parser<T>::type |
| 29 | create_parser() |
| 30 | { |
| 31 | return spirit::traits::meta_create<qi::domain, T>::call(); |
| 32 | } |
| 33 | }}} |
| 34 | |
| 35 | /////////////////////////////////////////////////////////////////////////////// |
| 36 | namespace boost { namespace spirit { namespace traits |
| 37 | { |
| 38 | // Meta function returning true if create_parser does return a valid |
| 39 | // parser for the given type T. |
| 40 | template <typename T> |
| 41 | struct create_parser_exists |
| 42 | : meta_create_exists<qi::domain, T> {}; |
| 43 | }}} |
| 44 | |
| 45 | #endif |
| 46 | |