QElectroTech  0.8-dev
numerotationcontextcommands.h
Go to the documentation of this file.
1 /*
2  Copyright 2006-2020 The QElectroTech Team
3  This file is part of QElectroTech.
4 
5  QElectroTech is free software: you can redistribute it and/or modify
6  it under the terms of the GNU General Public License as published by
7  the Free Software Foundation, either version 2 of the License, or
8  (at your option) any later version.
9 
10  QElectroTech is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  GNU General Public License for more details.
14 
15  You should have received a copy of the GNU General Public License
16  along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
17 */
18 #ifndef NUMEROTATIONCONTEXTCOMMANDS_H
19 #define NUMEROTATIONCONTEXTCOMMANDS_H
20 
21 #include "numerotationcontext.h"
22 
23 class NumStrategy;
24 class Diagram;
25 
31 {
32  public:
37  QString toRepresentedString ();
38 
39  private:
40  void setNumStrategy (const QString &);
41 
45 };
46 
48 {
49  public:
50  NumStrategy (Diagram * = nullptr);
51  virtual ~NumStrategy ();
52  virtual QString toRepresentedString (const QString) const = 0;
53  virtual NumerotationContext next (const NumerotationContext &, const int) const = 0;
54  virtual NumerotationContext previous (const NumerotationContext &, const int) const = 0;
55 
56  protected:
57  NumerotationContext nextString (const NumerotationContext &, const int) const;
58  NumerotationContext nextNumber (const NumerotationContext &, const int) const;
59  NumerotationContext previousNumber (const NumerotationContext &, const int) const;
60 
62 };
63 
64 class UnitNum: public NumStrategy
65 {
66  public:
67  UnitNum (Diagram *);
68  QString toRepresentedString(const QString) const override;
69  NumerotationContext next (const NumerotationContext &, const int) const override;
70  NumerotationContext previous (const NumerotationContext &, const int) const override;
71 };
72 
73 class UnitFNum: public NumStrategy
74 {
75  public:
76  UnitFNum (Diagram *);
77  QString toRepresentedString(const QString) const override;
78  NumerotationContext next (const NumerotationContext &, const int) const override;
79  NumerotationContext previous (const NumerotationContext &, const int) const override;
80 };
81 
82 class TenNum: public NumStrategy
83 {
84  public:
85  TenNum (Diagram *);
86  QString toRepresentedString(const QString) const override;
87  NumerotationContext next (const NumerotationContext &, const int) const override;
88  NumerotationContext previous (const NumerotationContext &, const int) const override;
89 };
90 
91 class TenFNum: public NumStrategy
92 {
93  public:
94  TenFNum (Diagram *);
95  QString toRepresentedString(const QString) const override;
96  NumerotationContext next (const NumerotationContext &, const int) const override;
97  NumerotationContext previous (const NumerotationContext &, const int) const override;
98 };
99 
100 class HundredNum: public NumStrategy
101 {
102  public:
103  HundredNum (Diagram *);
104  QString toRepresentedString(const QString) const override;
105  NumerotationContext next (const NumerotationContext &, const int) const override;
106  NumerotationContext previous (const NumerotationContext &, const int) const override;
107 };
108 
110 {
111  public:
112  HundredFNum (Diagram *);
113  QString toRepresentedString(const QString) const override;
114  NumerotationContext next (const NumerotationContext &, const int) const override;
115  NumerotationContext previous (const NumerotationContext &, const int) const override;
116 };
117 
118 class StringNum: public NumStrategy
119 {
120  public:
121  StringNum (Diagram *);
122  QString toRepresentedString(const QString) const override;
123  NumerotationContext next (const NumerotationContext &, const int) const override;
124  NumerotationContext previous (const NumerotationContext &, const int) const override;
125 };
126 
127 class IdFolioNum: public NumStrategy
128 {
129  public:
130  IdFolioNum (Diagram *);
131  QString toRepresentedString(const QString) const override;
132  NumerotationContext next (const NumerotationContext &, const int) const override;
133  NumerotationContext previous (const NumerotationContext &, const int) const override;
134 };
135 
136 class FolioNum: public NumStrategy
137 {
138  public:
139  FolioNum (Diagram *);
140  QString toRepresentedString(const QString) const override;
141  NumerotationContext next (const NumerotationContext &, const int) const override;
142  NumerotationContext previous (const NumerotationContext &, const int) const override;
143 };
144 
145 class PlantNum: public NumStrategy
146 {
147  public:
148  PlantNum (Diagram *);
149  QString toRepresentedString(const QString) const override;
150  NumerotationContext next (const NumerotationContext &, const int) const override;
151  NumerotationContext previous (const NumerotationContext &, const int) const override;
152 };
153 
154 class LocmachNum: public NumStrategy
155 {
156  public:
157  LocmachNum (Diagram *);
158  QString toRepresentedString(const QString) const override;
159  NumerotationContext next (const NumerotationContext &, const int) const override;
160  NumerotationContext previous (const NumerotationContext &, const int) const override;
161 };
162 
163 
165 {
166  public:
168  QString toRepresentedString(const QString) const override;
169  NumerotationContext next (const NumerotationContext &, const int) const override;
170  NumerotationContext previous (const NumerotationContext &, const int) const override;
171 };
172 
174 {
175  public:
177  QString toRepresentedString(const QString) const override;
178  NumerotationContext next (const NumerotationContext &, const int) const override;
179  NumerotationContext previous (const NumerotationContext &, const int) const override;
180 };
181 
183 {
184  public:
186  QString toRepresentedString(const QString) const override;
187  NumerotationContext next (const NumerotationContext &, const int) const override;
188  NumerotationContext previous (const NumerotationContext &, const int) const override;
189 };
190 
191 
192 #endif // NUMEROTATIONCONTEXTCOMMANDS_H
ElementLineNum
Definition: numerotationcontextcommands.h:165
HundredNum
Definition: numerotationcontextcommands.h:101
NumStrategy::next
virtual NumerotationContext next(const NumerotationContext &, const int) const =0
FolioNum::next
NumerotationContext next(const NumerotationContext &, const int) const override
FolioNum::next.
Definition: numerotationcontextcommands.cpp:490
NumerotationContextCommands::setNumStrategy
void setNumStrategy(const QString &)
NumerotationContextCommands::setNumStrategy apply the good strategy relative to str.
Definition: numerotationcontextcommands.cpp:89
NumerotationContextCommands::strategy_
NumStrategy * strategy_
Definition: numerotationcontextcommands.h:44
ElementColumnNum
Definition: numerotationcontextcommands.h:174
StringNum::StringNum
StringNum(Diagram *)
Definition: numerotationcontextcommands.cpp:410
TenNum::TenNum
TenNum(Diagram *)
Definition: numerotationcontextcommands.cpp:263
ElementColumnNum::ElementColumnNum
ElementColumnNum(Diagram *)
Definition: numerotationcontextcommands.cpp:603
HundredNum::previous
NumerotationContext previous(const NumerotationContext &, const int) const override
HundredNum::previous.
Definition: numerotationcontextcommands.cpp:364
TenNum::toRepresentedString
QString toRepresentedString(const QString) const override
TenNum::toRepresentedString.
Definition: numerotationcontextcommands.cpp:271
IdFolioNum
Definition: numerotationcontextcommands.h:128
NumerotationContextCommands::previous
NumerotationContext previous()
NumerotationContextCommands::previous.
Definition: numerotationcontextcommands.cpp:56
UnitFNum::UnitFNum
UnitFNum(Diagram *)
Definition: numerotationcontextcommands.cpp:232
FolioNum::toRepresentedString
QString toRepresentedString(const QString) const override
FolioNum::toRepresentedString.
Definition: numerotationcontextcommands.cpp:481
FolioNum
Definition: numerotationcontextcommands.h:137
UnitFNum::toRepresentedString
QString toRepresentedString(const QString) const override
UnitFNum::toRepresentedString.
Definition: numerotationcontextcommands.cpp:240
UnitFNum::previous
NumerotationContext previous(const NumerotationContext &, const int) const override
UnitFNum::previous.
Definition: numerotationcontextcommands.cpp:256
ElementColumnNum::toRepresentedString
QString toRepresentedString(const QString) const override
ElementColumnNum::toRepresentedString.
Definition: numerotationcontextcommands.cpp:611
PlantNum::previous
NumerotationContext previous(const NumerotationContext &, const int) const override
PlantNum::previous.
Definition: numerotationcontextcommands.cpp:530
NumStrategy::diagram_
Diagram * diagram_
Definition: numerotationcontextcommands.h:61
PlantNum::next
NumerotationContext next(const NumerotationContext &, const int) const override
PlantNum::next.
Definition: numerotationcontextcommands.cpp:522
NumStrategy::previousNumber
NumerotationContext previousNumber(const NumerotationContext &, const int) const
NumStrategy::previousNumber.
Definition: numerotationcontextcommands.cpp:189
NumStrategy
Definition: numerotationcontextcommands.h:48
ElementPrefixNum::next
NumerotationContext next(const NumerotationContext &, const int) const override
ElementPrefixNum::next.
Definition: numerotationcontextcommands.cpp:652
NumerotationContextCommands
The NumerotationContextCommands class this class provide methods to handle content of NumerotationCon...
Definition: numerotationcontextcommands.h:31
NumStrategy::previous
virtual NumerotationContext previous(const NumerotationContext &, const int) const =0
IdFolioNum::previous
NumerotationContext previous(const NumerotationContext &, const int) const override
IdFolioNum::previous.
Definition: numerotationcontextcommands.cpp:466
NumerotationContext
Definition: numerotationcontext.h:31
HundredFNum::HundredFNum
HundredFNum(Diagram *)
Definition: numerotationcontextcommands.cpp:371
IdFolioNum::toRepresentedString
QString toRepresentedString(const QString) const override
IdFolioNum::toRepresentedString.
Definition: numerotationcontextcommands.cpp:449
ElementColumnNum::next
NumerotationContext next(const NumerotationContext &, const int) const override
ElementColumnNum::next.
Definition: numerotationcontextcommands.cpp:620
HundredFNum::previous
NumerotationContext previous(const NumerotationContext &, const int) const override
HundredFNum::previous.
Definition: numerotationcontextcommands.cpp:403
NumerotationContext::size
int size() const
NumerotationContext::size.
Definition: numerotationcontext.cpp:93
NumerotationContextCommands::NumerotationContextCommands
NumerotationContextCommands(const NumerotationContext &, Diagram *=nullptr)
Constructor.
Definition: numerotationcontextcommands.cpp:24
numerotationcontextcommands.h
NumStrategy::NumStrategy
NumStrategy(Diagram *=nullptr)
Definition: numerotationcontextcommands.cpp:154
StringNum::next
NumerotationContext next(const NumerotationContext &, const int) const override
StringNum::next.
Definition: numerotationcontextcommands.cpp:426
NumerotationContextCommands::next
NumerotationContext next()
NumerotationContextCommands::next.
Definition: numerotationcontextcommands.cpp:41
ElementPrefixNum::ElementPrefixNum
ElementPrefixNum(Diagram *)
Definition: numerotationcontextcommands.cpp:635
Diagram
The Diagram class This class represents an electric diagram. It manages its various child elements,...
Definition: diagram.h:56
TenNum::previous
NumerotationContext previous(const NumerotationContext &, const int) const override
TenNum::previous.
Definition: numerotationcontextcommands.cpp:290
TenFNum::previous
NumerotationContext previous(const NumerotationContext &, const int) const override
TenFNum::previous.
Definition: numerotationcontextcommands.cpp:324
LocmachNum::previous
NumerotationContext previous(const NumerotationContext &, const int) const override
LocmachNum::previous.
Definition: numerotationcontextcommands.cpp:563
IdFolioNum::IdFolioNum
IdFolioNum(Diagram *)
Definition: numerotationcontextcommands.cpp:441
NumStrategy::nextString
NumerotationContext nextString(const NumerotationContext &, const int) const
NumStrategy::nextString.
Definition: numerotationcontextcommands.cpp:164
FolioNum::FolioNum
FolioNum(Diagram *)
Definition: numerotationcontextcommands.cpp:473
NumStrategy::~NumStrategy
virtual ~NumStrategy()
Definition: numerotationcontextcommands.cpp:158
PlantNum::PlantNum
PlantNum(Diagram *)
Definition: numerotationcontextcommands.cpp:505
HundredFNum::toRepresentedString
QString toRepresentedString(const QString) const override
HundredFNum::toRepresentedString.
Definition: numerotationcontextcommands.cpp:379
ElementColumnNum::previous
NumerotationContext previous(const NumerotationContext &, const int) const override
ElementColumnNum::previous.
Definition: numerotationcontextcommands.cpp:628
PlantNum::toRepresentedString
QString toRepresentedString(const QString) const override
PlantNum::toRepresentedString.
Definition: numerotationcontextcommands.cpp:513
PlantNum
Definition: numerotationcontextcommands.h:146
HundredNum::HundredNum
HundredNum(Diagram *)
Definition: numerotationcontextcommands.cpp:332
IdFolioNum::next
NumerotationContext next(const NumerotationContext &, const int) const override
IdFolioNum::next.
Definition: numerotationcontextcommands.cpp:458
UnitNum::next
NumerotationContext next(const NumerotationContext &, const int) const override
UnitNum::next.
Definition: numerotationcontextcommands.cpp:217
HundredFNum::next
NumerotationContext next(const NumerotationContext &, const int) const override
HundredFNum::next.
Definition: numerotationcontextcommands.cpp:395
numerotationcontext.h
ElementPrefixNum
Definition: numerotationcontextcommands.h:183
StringNum::toRepresentedString
QString toRepresentedString(const QString) const override
StringNum::toRepresentedString.
Definition: numerotationcontextcommands.cpp:418
NumStrategy::nextNumber
NumerotationContext nextNumber(const NumerotationContext &, const int) const
NumStrategy::nextNumber.
Definition: numerotationcontextcommands.cpp:176
UnitFNum::next
NumerotationContext next(const NumerotationContext &, const int) const override
UnitFNum::next.
Definition: numerotationcontextcommands.cpp:248
ElementPrefixNum::previous
NumerotationContext previous(const NumerotationContext &, const int) const override
ElementPrefixNum::previous.
Definition: numerotationcontextcommands.cpp:660
UnitFNum
Definition: numerotationcontextcommands.h:74
ElementLineNum::previous
NumerotationContext previous(const NumerotationContext &, const int) const override
ElementLineNum::previous.
Definition: numerotationcontextcommands.cpp:596
NumerotationContextCommands::~NumerotationContextCommands
~NumerotationContextCommands()
Destructor.
Definition: numerotationcontextcommands.cpp:33
UnitNum::UnitNum
UnitNum(Diagram *)
Definition: numerotationcontextcommands.cpp:201
NumStrategy::toRepresentedString
virtual QString toRepresentedString(const QString) const =0
NumerotationContextCommands::diagram_
Diagram * diagram_
Definition: numerotationcontextcommands.h:42
ElementLineNum::ElementLineNum
ElementLineNum(Diagram *)
Definition: numerotationcontextcommands.cpp:571
NumerotationContext::addValue
bool addValue(const QString &, const QVariant &=QVariant(1), const int=1, const int=0)
NumerotationContext::addValue add a new value on the contexte.
Definition: numerotationcontext.cpp:52
HundredNum::toRepresentedString
QString toRepresentedString(const QString) const override
HundredNum::toRepresentedString.
Definition: numerotationcontextcommands.cpp:340
TenNum
Definition: numerotationcontextcommands.h:83
NumerotationContextCommands::context_
NumerotationContext context_
Definition: numerotationcontextcommands.h:43
NumerotationContext::itemAt
QStringList itemAt(const int) const
NumerotationContext::itemAt.
Definition: numerotationcontext.cpp:110
FolioNum::previous
NumerotationContext previous(const NumerotationContext &, const int) const override
FolioNum::previous.
Definition: numerotationcontextcommands.cpp:498
StringNum::previous
NumerotationContext previous(const NumerotationContext &, const int) const override
StringNum::previous.
Definition: numerotationcontextcommands.cpp:434
TenFNum::toRepresentedString
QString toRepresentedString(const QString) const override
TenFNum::toRepresentedString.
Definition: numerotationcontextcommands.cpp:305
UnitNum::toRepresentedString
QString toRepresentedString(const QString) const override
UnitNum::toRepresentedString.
Definition: numerotationcontextcommands.cpp:209
TenFNum::next
NumerotationContext next(const NumerotationContext &, const int) const override
TenFNum::next.
Definition: numerotationcontextcommands.cpp:316
LocmachNum
Definition: numerotationcontextcommands.h:155
TenFNum
Definition: numerotationcontextcommands.h:92
ElementPrefixNum::toRepresentedString
QString toRepresentedString(const QString) const override
ElementPrefixNum::toRepresentedString.
Definition: numerotationcontextcommands.cpp:643
HundredNum::next
NumerotationContext next(const NumerotationContext &, const int) const override
HundredNum::next.
Definition: numerotationcontextcommands.cpp:356
LocmachNum::next
NumerotationContext next(const NumerotationContext &, const int) const override
LocmachNum::next.
Definition: numerotationcontextcommands.cpp:555
UnitNum
Definition: numerotationcontextcommands.h:65
LocmachNum::toRepresentedString
QString toRepresentedString(const QString) const override
LocmachNum::toRepresentedString.
Definition: numerotationcontextcommands.cpp:546
TenFNum::TenFNum
TenFNum(Diagram *)
Definition: numerotationcontextcommands.cpp:297
StringNum
Definition: numerotationcontextcommands.h:119
HundredFNum
Definition: numerotationcontextcommands.h:110
UnitNum::previous
NumerotationContext previous(const NumerotationContext &, const int) const override
UnitNum::previous.
Definition: numerotationcontextcommands.cpp:225
ElementLineNum::next
NumerotationContext next(const NumerotationContext &, const int) const override
ElementLineNum::next.
Definition: numerotationcontextcommands.cpp:588
diagram.h
LocmachNum::LocmachNum
LocmachNum(Diagram *)
Definition: numerotationcontextcommands.cpp:538
NumerotationContextCommands::toRepresentedString
QString toRepresentedString()
NumerotationContextCommands::toFinalString.
Definition: numerotationcontextcommands.cpp:71
TenNum::next
NumerotationContext next(const NumerotationContext &, const int) const override
TenNum::next.
Definition: numerotationcontextcommands.cpp:282
ElementLineNum::toRepresentedString
QString toRepresentedString(const QString) const override
ElementLineNum::toRepresentedString.
Definition: numerotationcontextcommands.cpp:579