OPAL (Object Oriented Parallel Accelerator Library)  2.2.0
OPAL
description.hpp
Go to the documentation of this file.
1 //
2 // Copyright & License: See Copyright.readme in src directory
3 //
4 
9 #ifndef DESCRIPTION_HPP_
10 #define DESCRIPTION_HPP_
11 
12 #include "ast.hpp"
13 #include "skipper.hpp"
14 #include "error_handler.hpp"
15 
16 #include <boost/config/warning_disable.hpp>
17 #include <boost/spirit/include/qi.hpp>
18 #include <boost/fusion/include/adapt_struct.hpp>
19 #include <boost/optional.hpp>
20 
21 #define BOOST_SPIRIT_NO_PREDEFINED_TERMINALS
22 #define BOOST_SPIRIT_QI_DEBUG
23 
24 namespace SDDS {
25  struct description
26  {
27  boost::optional<std::string> text_m;
28  boost::optional<std::string> content_m;
29 
30  };
31 
32  inline std::ostream& operator<<(std::ostream& out, const description& desc) {
33  if (desc.text_m) out << "text = " << *desc.text_m << ", ";
34  if (desc.content_m) out << "content = " << *desc.content_m;
35  return out;
36  }
37 }
38 
41  (boost::optional<std::string>, text_m)
42  (boost::optional<std::string>, content_m)
43 )
44 
45 namespace SDDS { namespace parser
46 {
47  namespace qi = boost::spirit::qi;
48  namespace ascii = boost::spirit::ascii;
49  namespace phx = boost::phoenix;
50 
51  template <typename Iterator>
52  struct description_parser: qi::grammar<Iterator, description(), skipper<Iterator> >
53  {
54  description_parser(error_handler<Iterator> & _error_handler);
55 
56  qi::rule<Iterator, description(), skipper<Iterator> > start;
57  qi::rule<Iterator, std::string(), skipper<Iterator> > quoted_string,
58  description_text, description_content;
59  };
60 }}
61 #endif /* DESCRIPTION_HPP_ */
boost::optional< std::string > text_m
Definition: description.hpp:27
BOOST_FUSION_ADAPT_STRUCT(SDDS::column,(boost::optional< std::string >, name_m)(boost::optional< SDDS::ast::datatype >, type_m)(boost::optional< std::string >, units_m)(boost::optional< std::string >, description_m)(SDDS::ast::variant_t, value_m)) namespace SDDS
Definition: column.hpp:173
boost::optional< std::string > content_m
Definition: description.hpp:28
std::ostream & operator<<(std::ostream &out, const array &)
Definition: array.hpp:89