aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorRenaud G <renaud@rolisteam.org>2015-05-05 07:03:46 +0200
committerRenaud G <renaud@rolisteam.org>2015-05-05 07:03:46 +0200
commite844799045b0b3a4d8a968e011c96c10003d4256 (patch)
tree1e0d159489152769c87295e5c33e574d25ebc6a6
parent590fc6528b09bf1abbd90caf31053cd5ef6b439b (diff)
parent6dbf254b7d5b19b77eb4716b24a1768f48b11248 (diff)
downloadOneRoll-e844799045b0b3a4d8a968e011c96c10003d4256.tar.gz
OneRoll-e844799045b0b3a4d8a968e011c96c10003d4256.zip
Merge branch 'master' of github.com:obiwankennedy/DiceParser
-rw-r--r--CMakeLists.txt47
-rw-r--r--booleancondition.h5
-rw-r--r--cli/main.cpp60
-rw-r--r--dicealias.h2
-rw-r--r--diceparser.h13
-rw-r--r--die.h2
-rw-r--r--node/helpnode.cpp2
-rw-r--r--node/jumpbackwardnode.cpp20
-rw-r--r--node/jumpbackwardnode.h23
-rw-r--r--node/keepdiceexecnode.cpp20
-rw-r--r--node/keepdiceexecnode.h25
-rw-r--r--node/listaliasnode.cpp20
-rw-r--r--node/listaliasnode.h23
-rw-r--r--node/listsetrollnode.cpp20
-rw-r--r--node/listsetrollnode.h24
-rw-r--r--node/numbernode.cpp21
-rw-r--r--node/numbernode.h24
-rw-r--r--node/parenthesesnode.cpp21
-rw-r--r--node/parenthesesnode.h26
-rw-r--r--node/sortresult.cpp23
-rw-r--r--node/sortresult.h45
-rw-r--r--node/startingnode.h19
-rw-r--r--parsingtoolbox.h3
-rw-r--r--range.h3
-rw-r--r--result/scalarresult.h22
-rw-r--r--result/stringresult.h2
-rw-r--r--validator.h25
27 files changed, 471 insertions, 69 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index b654ea2..e8b4c5c 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -3,11 +3,6 @@ cmake_minimum_required(VERSION 2.8)
project(dice)
-#/net/rnd/src/qt/qt-everywhere-enterprise-src-5.3.0/linux-x86_64-gcc-4.7.2/lib/cmake
-#set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}
-#${Qt5Widgets_EXECUTABLE_COMPILE_FLAGS}")
-
-
# Find includes in corresponding build directories
set(CMAKE_INCLUDE_CURRENT_DIR ON)
# Instruct CMake to run moc automatically when needed.
@@ -15,20 +10,15 @@ set(CMAKE_AUTOMOC ON)
# Find the QtWidgets library
find_package(Qt5Core)
-
set(EXECUTABLE_OUTPUT_PATH bin/)
+
include_directories(${Qt5Core_INCLUDES})
add_definitions(${Qt5Core_DEFINITIONS})
set(MODE "cli")
-#file (
-# GLOB_RECURSE
-# source_files
-# *.cpp
-# result/*
-# node/*
-#)
+
+
add_executable(
dice
diceparser.cpp
@@ -43,27 +33,28 @@ add_executable(
result/stringresult.cpp
result/diceresult.cpp
node/countexecutenode.cpp
-node/dicerollernode.cpp
-node/executionnode.cpp
-node/explosedicenode.cpp
-node/helpnode.cpp
-node/jumpbackwardnode.cpp
-node/keepdiceexecnode.cpp
-node/listaliasnode.cpp
-node/listsetrollnode.cpp
-node/numbernode.cpp
-node/parenthesesnode.cpp
-node/rerolldicenode.cpp
-node/scalaroperatornode.cpp
-node/sortresult.cpp
-node/startingnode.cpp
-cli/main.cpp
+ node/dicerollernode.cpp
+ node/executionnode.cpp
+ node/explosedicenode.cpp
+ node/helpnode.cpp
+ node/jumpbackwardnode.cpp
+ node/keepdiceexecnode.cpp
+ node/listaliasnode.cpp
+ node/listsetrollnode.cpp
+ node/numbernode.cpp
+ node/parenthesesnode.cpp
+ node/rerolldicenode.cpp
+ node/scalaroperatornode.cpp
+ node/sortresult.cpp
+ node/startingnode.cpp
+ cli/main.cpp
)
#add_executable(dice cli/main.cpp)
target_link_libraries(dice ${Qt5Core_LIBRARIES})
+INSTALL_TARGETS(/bin dice)
#qt5_use_modules()
diff --git a/booleancondition.h b/booleancondition.h
index 8de8854..cb37b9e 100644
--- a/booleancondition.h
+++ b/booleancondition.h
@@ -24,7 +24,10 @@
#include <Qt>
#include "validator.h"
-
+/**
+ * @brief The BooleanCondition class is a Validator class checking validity from logic expression.
+ * It manages many operators (see : @ref LogicOperator).
+ */
class BooleanCondition : public Validator
{
public:
diff --git a/cli/main.cpp b/cli/main.cpp
index 94fcc00..f005cc3 100644
--- a/cli/main.cpp
+++ b/cli/main.cpp
@@ -24,7 +24,24 @@
#include "diceparser.h"
#include <QCommandLineParser>
#include <QCommandLineOption>
-#include <QDebug>
+#include <QTextStream>
+
+/**
+ * @page Dice
+ * The cli for DiceParser the new dice system from rolisteam.
+ * @section Build and install
+ * To build this program, type these command:
+ * - mkdir build
+ * - cd build
+ * - cmake ../
+ * - make
+ * - make install
+ * @return
+ */
+
+
+
+QTextStream out(stdout, QIODevice::WriteOnly);
QString diceToText(ExportedDiceResult& dice)
{
@@ -93,7 +110,7 @@ void startDiceParsing(QString& cmd,QString& treeFile,bool highlight)
parser->Start();
if(!parser->getErrorMap().isEmpty())
{
- qDebug() << "Error" << parser->humanReadableError();
+ out << "Error" << parser->humanReadableError()<< "\n";
return;
}
@@ -116,9 +133,9 @@ void startDiceParsing(QString& cmd,QString& treeFile,bool highlight)
if(parser->hasStringResult())
{
- str = parser->getStringResult().replace("\n","<br/>");
+ str = parser->getStringResult();
}
- qDebug() << str;
+ out << str << "\n";
}
else
{
@@ -127,18 +144,35 @@ void startDiceParsing(QString& cmd,QString& treeFile,bool highlight)
}
else
{
- qDebug() << parser->humanReadableError();
+ out << parser->humanReadableError()<< "\n";;
}
}
-
+void usage()
+{
+ QString help = "Usage: ./dice [options]\n\
+\n\
+Options:\n\
+ -c, --color-off Disable color to highlight result\n\
+ -v, --version Show the version and quit.\n\
+ --reset-settings Erase the settings and use the default\n\
+ parameters\n\
+ -d, --dot-file <dotfile> Instead of rolling dice, generate the\n\
+ execution tree and write it in <dotfile>\n\
+ -t, --translation <translationfile> path to the translation file:\n\
+ <translationfile>\n\
+ -h, --help Display this help\n\
+";
+
+ out << help;
+}
int main(int argc, char *argv[])
{
- //QCoreApplication app(argc,argv);
- //QCoreApplication::setApplicationName("dice");
- //QCoreApplication::setApplicationVersion("1.0");
+ /*QCoreApplication app(argc,argv);
+ QCoreApplication::setApplicationName("dice");
+ QCoreApplication::setApplicationVersion("1.0");*/
QStringList commands;
@@ -157,7 +191,7 @@ int main(int argc, char *argv[])
if(!optionParser.addOption(color))
{
- qDebug()<< optionParser.errorText();
+ out << optionParser.errorText() << "\n";
}
optionParser.addOption(version);
@@ -184,6 +218,8 @@ int main(int argc, char *argv[])
}
else if(optionParser.isSet(version))
{
+ out << "Rolisteam DiceParser v1.0.0"<< "\n";
+ out << "More Details: www.rolisteam.org"<< "\n";
return 0;
}
else if(optionParser.isSet(reset))
@@ -212,6 +248,10 @@ int main(int argc, char *argv[])
if(!cmd.isEmpty())
{
startDiceParsing(cmd,dotFileStr,colorb);
+ if(cmd=="help")
+ {
+ usage();
+ }
}
/*commands<< "10d10c[>6]+@c[=10]"
diff --git a/dicealias.h b/dicealias.h
index ebf7a02..5acca46 100644
--- a/dicealias.h
+++ b/dicealias.h
@@ -24,7 +24,7 @@
#include <QString>
/**
- * @brief The DiceAlias class
+ * @brief The DiceAlias class is dedicated to store aliases, alias is mainly two QString. The Alias and its replacement. The replacement can be a simple QString or a RegExp.
*/
class DiceAlias
{
diff --git a/diceparser.h b/diceparser.h
index 84c815b..fa56b0f 100644
--- a/diceparser.h
+++ b/diceparser.h
@@ -41,7 +41,7 @@ typedef QMap<int,ListDiceResult > ExportedDiceResult;
class ExploseDiceNode;
/**
- * @mainpage DiceParser
+ * @page DiceParser
*
* The grammar is something like this:
*
@@ -58,7 +58,6 @@ class ExploseDiceNode;
*
*/
-class Dice;
/**
* @brief The DiceParser class facade class, it receives a command and return a DiceResult class (not yet implemented).
*/
@@ -294,14 +293,4 @@ private:
ParsingToolBox* m_parsingToolbox;
};
-/**
- * @brief The Dice class is a basic class to store dice. (May not be required any more).
- */
-class Dice
-{
-public:
- DiceParser::DiceOperator m_diceOp;
- int m_faces;
-};
-
#endif // DICEPARSER_H
diff --git a/die.h b/die.h
index c9ed28a..6b640b7 100644
--- a/die.h
+++ b/die.h
@@ -25,7 +25,7 @@
#include <QList>
/**
- * @brief The Die class
+ * @brief The Die class implements all methods required from a die. You must set the Faces first, then you can roll it and roll it again, to add or replace the previous result.
*/
class Die
{
diff --git a/node/helpnode.cpp b/node/helpnode.cpp
index f31fac1..ffe5f55 100644
--- a/node/helpnode.cpp
+++ b/node/helpnode.cpp
@@ -30,7 +30,7 @@ void HelpNode::run(ExecutionNode* previous)
}
QString HelpNode::toString()const
{
- return QObject::tr("Rolisteam Dice Parser: Full documentation at: <a href=\"https://github.com/obiwankennedy/DiceParser/blob/master/HelpMe.md\">https://github.com/obiwankennedy/DiceParser/blob/master/HelpMe.md</a> \n");
+ return QObject::tr("Rolisteam Dice Parser:\nFull documentation at: https://github.com/obiwankennedy/DiceParser/blob/master/HelpMe.md \n");
}
qint64 HelpNode::getPriority() const
diff --git a/node/jumpbackwardnode.cpp b/node/jumpbackwardnode.cpp
index d800394..be759ce 100644
--- a/node/jumpbackwardnode.cpp
+++ b/node/jumpbackwardnode.cpp
@@ -1,3 +1,23 @@
+/*************************************************************************
+ * Copyright (C) 2009 by Renaud Guezennec *
+ * *
+ * http://www.rolisteam.org/ *
+ * *
+ * rolisteam is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published *
+ * by the Free Software Foundation; either version 2 of the License, *
+ * or (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the *
+ * Free Software Foundation, Inc., *
+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
+ *************************************************************************/
#include "jumpbackwardnode.h"
#include <QDebug>
diff --git a/node/jumpbackwardnode.h b/node/jumpbackwardnode.h
index c6c1e4d..469c64a 100644
--- a/node/jumpbackwardnode.h
+++ b/node/jumpbackwardnode.h
@@ -1,8 +1,31 @@
+/*************************************************************************
+ * Copyright (C) 2009 by Renaud Guezennec *
+ * *
+ * http://www.rolisteam.org/ *
+ * *
+ * rolisteam is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published *
+ * by the Free Software Foundation; either version 2 of the License, *
+ * or (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the *
+ * Free Software Foundation, Inc., *
+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
+ *************************************************************************/
#ifndef JUMPBACKWARDNODE_H
#define JUMPBACKWARDNODE_H
#include "executionnode.h"
#include "result/diceresult.h"
+/**
+ * @brief The JumpBackwardNode class is dedicated to change the previous dice of one dice option.
+ */
class JumpBackwardNode : public ExecutionNode
{
public:
diff --git a/node/keepdiceexecnode.cpp b/node/keepdiceexecnode.cpp
index e8cfac8..859f733 100644
--- a/node/keepdiceexecnode.cpp
+++ b/node/keepdiceexecnode.cpp
@@ -1,3 +1,23 @@
+/*************************************************************************
+ * Copyright (C) 2009 by Renaud Guezennec *
+ * *
+ * http://www.rolisteam.org/ *
+ * *
+ * rolisteam is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published *
+ * by the Free Software Foundation; either version 2 of the License, *
+ * or (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the *
+ * Free Software Foundation, Inc., *
+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
+ *************************************************************************/
#include <QList>
diff --git a/node/keepdiceexecnode.h b/node/keepdiceexecnode.h
index 96e66c4..01f5028 100644
--- a/node/keepdiceexecnode.h
+++ b/node/keepdiceexecnode.h
@@ -1,9 +1,32 @@
+/*************************************************************************
+ * Copyright (C) 2009 by Renaud Guezennec *
+ * *
+ * http://www.rolisteam.org/ *
+ * *
+ * rolisteam is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published *
+ * by the Free Software Foundation; either version 2 of the License, *
+ * or (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the *
+ * Free Software Foundation, Inc., *
+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
+ *************************************************************************/
#ifndef KEEPDICEEXECNODE_H
#define KEEPDICEEXECNODE_H
#include "executionnode.h"
#include "result/diceresult.h"
-
+/**
+ * @brief The KeepDiceExecNode class splits the dice result to get the m_numberOfDice dice from the beginning of the dice result.
+ * Usually the pervious node of an KeepDiceExecNode is an SortNode.
+ */
class KeepDiceExecNode : public ExecutionNode
{
public:
diff --git a/node/listaliasnode.cpp b/node/listaliasnode.cpp
index b85d4c9..4fd4ab0 100644
--- a/node/listaliasnode.cpp
+++ b/node/listaliasnode.cpp
@@ -1,3 +1,23 @@
+/*************************************************************************
+ * Copyright (C) 2009 by Renaud Guezennec *
+ * *
+ * http://www.rolisteam.org/ *
+ * *
+ * rolisteam is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published *
+ * by the Free Software Foundation; either version 2 of the License, *
+ * or (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the *
+ * Free Software Foundation, Inc., *
+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
+ *************************************************************************/
#include "listaliasnode.h"
ListAliasNode::ListAliasNode(QList<DiceAlias*>* apAlias)
diff --git a/node/listaliasnode.h b/node/listaliasnode.h
index ea70fe7..e08d073 100644
--- a/node/listaliasnode.h
+++ b/node/listaliasnode.h
@@ -1,3 +1,23 @@
+/*************************************************************************
+ * Copyright (C) 2009 by Renaud Guezennec *
+ * *
+ * http://www.rolisteam.org/ *
+ * *
+ * rolisteam is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published *
+ * by the Free Software Foundation; either version 2 of the License, *
+ * or (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the *
+ * Free Software Foundation, Inc., *
+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
+ *************************************************************************/
#ifndef LISTALIASNODE_H
#define LISTALIASNODE_H
@@ -5,6 +25,9 @@
#include "result/stringresult.h"
#include "dicealias.h"
+/**
+ * @brief The ListAliasNode class is dedicated to display the list of the current aliases.
+ */
class ListAliasNode : public ExecutionNode
{
public:
diff --git a/node/listsetrollnode.cpp b/node/listsetrollnode.cpp
index 777f7b0..6512df5 100644
--- a/node/listsetrollnode.cpp
+++ b/node/listsetrollnode.cpp
@@ -1,3 +1,23 @@
+/*************************************************************************
+ * Copyright (C) 2009 by Renaud Guezennec *
+ * *
+ * http://www.rolisteam.org/ *
+ * *
+ * rolisteam is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published *
+ * by the Free Software Foundation; either version 2 of the License, *
+ * or (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the *
+ * Free Software Foundation, Inc., *
+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
+ *************************************************************************/
#include "listsetrollnode.h"
#include "die.h"
diff --git a/node/listsetrollnode.h b/node/listsetrollnode.h
index c7925b8..3102ade 100644
--- a/node/listsetrollnode.h
+++ b/node/listsetrollnode.h
@@ -1,3 +1,23 @@
+/*************************************************************************
+ * Copyright (C) 2009 by Renaud Guezennec *
+ * *
+ * http://www.rolisteam.org/ *
+ * *
+ * rolisteam is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published *
+ * by the Free Software Foundation; either version 2 of the License, *
+ * or (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the *
+ * Free Software Foundation, Inc., *
+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
+ *************************************************************************/
#ifndef LISTSETROLLNODE_H
#define LISTSETROLLNODE_H
@@ -7,7 +27,9 @@
#include "executionnode.h"
#include "result/diceresult.h"
#include "result/stringresult.h"
-
+/**
+ * @brief The ListSetRollNode class is dedicated to pick up item from list.
+ */
class ListSetRollNode : public ExecutionNode
{
public:
diff --git a/node/numbernode.cpp b/node/numbernode.cpp
index 51a859f..ba063db 100644
--- a/node/numbernode.cpp
+++ b/node/numbernode.cpp
@@ -1,3 +1,24 @@
+/***************************************************************************
+* Copyright (C) 2014 by Renaud Guezennec *
+* http://renaudguezennec.homelinux.org/accueil,3.html *
+* *
+* This file is part of DiceParser *
+* *
+* DiceParser is free software; you can redistribute it and/or modify *
+* it under the terms of the GNU General Public License as published by *
+* the Free Software Foundation; either version 2 of the License, or *
+* (at your option) any later version. *
+* *
+* This program is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU General Public License for more details. *
+* *
+* You should have received a copy of the GNU General Public License *
+* along with this program; if not, write to the *
+* Free Software Foundation, Inc., *
+* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
+***************************************************************************/
#include "numbernode.h"
NumberNode::NumberNode()
diff --git a/node/numbernode.h b/node/numbernode.h
index f653595..3c43a51 100644
--- a/node/numbernode.h
+++ b/node/numbernode.h
@@ -1,9 +1,33 @@
+/***************************************************************************
+* Copyright (C) 2014 by Renaud Guezennec *
+* http://renaudguezennec.homelinux.org/accueil,3.html *
+* *
+* This file is part of DiceParser *
+* *
+* DiceParser is free software; you can redistribute it and/or modify *
+* it under the terms of the GNU General Public License as published by *
+* the Free Software Foundation; either version 2 of the License, or *
+* (at your option) any later version. *
+* *
+* This program is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU General Public License for more details. *
+* *
+* You should have received a copy of the GNU General Public License *
+* along with this program; if not, write to the *
+* Free Software Foundation, Inc., *
+* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
+***************************************************************************/
#ifndef NUMBERNODE_H
#define NUMBERNODE_H
#include "node/executionnode.h"
#include "result/scalarresult.h"
+/**
+ * @brief The NumberNode class is an ExecutionNode. It is dedicated to store number.
+ */
class NumberNode : public ExecutionNode
{
public:
diff --git a/node/parenthesesnode.cpp b/node/parenthesesnode.cpp
index f76d33c..2876147 100644
--- a/node/parenthesesnode.cpp
+++ b/node/parenthesesnode.cpp
@@ -1,3 +1,24 @@
+/***************************************************************************
+* Copyright (C) 2014 by Renaud Guezennec *
+* http://renaudguezennec.homelinux.org/accueil,3.html *
+* *
+* This file is part of DiceParser *
+* *
+* DiceParser is free software; you can redistribute it and/or modify *
+* it under the terms of the GNU General Public License as published by *
+* the Free Software Foundation; either version 2 of the License, or *
+* (at your option) any later version. *
+* *
+* This program is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU General Public License for more details. *
+* *
+* You should have received a copy of the GNU General Public License *
+* along with this program; if not, write to the *
+* Free Software Foundation, Inc., *
+* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
+***************************************************************************/
#include "parenthesesnode.h"
ParenthesesNode::ParenthesesNode()
diff --git a/node/parenthesesnode.h b/node/parenthesesnode.h
index 9df3cdc..999e7bd 100644
--- a/node/parenthesesnode.h
+++ b/node/parenthesesnode.h
@@ -1,8 +1,32 @@
+/***************************************************************************
+* Copyright (C) 2014 by Renaud Guezennec *
+* http://renaudguezennec.homelinux.org/accueil,3.html *
+* *
+* This file is part of DiceParser *
+* *
+* DiceParser is free software; you can redistribute it and/or modify *
+* it under the terms of the GNU General Public License as published by *
+* the Free Software Foundation; either version 2 of the License, or *
+* (at your option) any later version. *
+* *
+* This program is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU General Public License for more details. *
+* *
+* You should have received a copy of the GNU General Public License *
+* along with this program; if not, write to the *
+* Free Software Foundation, Inc., *
+* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
+***************************************************************************/
#ifndef PARENTHESESNODE_H
#define PARENTHESESNODE_H
#include "executionnode.h"
-
+/**
+ * @brief The ParenthesesNode class is an ExecutionNode. It is dedicated to manage expression which was inside ParenthesesNode.
+ * It is acting just like an StartingNode by for an internal execution tree.
+ */
class ParenthesesNode : public ExecutionNode
{
public:
diff --git a/node/sortresult.cpp b/node/sortresult.cpp
index deaf794..b3e6b49 100644
--- a/node/sortresult.cpp
+++ b/node/sortresult.cpp
@@ -1,3 +1,24 @@
+/***************************************************************************
+* Copyright (C) 2014 by Renaud Guezennec *
+* http://renaudguezennec.homelinux.org/accueil,3.html *
+* *
+* This file is part of DiceParser *
+* *
+* DiceParser is free software; you can redistribute it and/or modify *
+* it under the terms of the GNU General Public License as published by *
+* the Free Software Foundation; either version 2 of the License, or *
+* (at your option) any later version. *
+* *
+* This program is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU General Public License for more details. *
+* *
+* You should have received a copy of the GNU General Public License *
+* along with this program; if not, write to the *
+* Free Software Foundation, Inc., *
+* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
+***************************************************************************/
#include "sortresult.h"
#include <QDebug>
@@ -25,7 +46,7 @@ void SortResultNode::run(ExecutionNode* node)
QList<Die*> diceList2=m_diceResult->getResultList();
- // Dichotomic sorting
+ // half-interval search sorting
for(int i = 0; i<diceList.size();++i)
{
Die* tmp1 = diceList[i];
diff --git a/node/sortresult.h b/node/sortresult.h
index 8ce03a2..d505e4b 100644
--- a/node/sortresult.h
+++ b/node/sortresult.h
@@ -1,18 +1,59 @@
+/***************************************************************************
+* Copyright (C) 2014 by Renaud Guezennec *
+* http://renaudguezennec.homelinux.org/accueil,3.html *
+* *
+* This file is part of DiceParser *
+* *
+* DiceParser is free software; you can redistribute it and/or modify *
+* it under the terms of the GNU General Public License as published by *
+* the Free Software Foundation; either version 2 of the License, or *
+* (at your option) any later version. *
+* *
+* This program is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU General Public License for more details. *
+* *
+* You should have received a copy of the GNU General Public License *
+* along with this program; if not, write to the *
+* Free Software Foundation, Inc., *
+* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
+***************************************************************************/
#ifndef SORTRESULT_H
#define SORTRESULT_H
#include "executionnode.h"
#include "result/diceresult.h"
-
+/**
+ * @brief The SortResultNode class is an ExecutionNode, and it is dedicated to sort dice list.
+ * The sort is made by hand, using half-interval search algorithm.
+ */
class SortResultNode : public ExecutionNode
{
public:
+ /**
+ * @brief SortResultNode
+ */
SortResultNode();
+ /**
+ * @brief run
+ */
virtual void run(ExecutionNode*);
-
+ /**
+ * @brief setSortAscending
+ * @param asc
+ */
void setSortAscending(bool asc);
+ /**
+ * @brief toString
+ * @return
+ */
virtual QString toString()const;
+ /**
+ * @brief getPriority
+ * @return
+ */
virtual qint64 getPriority() const;
private:
diff --git a/node/startingnode.h b/node/startingnode.h
index ccb7c87..ebe28c0 100644
--- a/node/startingnode.h
+++ b/node/startingnode.h
@@ -3,13 +3,30 @@
#include "executionnode.h"
+/**
+ * @brief The StartingNode class is an ExecutionNode, StartingNode is dedicated to be the first node
+ * in the execution tree.
+ */
class StartingNode : public ExecutionNode
{
public:
+ /**
+ * @brief StartingNode
+ */
StartingNode();
-
+ /**
+ * @brief run
+ */
virtual void run(ExecutionNode*);
+ /**
+ * @brief toString
+ * @return
+ */
virtual QString toString()const;
+ /**
+ * @brief getPriority
+ * @return
+ */
virtual qint64 getPriority() const;
};
diff --git a/parsingtoolbox.h b/parsingtoolbox.h
index d7fdc31..8958550 100644
--- a/parsingtoolbox.h
+++ b/parsingtoolbox.h
@@ -30,7 +30,8 @@
#include "range.h"
/**
- * @brief The ParsingToolBox class - gathering tools
+ * @brief The ParsingToolBox is gathering many useful methods for dice parsing.
+ * Its goal is to make the diceparser a bit lighter.
*/
class ParsingToolBox
{
diff --git a/range.h b/range.h
index 3573174..e50a48e 100644
--- a/range.h
+++ b/range.h
@@ -25,6 +25,9 @@
#include <Qt>
#include "validator.h"
+/**
+ * @brief The Range class is validator class to check validity between two values.
+ */
class Range : public Validator
{
public:
diff --git a/result/scalarresult.h b/result/scalarresult.h
index 4d64a90..8a0fa11 100644
--- a/result/scalarresult.h
+++ b/result/scalarresult.h
@@ -25,16 +25,30 @@
#include "result.h"
#include <Qt>
-
+/**
+ * @brief The ScalarResult class is used to store scalar result by many ExecutionNode.
+ */
class ScalarResult : public Result
{
public:
+ /**
+ * @brief ScalarResult
+ */
ScalarResult();
-
+ /**
+ * @brief getResult
+ * @return
+ */
virtual QVariant getResult(Result::RESULT_TYPE);
-
+ /**
+ * @brief setValue
+ * @param i
+ */
void setValue(qreal i);
-
+ /**
+ * @brief toString
+ * @return
+ */
virtual QString toString();
private:
diff --git a/result/stringresult.h b/result/stringresult.h
index 4a9a4a4..5a6b26c 100644
--- a/result/stringresult.h
+++ b/result/stringresult.h
@@ -4,7 +4,7 @@
#include <QString>
#include "result.h"
/**
- * @brief The StringResult class
+ * @brief The StringResult class stores command result for String.
*/
class StringResult : public Result
{
diff --git a/validator.h b/validator.h
index d18a691..6dd8292 100644
--- a/validator.h
+++ b/validator.h
@@ -25,14 +25,35 @@
#include <Qt>
#include "die.h"
#include <QString>
-
+/**
+ * @brief The Validator class is an abstract class for checking the validity of dice for some
+ * operator.
+ */
class Validator
{
public:
+ /**
+ * @brief Validator
+ */
Validator();
+ /**
+ * @brief hasValid
+ * @param b
+ * @param recursive
+ * @param unlight
+ * @return
+ */
virtual qint64 hasValid(Die* b,bool recursive,bool unlight = false) const = 0 ;
-
+ /**
+ * @brief toString
+ * @return
+ */
virtual QString toString()=0;
+ /**
+ * @brief getValidRangeSize
+ * @param faces
+ * @return
+ */
virtual quint8 getValidRangeSize(quint64 faces) const = 0 ;
};