aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.gitignore6
-rw-r--r--README.md8
-rw-r--r--src/diagram/BranchStatement.hpp11
-rw-r--r--src/diagram/Statement.cpp2
-rw-r--r--src/diagram/Statement.hpp16
5 files changed, 27 insertions, 16 deletions
diff --git a/.gitignore b/.gitignore
index c0077e2..7ef3fb8 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,3 +1,9 @@
Debug
Release
+# editors
+
+**/*.sublime-workspace
+**/*.sublime-project
+
+**/*.swp \ No newline at end of file
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..80ed6b2
--- /dev/null
+++ b/README.md
@@ -0,0 +1,8 @@
+# OrbitingYeti: a tool to write Nassi-Schneidermann diagrams
+
+
+## TO DO list / Roadmap
+
+[ ] Structogram data structure
+[ ] GUI with Qt4 / Qt5
+[ ] PDF Generator \ No newline at end of file
diff --git a/src/diagram/BranchStatement.hpp b/src/diagram/BranchStatement.hpp
index dacf060..1f07e5a 100644
--- a/src/diagram/BranchStatement.hpp
+++ b/src/diagram/BranchStatement.hpp
@@ -10,17 +10,20 @@
#include "Statement.hpp"
+#include <map>
+
namespace samb {
class BranchStatement: public Statement {
public:
BranchStatement(Type t, const std::string& condition, pointer next);
- const std::string& condition() const { return text(); }
- void condition(const std::string& condition) { return text(condition); }
+ /* accessors */
+ const std::map<std::string, pointer>& branches() const { return m_branches; }
+ std::size_t branchesCount() const { return m_branchesCount; }
- std::vector<std::string> branches();
- std::size_t 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;
diff --git a/src/diagram/Statement.cpp b/src/diagram/Statement.cpp
index d708dd9..dc4bfb7 100644
--- a/src/diagram/Statement.cpp
+++ b/src/diagram/Statement.cpp
@@ -10,6 +10,8 @@
namespace samb {
/* Statement */
+
+Statement::Statement(Type t, const std::string& text): type(t), m_text(text), m_next(nullptr) {}
Statement::Statement(Type t, const std::string& text, Statement::pointer p): type(t), m_text(text), m_next(p) {}
Statement::~Statement() {}
diff --git a/src/diagram/Statement.hpp b/src/diagram/Statement.hpp
index 4eb3b4d..0c769ba 100644
--- a/src/diagram/Statement.hpp
+++ b/src/diagram/Statement.hpp
@@ -10,19 +10,17 @@
#include <string>
#include <memory>
-#include <vector>
-#include <map>
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 : repeat first loop
* UNTIL : repeat last loop
- * SCOPE : simple scope to isolate variables
* PARALLEL : parallel operations
*/
@@ -36,24 +34,18 @@ public:
enum Type {
PROCESS,
+ SCOPE,
DECISION,
SWITCH,
WHILE,
UNTIL,
- SCOPE,
PARALLEL,
-
- /* this type of statement indicates the end of the program
- * and it is used only internally
- *
- * TODO: think of something more elegant to solve this
- */
- END
};
const Type type;
- Statement(Type type, const std::string& text, pointer next);
+ Statement(Type t, const std::string& text);
+ Statement(Type t, const std::string& text, pointer next);
virtual ~Statement();
bool operator==(const Statement& other) const;