Skip to content
Snippets Groups Projects
Commit 82bcf1eb authored by Jan Trávníček's avatar Jan Trávníček
Browse files

fix const auto&

parent 944c4056
No related branches found
No related tags found
No related merge requests found
...@@ -14,7 +14,7 @@ namespace automaton { ...@@ -14,7 +14,7 @@ namespace automaton {
   
void AutomatonToXMLComposer::composeStates(std::list<sax::Token>& out, const std::set<State>& states) const { void AutomatonToXMLComposer::composeStates(std::list<sax::Token>& out, const std::set<State>& states) const {
out.push_back(sax::Token("states", sax::Token::TokenType::START_ELEMENT)); out.push_back(sax::Token("states", sax::Token::TokenType::START_ELEMENT));
for (auto& state : states) { for (const auto& state : states) {
out.splice(out.end(), alib::ToXMLComposers::labelComposer.compose(state.getName())); out.splice(out.end(), alib::ToXMLComposers::labelComposer.compose(state.getName()));
} }
out.push_back(sax::Token("states", sax::Token::TokenType::END_ELEMENT)); out.push_back(sax::Token("states", sax::Token::TokenType::END_ELEMENT));
...@@ -22,7 +22,7 @@ void AutomatonToXMLComposer::composeStates(std::list<sax::Token>& out, const std ...@@ -22,7 +22,7 @@ void AutomatonToXMLComposer::composeStates(std::list<sax::Token>& out, const std
   
void AutomatonToXMLComposer::composeInputAlphabet(std::list<sax::Token>& out, const std::set<alphabet::Symbol>& symbols) const { void AutomatonToXMLComposer::composeInputAlphabet(std::list<sax::Token>& out, const std::set<alphabet::Symbol>& symbols) const {
out.push_back(sax::Token("inputAlphabet", sax::Token::TokenType::START_ELEMENT)); out.push_back(sax::Token("inputAlphabet", sax::Token::TokenType::START_ELEMENT));
for (auto& symbol : symbols) { for (const auto& symbol : symbols) {
out.splice(out.end(), alib::ToXMLComposers::symbolComposer.compose(symbol)); out.splice(out.end(), alib::ToXMLComposers::symbolComposer.compose(symbol));
} }
out.push_back(sax::Token("inputAlphabet", sax::Token::TokenType::END_ELEMENT)); out.push_back(sax::Token("inputAlphabet", sax::Token::TokenType::END_ELEMENT));
...@@ -30,7 +30,7 @@ void AutomatonToXMLComposer::composeInputAlphabet(std::list<sax::Token>& out, co ...@@ -30,7 +30,7 @@ void AutomatonToXMLComposer::composeInputAlphabet(std::list<sax::Token>& out, co
   
void AutomatonToXMLComposer::composeInitialStates(std::list<sax::Token>& out, const std::set<State>& states) const { void AutomatonToXMLComposer::composeInitialStates(std::list<sax::Token>& out, const std::set<State>& states) const {
out.push_back(sax::Token("initialStates", sax::Token::TokenType::START_ELEMENT)); out.push_back(sax::Token("initialStates", sax::Token::TokenType::START_ELEMENT));
for (auto& state : states) { for (const auto& state : states) {
out.splice(out.end(), alib::ToXMLComposers::labelComposer.compose(state.getName())); out.splice(out.end(), alib::ToXMLComposers::labelComposer.compose(state.getName()));
} }
out.push_back(sax::Token("initialStates", sax::Token::TokenType::END_ELEMENT)); out.push_back(sax::Token("initialStates", sax::Token::TokenType::END_ELEMENT));
...@@ -44,7 +44,7 @@ void AutomatonToXMLComposer::composeInitialState(std::list<sax::Token>& out, con ...@@ -44,7 +44,7 @@ void AutomatonToXMLComposer::composeInitialState(std::list<sax::Token>& out, con
   
void AutomatonToXMLComposer::composeFinalStates(std::list<sax::Token>& out, const std::set<State>& states) const { void AutomatonToXMLComposer::composeFinalStates(std::list<sax::Token>& out, const std::set<State>& states) const {
out.push_back(sax::Token("finalStates", sax::Token::TokenType::START_ELEMENT)); out.push_back(sax::Token("finalStates", sax::Token::TokenType::START_ELEMENT));
for (auto& state : states) { for (const auto& state : states) {
out.splice(out.end(), alib::ToXMLComposers::labelComposer.compose(state.getName())); out.splice(out.end(), alib::ToXMLComposers::labelComposer.compose(state.getName()));
} }
out.push_back(sax::Token("finalStates", sax::Token::TokenType::END_ELEMENT)); out.push_back(sax::Token("finalStates", sax::Token::TokenType::END_ELEMENT));
...@@ -52,7 +52,7 @@ void AutomatonToXMLComposer::composeFinalStates(std::list<sax::Token>& out, cons ...@@ -52,7 +52,7 @@ void AutomatonToXMLComposer::composeFinalStates(std::list<sax::Token>& out, cons
   
void AutomatonToXMLComposer::composeStackAlphabet(std::list<sax::Token>& out, const std::set<alphabet::Symbol>& symbols) const { void AutomatonToXMLComposer::composeStackAlphabet(std::list<sax::Token>& out, const std::set<alphabet::Symbol>& symbols) const {
out.push_back(sax::Token("stackAlphabet", sax::Token::TokenType::START_ELEMENT)); out.push_back(sax::Token("stackAlphabet", sax::Token::TokenType::START_ELEMENT));
for (auto& symbol : symbols) { for (const auto& symbol : symbols) {
out.splice(out.end(), alib::ToXMLComposers::symbolComposer.compose(symbol)); out.splice(out.end(), alib::ToXMLComposers::symbolComposer.compose(symbol));
} }
out.push_back(sax::Token("stackAlphabet", sax::Token::TokenType::END_ELEMENT)); out.push_back(sax::Token("stackAlphabet", sax::Token::TokenType::END_ELEMENT));
...@@ -60,7 +60,7 @@ void AutomatonToXMLComposer::composeStackAlphabet(std::list<sax::Token>& out, co ...@@ -60,7 +60,7 @@ void AutomatonToXMLComposer::composeStackAlphabet(std::list<sax::Token>& out, co
   
void AutomatonToXMLComposer::composeInitialStackSymbols(std::list<sax::Token>& out, const std::set<alphabet::Symbol>& symbols) const { void AutomatonToXMLComposer::composeInitialStackSymbols(std::list<sax::Token>& out, const std::set<alphabet::Symbol>& symbols) const {
out.push_back(sax::Token("initialStackSymbols", sax::Token::TokenType::START_ELEMENT)); out.push_back(sax::Token("initialStackSymbols", sax::Token::TokenType::START_ELEMENT));
for (auto& symbol : symbols) { for (const auto& symbol : symbols) {
out.splice(out.end(), alib::ToXMLComposers::symbolComposer.compose(symbol)); out.splice(out.end(), alib::ToXMLComposers::symbolComposer.compose(symbol));
} }
out.push_back(sax::Token("initialStackSymbols", sax::Token::TokenType::END_ELEMENT)); out.push_back(sax::Token("initialStackSymbols", sax::Token::TokenType::END_ELEMENT));
...@@ -74,7 +74,7 @@ void AutomatonToXMLComposer::composeInitialStackSymbol(std::list<sax::Token>& ou ...@@ -74,7 +74,7 @@ void AutomatonToXMLComposer::composeInitialStackSymbol(std::list<sax::Token>& ou
   
void AutomatonToXMLComposer::composeTapeAlphabet(std::list<sax::Token>& out, const std::set<alphabet::Symbol>& symbols) const { void AutomatonToXMLComposer::composeTapeAlphabet(std::list<sax::Token>& out, const std::set<alphabet::Symbol>& symbols) const {
out.push_back(sax::Token("tapeAlphabet", sax::Token::TokenType::START_ELEMENT)); out.push_back(sax::Token("tapeAlphabet", sax::Token::TokenType::START_ELEMENT));
for (auto& symbol : symbols) { for (const auto& symbol : symbols) {
out.splice(out.end(), alib::ToXMLComposers::symbolComposer.compose(symbol)); out.splice(out.end(), alib::ToXMLComposers::symbolComposer.compose(symbol));
} }
out.push_back(sax::Token("tapeAlphabet", sax::Token::TokenType::END_ELEMENT)); out.push_back(sax::Token("tapeAlphabet", sax::Token::TokenType::END_ELEMENT));
...@@ -88,7 +88,7 @@ void AutomatonToXMLComposer::composeBlankSymbol(std::list<sax::Token>& out, cons ...@@ -88,7 +88,7 @@ void AutomatonToXMLComposer::composeBlankSymbol(std::list<sax::Token>& out, cons
   
void AutomatonToXMLComposer::composeTransitions(std::list<sax::Token>& out, const UnknownAutomaton& automaton) const { void AutomatonToXMLComposer::composeTransitions(std::list<sax::Token>& out, const UnknownAutomaton& automaton) const {
out.push_back(sax::Token("transitions", sax::Token::TokenType::START_ELEMENT)); out.push_back(sax::Token("transitions", sax::Token::TokenType::START_ELEMENT));
for (auto& transition : automaton.getTransitions()) { for (const auto& transition : automaton.getTransitions()) {
out.push_back(sax::Token("transition", sax::Token::TokenType::START_ELEMENT)); out.push_back(sax::Token("transition", sax::Token::TokenType::START_ELEMENT));
   
if (transition.hasFrom()) if (transition.hasFrom())
...@@ -121,7 +121,7 @@ void AutomatonToXMLComposer::composeTransitions(std::list<sax::Token>& out, cons ...@@ -121,7 +121,7 @@ void AutomatonToXMLComposer::composeTransitions(std::list<sax::Token>& out, cons
   
void AutomatonToXMLComposer::composeTransitions(std::list<sax::Token>& out, const DFA& automaton) const { void AutomatonToXMLComposer::composeTransitions(std::list<sax::Token>& out, const DFA& automaton) const {
out.push_back(sax::Token("transitions", sax::Token::TokenType::START_ELEMENT)); out.push_back(sax::Token("transitions", sax::Token::TokenType::START_ELEMENT));
for(auto& transition : automaton.getTransitions()) { for(const auto& transition : automaton.getTransitions()) {
out.push_back(sax::Token("transition", sax::Token::TokenType::START_ELEMENT)); out.push_back(sax::Token("transition", sax::Token::TokenType::START_ELEMENT));
   
composeTransitionFrom(out, transition.first.first); composeTransitionFrom(out, transition.first.first);
...@@ -136,8 +136,8 @@ void AutomatonToXMLComposer::composeTransitions(std::list<sax::Token>& out, cons ...@@ -136,8 +136,8 @@ void AutomatonToXMLComposer::composeTransitions(std::list<sax::Token>& out, cons
   
void AutomatonToXMLComposer::composeTransitions(std::list<sax::Token>& out, const NFA& automaton) const { void AutomatonToXMLComposer::composeTransitions(std::list<sax::Token>& out, const NFA& automaton) const {
out.push_back(sax::Token("transitions", sax::Token::TokenType::START_ELEMENT)); out.push_back(sax::Token("transitions", sax::Token::TokenType::START_ELEMENT));
for(auto& transition : automaton.getTransitions()) { for(const auto& transition : automaton.getTransitions()) {
for(auto& targetState: transition.second) { for(const auto& targetState: transition.second) {
out.push_back(sax::Token("transition", sax::Token::TokenType::START_ELEMENT)); out.push_back(sax::Token("transition", sax::Token::TokenType::START_ELEMENT));
   
composeTransitionFrom(out, transition.first.first); composeTransitionFrom(out, transition.first.first);
...@@ -153,8 +153,8 @@ void AutomatonToXMLComposer::composeTransitions(std::list<sax::Token>& out, cons ...@@ -153,8 +153,8 @@ void AutomatonToXMLComposer::composeTransitions(std::list<sax::Token>& out, cons
   
void AutomatonToXMLComposer::composeTransitions(std::list<sax::Token>& out, const EpsilonNFA& automaton) const { void AutomatonToXMLComposer::composeTransitions(std::list<sax::Token>& out, const EpsilonNFA& automaton) const {
out.push_back(sax::Token("transitions", sax::Token::TokenType::START_ELEMENT)); out.push_back(sax::Token("transitions", sax::Token::TokenType::START_ELEMENT));
for(auto& transition : automaton.getTransitions()) { for(const auto& transition : automaton.getTransitions()) {
for(auto& targetState: transition.second) { for(const auto& targetState: transition.second) {
out.push_back(sax::Token("transition", sax::Token::TokenType::START_ELEMENT)); out.push_back(sax::Token("transition", sax::Token::TokenType::START_ELEMENT));
   
composeTransitionFrom(out, transition.first.first); composeTransitionFrom(out, transition.first.first);
...@@ -188,7 +188,7 @@ void AutomatonToXMLComposer::composeTransitionShift(std::list<sax::Token>& out, ...@@ -188,7 +188,7 @@ void AutomatonToXMLComposer::composeTransitionShift(std::list<sax::Token>& out,
   
void AutomatonToXMLComposer::composeTransitionPop(std::list<sax::Token>& out, const std::vector<alphabet::Symbol>& symbols) const { void AutomatonToXMLComposer::composeTransitionPop(std::list<sax::Token>& out, const std::vector<alphabet::Symbol>& symbols) const {
out.push_back(sax::Token("pop", sax::Token::TokenType::START_ELEMENT)); out.push_back(sax::Token("pop", sax::Token::TokenType::START_ELEMENT));
for (auto& symbol : symbols) { for (const auto& symbol : symbols) {
out.splice(out.end(), alib::ToXMLComposers::symbolComposer.compose(symbol)); out.splice(out.end(), alib::ToXMLComposers::symbolComposer.compose(symbol));
} }
out.push_back(sax::Token("pop", sax::Token::TokenType::END_ELEMENT)); out.push_back(sax::Token("pop", sax::Token::TokenType::END_ELEMENT));
...@@ -196,7 +196,7 @@ void AutomatonToXMLComposer::composeTransitionPop(std::list<sax::Token>& out, co ...@@ -196,7 +196,7 @@ void AutomatonToXMLComposer::composeTransitionPop(std::list<sax::Token>& out, co
   
void AutomatonToXMLComposer::composeTransitionPush(std::list<sax::Token>& out, const std::vector<alphabet::Symbol>& symbols) const { void AutomatonToXMLComposer::composeTransitionPush(std::list<sax::Token>& out, const std::vector<alphabet::Symbol>& symbols) const {
out.push_back(sax::Token("push", sax::Token::TokenType::START_ELEMENT)); out.push_back(sax::Token("push", sax::Token::TokenType::START_ELEMENT));
for (auto& symbol : symbols) { for (const auto& symbol : symbols) {
out.splice(out.end(), alib::ToXMLComposers::symbolComposer.compose(symbol)); out.splice(out.end(), alib::ToXMLComposers::symbolComposer.compose(symbol));
} }
out.push_back(sax::Token("push", sax::Token::TokenType::END_ELEMENT)); out.push_back(sax::Token("push", sax::Token::TokenType::END_ELEMENT));
......
...@@ -103,7 +103,7 @@ std::list<sax::Token> GrammarToXMLComposer::compose(const UnrestrictedGrammar& g ...@@ -103,7 +103,7 @@ std::list<sax::Token> GrammarToXMLComposer::compose(const UnrestrictedGrammar& g
   
void GrammarToXMLComposer::composeNonterminalAlphabet(std::list<sax::Token>& out, const std::set<alphabet::Symbol>& symbols) const { void GrammarToXMLComposer::composeNonterminalAlphabet(std::list<sax::Token>& out, const std::set<alphabet::Symbol>& symbols) const {
out.push_back(sax::Token("nonterminalAlphabet", sax::Token::TokenType::START_ELEMENT)); out.push_back(sax::Token("nonterminalAlphabet", sax::Token::TokenType::START_ELEMENT));
for (auto& symbol : symbols) { for (const auto& symbol : symbols) {
out.splice(out.end(), alib::ToXMLComposers::symbolComposer.compose(symbol)); out.splice(out.end(), alib::ToXMLComposers::symbolComposer.compose(symbol));
} }
out.push_back(sax::Token("nonterminalAlphabet", sax::Token::TokenType::END_ELEMENT)); out.push_back(sax::Token("nonterminalAlphabet", sax::Token::TokenType::END_ELEMENT));
...@@ -111,7 +111,7 @@ void GrammarToXMLComposer::composeNonterminalAlphabet(std::list<sax::Token>& out ...@@ -111,7 +111,7 @@ void GrammarToXMLComposer::composeNonterminalAlphabet(std::list<sax::Token>& out
   
void GrammarToXMLComposer::composeTerminalAlphabet(std::list<sax::Token>& out, const std::set<alphabet::Symbol>& symbols) const { void GrammarToXMLComposer::composeTerminalAlphabet(std::list<sax::Token>& out, const std::set<alphabet::Symbol>& symbols) const {
out.push_back(sax::Token("terminalAlphabet", sax::Token::TokenType::START_ELEMENT)); out.push_back(sax::Token("terminalAlphabet", sax::Token::TokenType::START_ELEMENT));
for (auto& symbol : symbols) { for (const auto& symbol : symbols) {
out.splice(out.end(), alib::ToXMLComposers::symbolComposer.compose(symbol)); out.splice(out.end(), alib::ToXMLComposers::symbolComposer.compose(symbol));
} }
out.push_back(sax::Token("terminalAlphabet", sax::Token::TokenType::END_ELEMENT)); out.push_back(sax::Token("terminalAlphabet", sax::Token::TokenType::END_ELEMENT));
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment