Algorithms Library Toolkit
A toolkit for algorithms, especially for algorithms on formal languages
FormalRegExpStructure.h
Go to the documentation of this file.
1
6/*
7 * This file is part of Algorithms library toolkit.
8 * Copyright (C) 2017 Jan Travnicek (jan.travnicek@fit.cvut.cz)
9
10 * Algorithms library toolkit is free software: you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation, either version 3 of the License, or
13 * (at your option) any later version.
14
15 * Algorithms library toolkit is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
19
20 * You should have received a copy of the GNU General Public License
21 * along with Algorithms library toolkit. If not, see <http://www.gnu.org/licenses/>.
22 */
23
24#pragma once
25
26namespace regexp {
27
28template < class SymbolType >
29class UnboundedRegExpStructure;
30
31} /* namespace regexp */
32
34
35#include "FormalRegExpEmpty.h"
36
37namespace regexp {
38
44template < class SymbolType >
50
51public:
55 explicit FormalRegExpStructure ( );
56
63
69 explicit FormalRegExpStructure ( const FormalRegExpElement < SymbolType > & structure );
70
77
84
91
98
104 void setStructure ( const FormalRegExpElement < SymbolType > & structure );
105
113 out << structure.getStructure ( );
114 return out;
115 }
116
126 return first.getStructure() <=> second.getStructure();
127 }
128
138 return first.getStructure() == second.getStructure();
139 }
140
147 return FormalRegExpStructure < DefaultSymbolType > ( std::move ( * std::move ( getStructure ( ) ).normalize ( ) ) );
148 }
149};
150
151template < class SymbolType >
153 setStructure ( std::move ( structure ) );
154}
155
156template < class SymbolType >
158}
159
160template < class SymbolType >
162}
163
164template < class SymbolType >
166}
167
168template < class SymbolType >
170 return * m_structure;
171}
172
173template < class SymbolType >
175 return * m_structure;
176}
177
178template < class SymbolType >
180 setStructure ( ext::move_copy ( structure ) );
181}
182
183template < class SymbolType >
185 this->m_structure = ext::smart_ptr < FormalRegExpElement < SymbolType > > ( std::move ( param ).clone ( ) );
186}
187
188} /* namespace regexp */
189
191
Definition: ostream.h:14
Managed pointer simulating value like behavior.
Definition: memory.hpp:233
Definition: FormalRegExpElement.h:62
Represents the empty expression in the regular expression. The node can't have any children.
Definition: FormalRegExpEmpty.h:41
Represents formal regular expression structure. Regular expression is stored as a tree of FormalRegEx...
Definition: FormalRegExpStructure.h:45
void setStructure(FormalRegExpElement< SymbolType > &&param)
Definition: FormalRegExpStructure.h:184
FormalRegExpStructure< DefaultSymbolType > normalize() &&
Performs the type normalization of the regexp structure.
Definition: FormalRegExpStructure.h:146
FormalRegExpStructure()
Creates a new instance of the expression structure. Defaultly created structure is empty expression.
Definition: FormalRegExpStructure.h:161
const FormalRegExpElement< SymbolType > & getStructure() const
Definition: FormalRegExpStructure.h:169
friend ext::ostream & operator<<(ext::ostream &out, const FormalRegExpStructure< SymbolType > &structure)
Strucuture printer to the stream.
Definition: FormalRegExpStructure.h:112
friend bool operator==(const FormalRegExpStructure< SymbolType > &first, const FormalRegExpStructure< SymbolType > &second)
Equality operator implementation for the expression structure.
Definition: FormalRegExpStructure.h:137
friend bool operator<=>(const FormalRegExpStructure< SymbolType > &first, const FormalRegExpStructure< SymbolType > &second)
Three way comparison operator implementation for the expression structure.
Definition: FormalRegExpStructure.h:125
Represents unbounded regular expression structure. Regular expression is stored as a tree of Unbounde...
Definition: UnboundedRegExpStructure.h:47
p second
Definition: ToRegExpAlgebraic.h:126
auto move_copy(const T &param)
Allow moving of copied instance of the source.
Definition: utility.hpp:45
Definition: ToAutomaton.h:15