Algorithms Library Toolkit
A toolkit for algorithms, especially for algorithms on formal languages
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Concepts
ObjectsPair.h
Go to the documentation of this file.
1
6#pragma once
7
8#include <alib/pair>
9#include <core/xmlApi.hpp>
10
11namespace core {
12
13template < typename T, typename R >
14struct xmlApi < std::pair < T, R > > {
15 static std::pair < T, R > parse ( ext::deque < sax::Token >::iterator & input );
16 static bool first ( const ext::deque < sax::Token >::const_iterator & input );
17 static std::string xmlTagName ( );
18 static void compose ( ext::deque < sax::Token > & output, const std::pair < T, R > & input );
19};
20
21template < typename T, typename R >
24
25 T first = core::xmlApi < T >::parse ( input );
27
29
30 return std::make_pair ( std::move ( first ), std::move ( second ) );
31}
32
33template < typename T, typename R >
36}
37
38template < typename T, typename R >
39std::string xmlApi < std::pair < T, R > >::xmlTagName ( ) {
40 return "Pair";
41}
42
43template < typename T, typename R >
44void xmlApi < std::pair < T, R > >::compose ( ext::deque < sax::Token > & output, const std::pair < T, R > & input ) {
45 output.emplace_back ( xmlTagName ( ), sax::Token::TokenType::START_ELEMENT );
46
47 core::xmlApi < typename std::decay < T >::type >::compose ( output, input.first );
48 core::xmlApi < R >::compose ( output, input.second );
49
50 output.emplace_back ( xmlTagName ( ), sax::Token::TokenType::END_ELEMENT );
51}
52
53template < typename T, typename R >
54struct xmlApi < ext::pair < T, R > > {
56 static bool first ( const ext::deque < sax::Token >::const_iterator & input );
57 static std::string xmlTagName ( );
58 static void compose ( ext::deque < sax::Token > & output, const ext::pair < T, R > & input );
59};
60
61template < typename T, typename R >
64
65 T first = core::xmlApi < T >::parse ( input );
67
69
70 return ext::make_pair ( std::move ( first ), std::move ( second ) );
71}
72
73template < typename T, typename R >
75 return xmlApi < std::pair < T, R > >::first ( input );
76}
77
78template < typename T, typename R >
79std::string xmlApi < ext::pair < T, R > >::xmlTagName ( ) {
80 return xmlApi < std::pair < T, R > >::xmlTagName ( );
81}
82
83template < typename T, typename R >
85 xmlApi < std::pair < T, R > >::compose ( output, input );
86}
87
88} /* namespace core */
89
Class extending the deque class from the standard library. Original reason is to allow printing of th...
Definition: deque.hpp:44
Class extending the pair class from the standard library. Original reason is to allow printing of the...
Definition: pair.hpp:43
static void popToken(ext::deque< Token >::iterator &input, Token::TokenType type, const std::string &data)
Definition: FromXMLParserHelper.cpp:39
static bool isToken(ext::deque< Token >::const_iterator input, Token::TokenType type, const std::string &data)
Definition: FromXMLParserHelper.cpp:29
p second
Definition: ToRegExpAlgebraic.h:126
Definition: normalize.hpp:10
Definition: sigHandler.cpp:20
constexpr auto make_pair(T1 &&x, T2 &&y)
Definition: pair.hpp:79
Definition: FordFulkerson.hpp:16
Definition: xmlApi.hpp:27