umbrello 26.03.70-1a62d36 Umbrello UML Modeller is a Unified Modelling Language (UML) diagram program based on KDE Technology

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

petalnode.h
Go to the documentation of this file.
1/*
2 SPDX-License-Identifier: GPL-2.0-or-later
3 SPDX-FileCopyrightText: 2006-2022 Umbrello UML Modeller Authors <umbrello-devel@kde.org>
4*/
5
6#ifndef PETALNODE__H
7#define PETALNODE__H
8
9#include <QList>
10#include <QPair>
11#include <QString>
12#include <QStringList>
13
34 class PetalNode
35{
36 public:
43 struct StringOrNode {
44 QString string;
45 PetalNode *node;
46 StringOrNode() { node = nullptr; }
47 virtual ~StringOrNode() { }
48 bool isEmpty() const { return (string.isEmpty() && node == nullptr); }
49 };
50 typedef QPair<QString, StringOrNode> NameValue;
51 typedef QList<NameValue> NameValueList;
52
53 enum NodeType { nt_object, nt_list };
54
55 explicit PetalNode(NodeType nt);
56 virtual ~PetalNode();
57
58 // getters
59 NodeType type() const;
60 QStringList initialArgs() const; // name and other initial args
61 QString name() const; // convenience function: equal to initialArgs().first()
62 QString viewTag() const; // convenience function: equal to initialArgs().last()
63 QString documentation() const;
64 NameValueList attributes() const;
65
66 // setters
67 //void setType(NodeType nt); see constructor
68 void setInitialArgs(const QStringList& args);
69 void setAttributes(NameValueList vl);
70
71 // utilities
72 StringOrNode findAttribute(const QString& name) const;
73
74 private:
75 NodeType m_type;
76 QStringList m_initialArgs;
77 NameValueList m_attributes;
78
79 friend QDebug operator<<(QDebug out, const PetalNode &p);
80};
81
82QDebug operator<<(QDebug out, const PetalNode::StringOrNode &p);
83QDebug operator<<(QDebug out, const PetalNode::NameValue &p);
84QDebug operator<<(QDebug out, const PetalNode::NameValueList &p);
85QDebug operator<<(QDebug out, const PetalNode &p);
86#endif
87
PetalNode
Definition: petalnode.h:35
PetalNode::operator<<
friend QDebug operator<<(QDebug out, const PetalNode &p)
Definition: petalnode.cpp:155
PetalNode::NameValueList
QList< NameValue > NameValueList
Definition: petalnode.h:51
PetalNode::setInitialArgs
void setInitialArgs(const QStringList &args)
Definition: petalnode.cpp:131
PetalNode::initialArgs
QStringList initialArgs() const
Definition: petalnode.cpp:83
PetalNode::viewTag
QString viewTag() const
Definition: petalnode.cpp:95
PetalNode::m_attributes
NameValueList m_attributes
Definition: petalnode.h:77
PetalNode::documentation
QString documentation() const
Definition: petalnode.cpp:107
PetalNode::name
QString name() const
Definition: petalnode.cpp:88
PetalNode::m_initialArgs
QStringList m_initialArgs
Definition: petalnode.h:76
PetalNode::NameValue
QPair< QString, StringOrNode > NameValue
Definition: petalnode.h:50
PetalNode::~PetalNode
virtual ~PetalNode()
Definition: petalnode.cpp:74
PetalNode::m_type
NodeType m_type
Definition: petalnode.h:75
PetalNode::attributes
NameValueList attributes() const
Definition: petalnode.cpp:119
PetalNode::type
NodeType type() const
Definition: petalnode.cpp:78
PetalNode::NodeType
NodeType
Definition: petalnode.h:53
PetalNode::nt_object
@ nt_object
Definition: petalnode.h:53
PetalNode::nt_list
@ nt_list
Definition: petalnode.h:53
PetalNode::setAttributes
void setAttributes(NameValueList vl)
Definition: petalnode.cpp:136
PetalNode::findAttribute
StringOrNode findAttribute(const QString &name) const
Definition: petalnode.cpp:146
operator<<
QDebug operator<<(QDebug out, const PetalNode::StringOrNode &p)
Definition: petalnode.cpp:42
PetalNode::StringOrNode
Definition: petalnode.h:43
PetalNode::StringOrNode::~StringOrNode
virtual ~StringOrNode()
Definition: petalnode.h:47
PetalNode::StringOrNode::string
QString string
Definition: petalnode.h:44
PetalNode::StringOrNode::isEmpty
bool isEmpty() const
Definition: petalnode.h:48
PetalNode::StringOrNode::node
PetalNode * node
Definition: petalnode.h:45
PetalNode::StringOrNode::StringOrNode
StringOrNode()
Definition: petalnode.h:46