From 3a593003946c4faa8295cb865118630e147384de Mon Sep 17 00:00:00 2001 From: Jan Travnicek <Jan.Travnicek@fit.cvut.cz> Date: Tue, 9 Aug 2016 13:36:40 +0200 Subject: [PATCH] some more label and state creation helpers --- alib2data/src/automaton/common/State.cpp | 3 +++ alib2data/src/automaton/common/State.h | 1 + alib2data/src/label/Label.cpp | 10 ++++++++++ alib2data/src/label/Label.h | 1 + 4 files changed, 15 insertions(+) diff --git a/alib2data/src/automaton/common/State.cpp b/alib2data/src/automaton/common/State.cpp index f9fc60f8ea..93114c833b 100644 --- a/alib2data/src/automaton/common/State.cpp +++ b/alib2data/src/automaton/common/State.cpp @@ -14,6 +14,9 @@ namespace automaton { State::State(label::Label name) : name(std::move(name)) { } +State::State(label::Label name1, label::Label name2) : name ( label::labelFrom ( std::move ( name1 ), std::move ( name2 ) ) ) { +} + State::State(int number) : name(label::labelFrom(number)) { } diff --git a/alib2data/src/automaton/common/State.h b/alib2data/src/automaton/common/State.h index 0f1f76be0d..64820f1727 100644 --- a/alib2data/src/automaton/common/State.h +++ b/alib2data/src/automaton/common/State.h @@ -24,6 +24,7 @@ private: label::Label name; public: explicit State(label::Label name); + explicit State(label::Label name1, label::Label name2); explicit State(int number); explicit State(int number1, int number2); explicit State(char character); diff --git a/alib2data/src/label/Label.cpp b/alib2data/src/label/Label.cpp index 273c65c303..dc96527f90 100644 --- a/alib2data/src/label/Label.cpp +++ b/alib2data/src/label/Label.cpp @@ -43,6 +43,16 @@ label::Label labelFrom ( int number1, int number2 ) { }; } +label::Label labelFrom ( label::Label label1, label::Label label2 ) { + return label::Label { + label::LabelPairLabel { + std::make_pair ( std::move ( label1 ), + std::move ( label2 ) + ) + } + }; +} + label::Label labelFrom ( char character ) { return label::Label { label::PrimitiveLabel { diff --git a/alib2data/src/label/Label.h b/alib2data/src/label/Label.h index e4541ad332..0949a5b5e6 100644 --- a/alib2data/src/label/Label.h +++ b/alib2data/src/label/Label.h @@ -30,6 +30,7 @@ public: } }; +label::Label labelFrom ( label::Label label1, label::Label label2 ); label::Label labelFrom ( int number ); label::Label labelFrom ( int number1, int number2 ); label::Label labelFrom ( char character ); -- GitLab