aboutsummaryrefslogtreecommitdiffstats
path: root/include/diagram
diff options
context:
space:
mode:
authorNao Pross <naopross@thearcway.org>2018-01-01 18:44:35 +0100
committerNao Pross <naopross@thearcway.org>2018-01-01 18:44:35 +0100
commit7ea534dd1c8bf72200a999cae554d842d9035ba9 (patch)
tree6b2438ea6f7c27c8069458d599bfbf2ba5534ce7 /include/diagram
parentImplement basic ui (diff)
downloadOrbitingYeti-7ea534dd1c8bf72200a999cae554d842d9035ba9.tar.gz
OrbitingYeti-7ea534dd1c8bf72200a999cae554d842d9035ba9.zip
New StatementDialog, rename diagram classes
Other changes: - Use raw pointer instead of smart pointers to manage resources - Initial Painter implementation
Diffstat (limited to '')
-rw-r--r--include/diagram/branch.h (renamed from include/diagram/branchstatement.h)6
-rw-r--r--include/diagram/iterator.h (renamed from include/diagram/iteratorstatement.h)4
-rw-r--r--include/diagram/scope.h11
-rw-r--r--include/diagram/statement.h6
4 files changed, 18 insertions, 9 deletions
diff --git a/include/diagram/branchstatement.h b/include/diagram/branch.h
index 3d8c385..2024d78 100644
--- a/include/diagram/branchstatement.h
+++ b/include/diagram/branch.h
@@ -10,14 +10,14 @@ namespace samb {
/* Implementation for Statement::DECISION, Statement::SWITCH
*/
-class BranchStatement : public Statement
+class Branch : public Statement
{
public:
- BranchStatement(Type t, const QString &condition, pointer next);
+ Branch(Type t, const QString &condition, pointer next);
/* accessors */
std::map<QString, pointer>& branches() { return _branches; }
- std::size_t branches_count() const { return _branchesCount; }
+ std::size_t branchesCount() const { return _branchesCount; }
inline const QString& condition() const { return text(); }
inline void condition(const QString &condition) { return text(condition); }
diff --git a/include/diagram/iteratorstatement.h b/include/diagram/iterator.h
index e7fbba0..71c6a34 100644
--- a/include/diagram/iteratorstatement.h
+++ b/include/diagram/iterator.h
@@ -10,10 +10,10 @@ namespace samb {
/* Implementation for Statement::WHILE Statement::UNTIL
*/
-class IteratorStatement : public Statement
+class Iterator : public Statement
{
public:
- IteratorStatement(Type t, const QString &condition, pointer next);
+ Iterator(Type t, const QString &condition, pointer next);
/* accessors */
Scope& inner() { return _inner; }
diff --git a/include/diagram/scope.h b/include/diagram/scope.h
index 63698dd..8ae7e79 100644
--- a/include/diagram/scope.h
+++ b/include/diagram/scope.h
@@ -22,6 +22,9 @@ public:
explicit iterator(pointer statement);
~iterator();
+ bool operator==(const iterator &other) const;
+ bool operator!=(const iterator &other) const;
+
iterator& operator++();
iterator& operator++(int);
@@ -32,7 +35,7 @@ public:
Statement::pointer _current;
};
- explicit Scope(const QString &label);
+ Scope(const QString &label);
Scope(const QString &label, Statement::pointer first);
virtual ~Scope();
@@ -43,8 +46,10 @@ public:
std::size_t size() const { return _size; }
/* iterator */
- iterator begin() { return iterator(_head); }
- iterator end() { return iterator(_tail); }
+ iterator begin();
+ const iterator begin() const;
+ iterator end();
+ const iterator end() const;
private:
Statement::pointer _head;
diff --git a/include/diagram/statement.h b/include/diagram/statement.h
index 5cce908..1d44d6a 100644
--- a/include/diagram/statement.h
+++ b/include/diagram/statement.h
@@ -26,7 +26,8 @@ namespace samb {
class Statement
{
public:
- using pointer = std::shared_ptr<Statement>;
+// using pointer = std::shared_ptr<Statement>;
+ using pointer = Statement*;
enum Type {
PROCESS,
@@ -40,6 +41,9 @@ public:
const Type type;
+ template<class... Args>
+ static pointer make(Type t, Args&& ...args);
+
Statement(Type t, const QString &text);
Statement(Type t, const QString &text, pointer next);
virtual ~Statement();