diff --git a/test/basic_structures.cpp b/test/basic_structures.cpp index 5a8aee40..f65e637f 100644 --- a/test/basic_structures.cpp +++ b/test/basic_structures.cpp @@ -6,9 +6,3 @@ */ #include -#include -#include -#include - -using char_iterator_t = yaml::parser::ustring_t::const_iterator; -template struct yaml::parser::basic_structures_t; diff --git a/test/block_style.cpp b/test/block_style.cpp index cf80834c..c968193e 100644 --- a/test/block_style.cpp +++ b/test/block_style.cpp @@ -6,9 +6,3 @@ */ #include -#include -#include -#include - -using char_iterator_t = yaml::parser::ustring_t::const_iterator; -template struct yaml::parser::block_styles_t; diff --git a/test/characters.cpp b/test/characters.cpp index fc0a235d..8b446e32 100644 --- a/test/characters.cpp +++ b/test/characters.cpp @@ -6,9 +6,3 @@ */ #include -#include -#include -#include - -using char_iterator_t = yaml::parser::ustring_t::const_iterator; -template struct yaml::parser::characters_t; diff --git a/test/flow_style.cpp b/test/flow_style.cpp index c06873d9..0eaa9e60 100644 --- a/test/flow_style.cpp +++ b/test/flow_style.cpp @@ -6,9 +6,3 @@ */ #include -#include -#include -#include - -using char_iterator_t = yaml::parser::ustring_t::const_iterator; -template struct yaml::parser::flow_styles_t; diff --git a/test/stream.cpp b/test/stream.cpp index 344afc2e..0dc903f0 100644 --- a/test/stream.cpp +++ b/test/stream.cpp @@ -6,9 +6,3 @@ */ #include -#include -#include -#include - -using char_iterator_t = yaml::parser::ustring_t::const_iterator; -template struct yaml::parser::stream_t; diff --git a/yaml/parser/basic_structures.hpp b/yaml/parser/basic_structures.hpp index 66f06b5b..8a71ce3e 100644 --- a/yaml/parser/basic_structures.hpp +++ b/yaml/parser/basic_structures.hpp @@ -14,15 +14,11 @@ namespace yaml { namespace parser { - template struct basic_structures_t { - using iterator_t = pos_iterator; - using iter_range_t = uchar_range; - explicit basic_structures_t (boost::phoenix::function const & error_handler); - characters_t characters_; + characters_t characters_; qi::rule indent; // indent exactly n spaces qi::rule indent_lt; // indent <= n spaces @@ -49,12 +45,12 @@ namespace yaml { namespace parser { qi::rule< iterator_t, ast::properties_t(int, context_t), - qi::locals + qi::locals > properties; - qi::rule tag_property; - qi::rule anchor_property; - qi::rule anchor_name; + qi::rule tag_property; + qi::rule anchor_property; + qi::rule anchor_name; qi::rule one_time_eoi; diff --git a/yaml/parser/basic_structures_def.hpp b/yaml/parser/basic_structures_def.hpp index d040f103..30b89516 100644 --- a/yaml/parser/basic_structures_def.hpp +++ b/yaml/parser/basic_structures_def.hpp @@ -89,10 +89,9 @@ namespace yaml { namespace parser { template struct result { using type = std::string; }; - template - std::string operator() (boost::iterator_range> range) const + std::string operator() (iterator_range_t range) const { - using iterator_t = typename boost::iterator_range>::iterator; + using iterator_t = iterator_range_t::iterator; boost::u32_to_u8_iterator first(range.begin()); boost::u32_to_u8_iterator last(range.end()); return std::string(first, last); @@ -101,8 +100,8 @@ namespace yaml { namespace parser { } - template - basic_structures_t::basic_structures_t (boost::phoenix::function const & error_handler) + YAML_HEADER_ONLY_INLINE + basic_structures_t::basic_structures_t (boost::phoenix::function const & error_handler) : error_handler_ (error_handler) { qi::attr_type attr; diff --git a/yaml/parser/block_styles.hpp b/yaml/parser/block_styles.hpp index f382e8d3..6efd627e 100644 --- a/yaml/parser/block_styles.hpp +++ b/yaml/parser/block_styles.hpp @@ -14,15 +14,11 @@ namespace yaml { namespace parser { - template struct block_styles_t { - using iterator_t = pos_iterator; - using iterator_range_t = boost::iterator_range; - explicit block_styles_t (boost::phoenix::function const & error_handler); - flow_styles_t flow_styles_; + flow_styles_t flow_styles_; qi::rule< iterator_t, diff --git a/yaml/parser/block_styles_def.hpp b/yaml/parser/block_styles_def.hpp index 141cfe84..796daec2 100644 --- a/yaml/parser/block_styles_def.hpp +++ b/yaml/parser/block_styles_def.hpp @@ -63,8 +63,8 @@ namespace yaml { namespace parser { } - template - block_styles_t::block_styles_t (boost::phoenix::function const & error_handler) + YAML_HEADER_ONLY_INLINE + block_styles_t::block_styles_t (boost::phoenix::function const & error_handler) : flow_styles_ (error_handler) { qi::attr_type attr; diff --git a/yaml/parser/characters.hpp b/yaml/parser/characters.hpp index 6f6f75e0..52866fb8 100644 --- a/yaml/parser/characters.hpp +++ b/yaml/parser/characters.hpp @@ -14,11 +14,8 @@ namespace yaml { namespace parser { - template struct characters_t { - using iterator_t = pos_iterator; - characters_t (); qi::rule printable; diff --git a/yaml/parser/characters_def.hpp b/yaml/parser/characters_def.hpp index 08dd690c..cfc6485a 100644 --- a/yaml/parser/characters_def.hpp +++ b/yaml/parser/characters_def.hpp @@ -55,8 +55,8 @@ namespace yaml { namespace parser { } - template - characters_t::characters_t () + YAML_HEADER_ONLY_INLINE + characters_t::characters_t () { qi::unicode::char_type char_; qi::_val_type _val; diff --git a/yaml/parser/error_handler.hpp b/yaml/parser/error_handler.hpp index 8a43c6fb..b5dbe396 100644 --- a/yaml/parser/error_handler.hpp +++ b/yaml/parser/error_handler.hpp @@ -55,15 +55,12 @@ namespace yaml { namespace parser { warning_fn_(msg); } - template void operator() ( - pos_iterator first, - pos_iterator last, - pos_iterator err_pos, + iterator_t first, + iterator_t last, + iterator_t err_pos, boost::spirit::info const & what ) const { - using iterator_t = pos_iterator; - iterator_t line_start = boost::spirit::get_line_start(first, err_pos); std::string error_line; if (line_start != last && *line_start == '\r') diff --git a/yaml/parser/flow_styles.hpp b/yaml/parser/flow_styles.hpp index 1ec60d67..d302978d 100644 --- a/yaml/parser/flow_styles.hpp +++ b/yaml/parser/flow_styles.hpp @@ -14,14 +14,11 @@ namespace yaml { namespace parser { - template struct flow_styles_t { - using iterator_t = pos_iterator; - explicit flow_styles_t (boost::phoenix::function const & error_handler); - basic_structures_t basic_structures_; + basic_structures_t basic_structures_; qi::symbols anchors; diff --git a/yaml/parser/flow_styles_def.hpp b/yaml/parser/flow_styles_def.hpp index 2f307be2..388e47c6 100644 --- a/yaml/parser/flow_styles_def.hpp +++ b/yaml/parser/flow_styles_def.hpp @@ -44,8 +44,8 @@ namespace yaml { namespace parser { } - template - flow_styles_t::flow_styles_t (boost::phoenix::function const & error_handler) + YAML_HEADER_ONLY_INLINE + flow_styles_t::flow_styles_t (boost::phoenix::function const & error_handler) : basic_structures_ (error_handler) { qi::attr_type attr; diff --git a/yaml/parser/parser_fwd.hpp b/yaml/parser/parser_fwd.hpp index 8944636f..306dd8bc 100644 --- a/yaml/parser/parser_fwd.hpp +++ b/yaml/parser/parser_fwd.hpp @@ -61,11 +61,8 @@ namespace yaml { namespace parser { } }; - template - using pos_iterator = boost::spirit::classic::position_iterator; - - template - using uchar_range = boost::iterator_range>; + using iterator_t = boost::spirit::classic::position_iterator; + using iterator_range_t = boost::iterator_range; // Parser enums. diff --git a/yaml/parser/stream.hpp b/yaml/parser/stream.hpp index 29b8bdb1..62650894 100644 --- a/yaml/parser/stream.hpp +++ b/yaml/parser/stream.hpp @@ -14,18 +14,15 @@ namespace yaml { namespace parser { - template struct stream_t { - using iterator_t = pos_iterator; - stream_t ( std::string const & source_file, reporting_fn_t const & errors_callback, reporting_fn_t const & warnings_callback ); - block_styles_t block_styles_; + block_styles_t block_styles_; qi::rule> document_prefix; qi::rule> document_suffix; @@ -47,8 +44,8 @@ namespace yaml { namespace parser { YAML_HEADER_ONLY_INLINE encoding_t read_bom (char const *& first, char const * last); - template - encoding_t read_bom (pos_iterator & first, pos_iterator last); + YAML_HEADER_ONLY_INLINE + encoding_t read_bom (iterator_t & first, iterator_t last); YAML_HEADER_ONLY_INLINE boost::optional> parse_yaml( diff --git a/yaml/parser/stream_def.hpp b/yaml/parser/stream_def.hpp index 14e47682..de167ff5 100644 --- a/yaml/parser/stream_def.hpp +++ b/yaml/parser/stream_def.hpp @@ -22,7 +22,7 @@ namespace yaml { namespace parser { namespace detail { template - inline bool check_encoding (encoding_t encoding, ErrorFn const & error_fn) + bool check_encoding (encoding_t encoding, ErrorFn const & error_fn) { if (encoding != encoding_t::utf8) { std::stringstream oss; @@ -39,8 +39,8 @@ namespace yaml { namespace parser { } - template - stream_t::stream_t ( + YAML_HEADER_ONLY_INLINE + stream_t::stream_t ( std::string const & source_file, reporting_fn_t const & errors_callback, reporting_fn_t const & warnings_callback @@ -231,8 +231,8 @@ namespace yaml { namespace parser { return retval; } - template - encoding_t read_bom (pos_iterator & first, pos_iterator last) + YAML_HEADER_ONLY_INLINE + encoding_t read_bom (iterator_t & first, iterator_t last) { if (first != last && *first == 0xfeff) ++first; @@ -250,10 +250,8 @@ namespace yaml { namespace parser { boost::optional> retval; using raw_char_iterator_t = boost::u8_to_u32_iterator; - using ustring_t = std::basic_string; - using char_iterator_t = ustring_t::const_iterator; - stream_t p( + stream_t p( source_file, errors_callback, warnings_callback @@ -277,12 +275,7 @@ namespace yaml { namespace parser { raw_char_iterator_t(raw_last) }; - char_iterator_t contents_first(contents.begin()); - char_iterator_t contents_last(contents.end()); - - using iterator_t = stream_t::iterator_t; - - iterator_t first(contents_first, contents_last); + iterator_t first(&*contents.begin(), &*contents.end()); iterator_t last; first.set_tabchars(1);