QElectroTech 0.100.0-dev
Loading...
Searching...
No Matches
assignvariables.h
Go to the documentation of this file.
1/*
2 Copyright 2006-2024 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 ASSIGNVARIABLES_H
19#define ASSIGNVARIABLES_H
20#include "../diagramcontext.h"
21#include "numerotationcontext.h"
22
23#include <QPointF>
24#include <QString>
25#include <QStringList>
26
27class Diagram;
28class Element;
30
31namespace autonum
32{
34 {
35 public:
39
41 bool operator== (const sequentialNumbers &other) const;
42 bool operator!= (const sequentialNumbers &other) const;
43
44 QDomElement toXml(QDomDocument &document, const QString& tag_name = QString("sequentialNumbers")) const;
45 void fromXml(const QDomElement &element);
46 void clear();
47
48 QStringList unit;
49 QStringList unit_folio;
50 QStringList ten;
51 QStringList ten_folio;
52 QStringList hundred;
53 QStringList hundred_folio;
54 };
55
62 {
63 public:
64 static QString formulaToLabel (QString formula, sequentialNumbers &seqStruct, Diagram *diagram, const Element *elmt = nullptr);
65 static QString replaceVariable (const QString &formula, const DiagramContext &dc);
66 static QString genericXref (const Element *element);
67
68 private:
69 AssignVariables(const QString& formula, const sequentialNumbers& seqStruct , Diagram *diagram, const Element *elmt = nullptr);
71 void assignProjectVar();
72 void assignSequence();
73
74 Diagram *m_diagram = nullptr;
78 const Element *m_element = nullptr;
79 };
80
81 void setSequentialToList(QStringList &list, NumerotationContext &nc, const QString& type);
82 void setFolioSequentialToHash(QStringList &list, QHash<QString, QStringList> &hash, const QString& autoNumName);
83 void setSequential(const QString& label, autonum::sequentialNumbers &seqStruct, NumerotationContext &context, Diagram *diagram, const QString& hashKey);
85 QString elementPrefixForLocation(const ElementsLocation &location);
86}
87
89
90#endif // ASSIGNVARIABLES_H
Definition diagramcontext.h:57
The Diagram class This class represents an electric diagram. It manages its various child elements,...
Definition diagram.h:56
Definition element.h:43
The ElementsLocation class This class represents the location, the location of an element or of a cat...
Definition elementslocation.h:47
Definition numerotationcontext.h:31
The AssignVariables class This class assign variable of a formula string. Return the final string use...
Definition assignvariables.h:62
void assignTitleBlockVar()
Definition assignvariables.cpp:321
Diagram * m_diagram
Definition assignvariables.h:74
static QString replaceVariable(const QString &formula, const DiagramContext &dc)
AssignVariables::replaceVariable Replace the variables in formula in form %{my-var} to the correspond...
Definition assignvariables.cpp:210
static QString genericXref(const Element *element)
AssignVariables::genericXref.
Definition assignvariables.cpp:241
QString m_assigned_label
Definition assignvariables.h:76
static QString formulaToLabel(QString formula, sequentialNumbers &seqStruct, Diagram *diagram, const Element *elmt=nullptr)
AssignVariables::formulaToLabel Return the formula with variable assigned (ready to be displayed)
Definition assignvariables.cpp:189
const Element * m_element
Definition assignvariables.h:78
QString m_arg_formula
Definition assignvariables.h:75
void assignProjectVar()
Definition assignvariables.cpp:335
sequentialNumbers m_seq_struct
Definition assignvariables.h:77
void assignSequence()
Definition assignvariables.cpp:349
Definition assignvariables.h:34
bool operator==(const sequentialNumbers &other) const
Definition assignvariables.cpp:67
sequentialNumbers()
sequentialNumbers::sequentialNumbers
Definition assignvariables.cpp:35
QStringList hundred
Definition assignvariables.h:52
QDomElement toXml(QDomDocument &document, const QString &tag_name=QString("sequentialNumbers")) const
sequentialNumbers::toXml export this sequential numbers into a QDomElement.
Definition assignvariables.cpp:96
~sequentialNumbers()
Definition assignvariables.cpp:48
QStringList ten
Definition assignvariables.h:50
bool operator!=(const sequentialNumbers &other) const
Definition assignvariables.cpp:80
QStringList ten_folio
Definition assignvariables.h:51
void clear()
Definition assignvariables.cpp:167
QStringList unit
Definition assignvariables.h:48
sequentialNumbers & operator=(const sequentialNumbers &other)
Definition assignvariables.cpp:51
QStringList unit_folio
Definition assignvariables.h:49
void fromXml(const QDomElement &element)
sequentialNumbers::fromXml Import sequential values from a QDomElement
Definition assignvariables.cpp:140
QStringList hundred_folio
Definition assignvariables.h:53
Q_DECLARE_METATYPE(NamesList)
Definition assignvariables.cpp:31
void setFolioSequentialToHash(QStringList &list, QHash< QString, QStringList > &hash, const QString &autoNumName)
setFolioSequentialToHash Insert all value of list in hash with key autoNumName
Definition assignvariables.cpp:418
void setSequentialToList(QStringList &list, NumerotationContext &context, const QString &type)
setSequentialToList Append all sequential of type type owned by context in list
Definition assignvariables.cpp:392
QString elementPrefixForLocation(const ElementsLocation &location)
elementPrefixForLocation
Definition assignvariables.cpp:582
void setSequential(const QString &label, sequentialNumbers &seqStruct, NumerotationContext &context, Diagram *diagram, const QString &hashKey)
setSequential Fill seqStruct
Definition assignvariables.cpp:463
QString numerotationContextToFormula(const NumerotationContext &nc)
numerotationContextToFormula
Definition assignvariables.cpp:502