aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorNao Pross <naopross@thearcway.org>2017-12-18 23:01:33 +0100
committerNao Pross <naopross@thearcway.org>2017-12-18 23:01:33 +0100
commit62bd9aa4da85ef87c4d9a9bb7911f8a4e0ac9986 (patch)
treeb7187831bb1908ad2d34eadf831bf63bfd3343b1 /src
parentAdd mainwindow.ui (diff)
downloadOrbitingYeti-62bd9aa4da85ef87c4d9a9bb7911f8a4e0ac9986.tar.gz
OrbitingYeti-62bd9aa4da85ef87c4d9a9bb7911f8a4e0ac9986.zip
Moved to QtCreator project with QMake
Diffstat (limited to 'src')
-rw-r--r--src/diagram/BranchStatement.hpp35
-rw-r--r--src/diagram/IteratorStatement.hpp32
-rw-r--r--src/diagram/Scope.hpp59
-rw-r--r--src/diagram/Statement.hpp67
-rw-r--r--src/diagram/Structogram.hpp17
-rw-r--r--src/diagram/branchstatement.cpp (renamed from src/diagram/BranchStatement.cpp)9
-rw-r--r--src/diagram/iteratorstatement.cpp (renamed from src/diagram/IteratorStatement.cpp)9
-rw-r--r--src/diagram/scope.cpp (renamed from src/diagram/Scope.cpp)7
-rw-r--r--src/diagram/statement.cpp (renamed from src/diagram/Statement.cpp)9
-rw-r--r--src/main.cpp28
-rw-r--r--src/ui/Window.cpp33
-rw-r--r--src/ui/Window.hpp28
-rw-r--r--src/ui/mainwindow.cpp14
13 files changed, 25 insertions, 322 deletions
diff --git a/src/diagram/BranchStatement.hpp b/src/diagram/BranchStatement.hpp
deleted file mode 100644
index b7cc495..0000000
--- a/src/diagram/BranchStatement.hpp
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * BranchStatement.hpp
- *
- * Created on: Nov 28, 2017
- * Author: naopross
- */
-
-#ifndef SRC_DIAGRAM_BRANCHSTATEMENT_HPP_
-#define SRC_DIAGRAM_BRANCHSTATEMENT_HPP_
-
-#include "Statement.hpp"
-
-#include <map>
-
-namespace samb {
-
-class BranchStatement: public Statement {
-public:
- BranchStatement(Type t, const std::string& condition, pointer next);
-
- /* accessors */
- const std::map<std::string, pointer>& branches() const { return m_branches; }
- std::size_t branchesCount() const { return m_branchesCount; }
-
- inline const std::string& condition() const { return text(); }
- inline void condition(const std::string& condition) { return text(condition); }
-
-private:
- std::map<std::string, pointer> m_branches;
- std::size_t m_branchesCount = 0;
-};
-
-} /* namespace samb */
-
-#endif /* SRC_DIAGRAM_BRANCHSTATEMENT_HPP_ */
diff --git a/src/diagram/IteratorStatement.hpp b/src/diagram/IteratorStatement.hpp
deleted file mode 100644
index a14d78d..0000000
--- a/src/diagram/IteratorStatement.hpp
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * IteratorStatement.hpp
- *
- * Created on: Nov 28, 2017
- * Author: naopross
- */
-
-#ifndef SRC_DIAGRAM_ITERATORSTATEMENT_HPP_
-#define SRC_DIAGRAM_ITERATORSTATEMENT_HPP_
-
-#include "Statement.hpp"
-#include "Scope.hpp"
-
-namespace samb {
-
-class IteratorStatement: public Statement {
-public:
- IteratorStatement(Type t, const std::string& condition, pointer next);
-
- /* accessors */
- const Scope& inner() const { return m_inner; }
-
- inline const std::string& condition() const { return text(); }
- inline void condition(const std::string& condition) { return text(condition); }
-
-private:
- Scope m_inner;
-};
-
-} /* namespace samb */
-
-#endif /* SRC_DIAGRAM_ITERATORSTATEMENT_HPP_ */
diff --git a/src/diagram/Scope.hpp b/src/diagram/Scope.hpp
deleted file mode 100644
index bf85759..0000000
--- a/src/diagram/Scope.hpp
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * Created on: Nov 28, 2017
- * Author: naopross
- */
-
-#ifndef SRC_DIAGRAM_SCOPE_HPP_
-#define SRC_DIAGRAM_SCOPE_HPP_
-
-#include "Statement.hpp"
-
-namespace samb {
-
-/* The Scope is a forward-iterable object that contains statements.
- * A scope is also a valid type of statement.
- *
- * The Scope object is used inside other complex types of statements such as
- * BranchStatement or a IteratorStatement, to hold the statements within their
- * scope.
- */
-class Scope : public Statement {
-public:
- class iterator {
- public:
- explicit iterator(pointer statement);
- ~iterator();
-
- iterator& operator++();
- iterator& operator++(int);
-
- Statement& operator*() const;
- Statement::pointer operator->() const;
-
- private:
- Statement::pointer m_current;
- };
-
- explicit Scope(std::string label);
- Scope(std::string label, Statement::pointer first);
- ~Scope();
-
- iterator insert_after(iterator it, Statement::pointer statement);
- iterator erase_after(iterator it);
-
- /* accessors */
- std::size_t size() const { return m_size; }
-
- /* iterator */
- iterator begin() { return iterator(m_head); }
- iterator end() { return iterator(m_tail); }
-
-private:
- Statement::pointer m_head;
- Statement::pointer m_tail;
- std::size_t m_size = 0;
-};
-
-} /* namespace samb */
-
-#endif /* SRC_DIAGRAM_SCOPE_HPP_ */
diff --git a/src/diagram/Statement.hpp b/src/diagram/Statement.hpp
deleted file mode 100644
index ab8c5b7..0000000
--- a/src/diagram/Statement.hpp
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * Statement.h
- *
- * Created on: Nov 23, 2017
- * Author: naopross
- */
-
-#ifndef SRC_DIAGRAM_STATEMENT_H_
-#define SRC_DIAGRAM_STATEMENT_H_
-
-#include <string>
-#include <memory>
-
-namespace samb {
-
-/* Possible types of statement, according to the NS diagram paper
- *
- * PROCESS : a statement that does something
- * SCOPE : simple scope to isolate variables
- * DECISION : splits the program in 2 branches based on a condition
- * SWITCH : splits the program in n branches depending on a value
- * WHILE : check first loop
- * UNTIL : check last loop
- * PARALLEL : parallel operations
- */
-
-/* This struct is a statement (link) of the iterable object Scope
- * (linked list), that is also a common interface for the various types of
- * statements.
- */
-class Statement {
-public:
- using pointer = std::shared_ptr<Statement>;
-
- enum Type {
- PROCESS,
- SCOPE,
- DECISION,
- SWITCH,
- WHILE,
- UNTIL,
- PARALLEL,
- };
-
- const Type type;
-
- Statement(Type t, const std::string& text);
- Statement(Type t, const std::string& text, pointer next);
- virtual ~Statement();
-
- bool operator==(const Statement& other) const;
-
- /* accessors */
- void next(pointer next) { m_next = next; }
- pointer next() const { return m_next; }
-
- void text(const std::string& text) { m_text = text; }
- const std::string& text() const { return m_text; }
-
-private:
- std::string m_text;
- pointer m_next;
-};
-
-} /* namespace samb */
-
-#endif /* SRC_DIAGRAM_STATEMENT_H_ */
diff --git a/src/diagram/Structogram.hpp b/src/diagram/Structogram.hpp
deleted file mode 100644
index 84a4b84..0000000
--- a/src/diagram/Structogram.hpp
+++ /dev/null
@@ -1,17 +0,0 @@
-/*
- * Structogram.hpp
- *
- * Created on: Nov 28, 2017
- * Author: naopross
- */
-
-#ifndef SRC_DIAGRAM_STRUCTOGRAM_HPP_
-#define SRC_DIAGRAM_STRUCTOGRAM_HPP_
-
-#include "Scope.hpp"
-
-namespace samb {
- typedef Scope Structogram;
-}
-
-#endif /* SRC_DIAGRAM_STRUCTOGRAM_HPP_ */
diff --git a/src/diagram/BranchStatement.cpp b/src/diagram/branchstatement.cpp
index 6345c1b..2835f35 100644
--- a/src/diagram/BranchStatement.cpp
+++ b/src/diagram/branchstatement.cpp
@@ -1,11 +1,4 @@
-/*
- * BranchStatement.cpp
- *
- * Created on: Nov 28, 2017
- * Author: naopross
- */
-
-#include "BranchStatement.hpp"
+#include "diagram/BranchStatement.hpp"
using namespace samb;
diff --git a/src/diagram/IteratorStatement.cpp b/src/diagram/iteratorstatement.cpp
index 02a7318..675d8eb 100644
--- a/src/diagram/IteratorStatement.cpp
+++ b/src/diagram/iteratorstatement.cpp
@@ -1,11 +1,4 @@
-/*
- * IteratorStatement.cpp
- *
- * Created on: Nov 28, 2017
- * Author: naopross
- */
-
-#include "IteratorStatement.hpp"
+#include "diagram/IteratorStatement.hpp"
using namespace samb;
diff --git a/src/diagram/Scope.cpp b/src/diagram/scope.cpp
index 721ee4b..a1074a3 100644
--- a/src/diagram/Scope.cpp
+++ b/src/diagram/scope.cpp
@@ -1,9 +1,4 @@
-/*
- * Created on: Nov 28, 2017
- * Author: naopross
- */
-
-#include "Scope.hpp"
+#include "diagram/Scope.hpp"
using namespace samb;
diff --git a/src/diagram/Statement.cpp b/src/diagram/statement.cpp
index 711bcf4..9cbcdb4 100644
--- a/src/diagram/Statement.cpp
+++ b/src/diagram/statement.cpp
@@ -1,11 +1,4 @@
-/*
- * Statement.cpp
- *
- * Created on: Nov 23, 2017
- * Author: naopross
- */
-
-#include "Statement.hpp"
+#include "diagram/Statement.hpp"
using namespace samb;
diff --git a/src/main.cpp b/src/main.cpp
index b4a143b..a425e2f 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -1,26 +1,12 @@
-#include "diagram/Structogram.hpp"
-#include "ui/Window.hpp"
-
-#include <iostream>
-#include <memory>
-
+#include "ui/mainwindow.h"
#include <QApplication>
+int main(int argc, char *argv[])
+{
+ QApplication a(argc, argv);
-using namespace samb;
-
-int main(int argc, char *argv[]) {
-
- QApplication app(argc, argv);
-
- Window window;
- window.show();
+ MainWindow w;
+ w.show();
- Structogram st("Example");
-
- return app.exec();
+ return a.exec();
}
-
-
-
-
diff --git a/src/ui/Window.cpp b/src/ui/Window.cpp
deleted file mode 100644
index 7f28ffe..0000000
--- a/src/ui/Window.cpp
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * Window.cpp
- *
- * Created on: Nov 26, 2017
- * Author: naopross
- */
-
-#include "Window.hpp"
-
-#include <QVBoxLayout>
-#include <QHBoxLayout>
-#include <QApplication>
-
-
-using namespace samb;
-
-Window::Window(QWidget *parent): QWidget(parent) {
- setWindowTitle("OrbitingYeti");
-
- QVBoxLayout *vBox = new QVBoxLayout(this);
- QHBoxLayout *hBox = new QHBoxLayout();
-
- m_quitBtn = new QPushButton("Quit", this);
- connect(m_quitBtn, SIGNAL(clicked()), qApp, SLOT(quit()));
-
- hBox->addWidget(m_quitBtn, 0, Qt::AlignRight);
- vBox->addStretch(1);
- vBox->addLayout(hBox);
-}
-
-Window::~Window() {
-
-}
diff --git a/src/ui/Window.hpp b/src/ui/Window.hpp
deleted file mode 100644
index 9f48f12..0000000
--- a/src/ui/Window.hpp
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Window.hpp
- *
- * Created on: Nov 26, 2017
- * Author: naopross
- */
-
-#ifndef SRC_UI_WINDOW_HPP_
-#define SRC_UI_WINDOW_HPP_
-
-#include <QWidget>
-#include <QPushButton>
-
-namespace samb {
-
-class Window : public QWidget {
-Q_OBJECT
-public:
- explicit Window(QWidget *parent = 0);
- ~Window();
-
-private:
- QPushButton *m_quitBtn;
-};
-
-} /* namespace samb */
-
-#endif /* SRC_UI_WINDOW_HPP_ */
diff --git a/src/ui/mainwindow.cpp b/src/ui/mainwindow.cpp
new file mode 100644
index 0000000..7e4ca77
--- /dev/null
+++ b/src/ui/mainwindow.cpp
@@ -0,0 +1,14 @@
+#include "ui/mainwindow.h"
+#include "ui_mainwindow.h"
+
+MainWindow::MainWindow(QWidget *parent) :
+ QMainWindow(parent),
+ ui(new Ui::MainWindow)
+{
+ ui->setupUi(this);
+}
+
+MainWindow::~MainWindow()
+{
+ delete ui;
+}