Algorithms Library Toolkit
A toolkit for algorithms, especially for algorithms on formal languages
UnboundedRegExpStructure.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
36
37#include "../formal/FormalRegExpStructure.h"
38
39namespace regexp {
40
46template < class SymbolType >
52
53public:
57 explicit UnboundedRegExpStructure ( );
58
65
72
79
86
93
100
106 void setStructure ( const UnboundedRegExpElement < SymbolType > & structure );
107
115 out << structure.getStructure ( );
116 return out;
117 }
118
127 friend std::strong_ordering operator <=> ( const UnboundedRegExpStructure & first, const UnboundedRegExpStructure & second ) {
128 return first.getStructure() <=> second.getStructure();
129 }
130
140 return first.getStructure() == second.getStructure();
141 }
142
149 return UnboundedRegExpStructure < DefaultSymbolType > ( std::move ( * std::move ( getStructure ( ) ).normalize ( ) ) );
150 }
151};
152
153template < class SymbolType >
155 setStructure ( std::move ( structure ) );
156}
157
158template < class SymbolType >
160}
161
162template < class SymbolType >
164}
165
166template < class SymbolType >
168}
169
170template < class SymbolType >
172 return * m_structure;
173}
174
175template < class SymbolType >
177 return * m_structure;
178}
179
180template < class SymbolType >
182 setStructure ( ext::move_copy ( structure ) );
183}
184
185template < class SymbolType >
187 this->m_structure = ext::smart_ptr < UnboundedRegExpElement < SymbolType > > ( std::move ( param ).clone ( ) );
188}
189
190} /* namespace regexp */
191
193
Definition: ostream.h:14
Managed pointer simulating value like behavior.
Definition: memory.hpp:233
Represents formal regular expression structure. Regular expression is stored as a tree of FormalRegEx...
Definition: FormalRegExpStructure.h:45
Definition: UnboundedRegExpElement.h:62
Represents the empty expression in the regular expression. The node can't have any children.
Definition: UnboundedRegExpEmpty.h:41
Represents unbounded regular expression structure. Regular expression is stored as a tree of Unbounde...
Definition: UnboundedRegExpStructure.h:47
void setStructure(UnboundedRegExpElement< SymbolType > &&param)
Definition: UnboundedRegExpStructure.h:186
friend std::strong_ordering operator<=>(const UnboundedRegExpStructure &first, const UnboundedRegExpStructure &second)
Three way comparison operator implementation for the expression structure.
Definition: UnboundedRegExpStructure.h:127
friend ext::ostream & operator<<(ext::ostream &out, const UnboundedRegExpStructure< SymbolType > &structure)
Strucuture printer to the stream.
Definition: UnboundedRegExpStructure.h:114
UnboundedRegExpStructure()
Creates a new instance of the expression structure. Defaultly created structure is empty expression.
Definition: UnboundedRegExpStructure.h:163
const UnboundedRegExpElement< SymbolType > & getStructure() const
Definition: UnboundedRegExpStructure.h:171
UnboundedRegExpStructure< DefaultSymbolType > normalize() &&
Performs the type normalization of the regexp structure.
Definition: UnboundedRegExpStructure.h:148
friend bool operator==(const UnboundedRegExpStructure &first, const UnboundedRegExpStructure &second)
Equality operator implementation for the expression structure.
Definition: UnboundedRegExpStructure.h:139
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