From e1429844d3c7c2feeec8291084fb7f36e9ef38af Mon Sep 17 00:00:00 2001 From: Renaud G Date: Thu, 30 Apr 2015 11:09:04 +0200 Subject: add comments and gpl header to those files for better documentation in doxygen --- diceparser.h | 2 +- node/numbernode.cpp | 21 +++++++++++++++++++++ node/numbernode.h | 24 ++++++++++++++++++++++++ node/parenthesesnode.cpp | 21 +++++++++++++++++++++ node/parenthesesnode.h | 26 +++++++++++++++++++++++++- node/sortresult.cpp | 23 ++++++++++++++++++++++- node/sortresult.h | 45 +++++++++++++++++++++++++++++++++++++++++++-- node/startingnode.h | 19 ++++++++++++++++++- parsingtoolbox.h | 3 ++- range.h | 3 +++ result/scalarresult.h | 22 ++++++++++++++++++---- validator.h | 25 +++++++++++++++++++++++-- 12 files changed, 221 insertions(+), 13 deletions(-) diff --git a/diceparser.h b/diceparser.h index 93c5c2e..717630e 100644 --- a/diceparser.h +++ b/diceparser.h @@ -41,7 +41,7 @@ typedef QMap ExportedDiceResult; class ExploseDiceNode; /** - * @mainpage DiceParser + * @page DiceParser * * The grammar is something like this: * 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 @@ -25,7 +46,7 @@ void SortResultNode::run(ExecutionNode* node) QList diceList2=m_diceResult->getResultList(); - // Dichotomic sorting + // half-interval search sorting for(int i = 0; i #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 - +/** + * @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/validator.h b/validator.h index d18a691..6dd8292 100644 --- a/validator.h +++ b/validator.h @@ -25,14 +25,35 @@ #include #include "die.h" #include - +/** + * @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 ; }; -- cgit v1.2.3-70-g09d2 From 479b96210a01c152d5498e97cd66c47258918c49 Mon Sep 17 00:00:00 2001 From: Renaud G Date: Sat, 2 May 2015 12:01:19 +0200 Subject: -Add gpl header or/and add class description for doxygen. --- booleancondition.h | 5 ++++- cli/main.cpp | 46 ++++++++++++++++++++++++++++++++++++---------- node/helpnode.cpp | 2 +- node/jumpbackwardnode.cpp | 20 ++++++++++++++++++++ node/jumpbackwardnode.h | 23 +++++++++++++++++++++++ node/keepdiceexecnode.cpp | 20 ++++++++++++++++++++ node/keepdiceexecnode.h | 25 ++++++++++++++++++++++++- node/listaliasnode.cpp | 20 ++++++++++++++++++++ node/listaliasnode.h | 23 +++++++++++++++++++++++ node/listsetrollnode.cpp | 20 ++++++++++++++++++++ node/listsetrollnode.h | 24 +++++++++++++++++++++++- 11 files changed, 214 insertions(+), 14 deletions(-) diff --git a/booleancondition.h b/booleancondition.h index 8de8854..cb37b9e 100644 --- a/booleancondition.h +++ b/booleancondition.h @@ -24,7 +24,10 @@ #include #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..2c4ddfa 100644 --- a/cli/main.cpp +++ b/cli/main.cpp @@ -24,7 +24,10 @@ #include "diceparser.h" #include #include -#include +#include + + +QTextStream out(stdout, QIODevice::WriteOnly); QString diceToText(ExportedDiceResult& dice) { @@ -93,7 +96,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 +119,9 @@ void startDiceParsing(QString& cmd,QString& treeFile,bool highlight) if(parser->hasStringResult()) { - str = parser->getStringResult().replace("\n","
"); + str = parser->getStringResult(); } - qDebug() << str; + out << str << "\n"; } else { @@ -127,18 +130,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 Instead of rolling dice, generate the\n\ + execution tree and write it in \n\ + -t, --translation path to the translation file:\n\ + \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 +177,7 @@ int main(int argc, char *argv[]) if(!optionParser.addOption(color)) { - qDebug()<< optionParser.errorText(); + out << optionParser.errorText() << "\n"; } optionParser.addOption(version); @@ -184,6 +204,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 +234,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/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: https://github.com/obiwankennedy/DiceParser/blob/master/HelpMe.md \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 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 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* 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: -- cgit v1.2.3-70-g09d2 From 6dbf254b7d5b19b77eb4716b24a1768f48b11248 Mon Sep 17 00:00:00 2001 From: Renaud G Date: Sun, 3 May 2015 02:53:34 +0200 Subject: -Add install target to make file. -Add comments and class descriptions. --- CMakeLists.txt | 47 +++++++++++++++++++---------------------------- cli/main.cpp | 18 ++++++++++++++++-- dicealias.h | 2 +- diceparser.h | 11 ----------- die.h | 2 +- result/stringresult.h | 2 +- 6 files changed, 38 insertions(+), 44 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/cli/main.cpp b/cli/main.cpp index 2c4ddfa..f005cc3 100644 --- a/cli/main.cpp +++ b/cli/main.cpp @@ -26,6 +26,20 @@ #include #include +/** + * @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); @@ -156,9 +170,9 @@ Options:\n\ int main(int argc, char *argv[]) { - QCoreApplication app(argc,argv); + /*QCoreApplication app(argc,argv); QCoreApplication::setApplicationName("dice"); - QCoreApplication::setApplicationVersion("1.0"); + QCoreApplication::setApplicationVersion("1.0");*/ QStringList commands; diff --git a/dicealias.h b/dicealias.h index ebf7a02..5acca46 100644 --- a/dicealias.h +++ b/dicealias.h @@ -24,7 +24,7 @@ #include /** - * @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 717630e..17f8e1c 100644 --- a/diceparser.h +++ b/diceparser.h @@ -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). */ @@ -293,14 +292,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 /** - * @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/result/stringresult.h b/result/stringresult.h index 4a9a4a4..5a6b26c 100644 --- a/result/stringresult.h +++ b/result/stringresult.h @@ -4,7 +4,7 @@ #include #include "result.h" /** - * @brief The StringResult class + * @brief The StringResult class stores command result for String. */ class StringResult : public Result { -- cgit v1.2.3-70-g09d2