[Orxonox-commit 2652] r7357 - in code/branches/doc: doc/api src/libraries/core src/libraries/core/input src/orxonox src/orxonox/gamestates

rgrieder at orxonox.net rgrieder at orxonox.net
Sun Sep 5 18:50:17 CEST 2010


Author: rgrieder
Date: 2010-09-05 18:50:17 +0200 (Sun, 05 Sep 2010)
New Revision: 7357

Modified:
   code/branches/doc/doc/api/CMakeLists.txt
   code/branches/doc/doc/api/Groups.dox
   code/branches/doc/doc/api/doxy.config.in
   code/branches/doc/src/libraries/core/CommandLineParser.cc
   code/branches/doc/src/libraries/core/CommandLineParser.h
   code/branches/doc/src/libraries/core/Core.cc
   code/branches/doc/src/libraries/core/Core.h
   code/branches/doc/src/libraries/core/PathConfig.cc
   code/branches/doc/src/libraries/core/input/InputManager.cc
   code/branches/doc/src/orxonox/LevelManager.cc
   code/branches/doc/src/orxonox/Main.cc
   code/branches/doc/src/orxonox/gamestates/GSClient.cc
   code/branches/doc/src/orxonox/gamestates/GSServer.cc
Log:
Changed command line arguments reference to a simple Doxygen page containing the usage information text.

Modified: code/branches/doc/doc/api/CMakeLists.txt
===================================================================
--- code/branches/doc/doc/api/CMakeLists.txt	2010-09-05 15:31:56 UTC (rev 7356)
+++ code/branches/doc/doc/api/CMakeLists.txt	2010-09-05 16:50:17 UTC (rev 7357)
@@ -54,7 +54,7 @@
   ADD_CUSTOM_COMMAND(
     OUTPUT ${INTERNAL_DOCFILE}
     COMMAND orxonox-main
-    ARGS --noIOConsole --generateDoc --docFile ${INTERNAL_DOCFILE}
+    ARGS --noIOConsole --generateDoc ${INTERNAL_DOCFILE}
     WORKING_DIRECTORY ${_working_dir}
     COMMENT "Generating additional Doxygen documentation from Orxonox executable"
   )

Modified: code/branches/doc/doc/api/Groups.dox
===================================================================
--- code/branches/doc/doc/api/Groups.dox	2010-09-05 15:31:56 UTC (rev 7356)
+++ code/branches/doc/doc/api/Groups.dox	2010-09-05 16:50:17 UTC (rev 7357)
@@ -60,7 +60,7 @@
 /**
     @defgroup CmdArgs Commandline Arguments
     @ingroup Command
-    @brief For a reference see @ref cmdargs
+    @brief For a reference see @ref cmdargspage
 */
 
 /**

Modified: code/branches/doc/doc/api/doxy.config.in
===================================================================
--- code/branches/doc/doc/api/doxy.config.in	2010-09-05 15:31:56 UTC (rev 7356)
+++ code/branches/doc/doc/api/doxy.config.in	2010-09-05 16:50:17 UTC (rev 7357)
@@ -190,7 +190,7 @@
 # will result in a user-defined paragraph with heading "Side Effects:".
 # You can put \n's in the value part of an alias to insert newlines.
 
-ALIASES                = "cmdarg=\xrefitem cmdargs \"Commandline Argment\" \"Commandline Arguments Reference\""
+ALIASES                = 
 
 # Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C
 # sources only. Doxygen will then generate output that is more tailored for C.

Modified: code/branches/doc/src/libraries/core/CommandLineParser.cc
===================================================================
--- code/branches/doc/src/libraries/core/CommandLineParser.cc	2010-09-05 15:31:56 UTC (rev 7356)
+++ code/branches/doc/src/libraries/core/CommandLineParser.cc	2010-09-05 16:50:17 UTC (rev 7357)
@@ -40,7 +40,6 @@
 
 namespace orxonox
 {
-    //! @cmdarg
     SetCommandLineOnlyArgument(optionsFile, "start.ini").shortcut("o");
 
     /**
@@ -314,12 +313,21 @@
         return infoStr.str();
     }
 
+    void CommandLineParser::generateDoc(std::ofstream& file)
+    {
+        file << "/** @page cmdargspage Command Line Arguments Reference" << endl;
+        file << "    @verbatim"; /*no endl*/
+        file << getUsageInformation(); /*no endl*/
+        file << "    @endverbatim" << endl;
+        file << "*/" << endl;
+    }
+
     /**
     @brief
         Retrieves a CommandLineArgument.
         The method throws an exception if 'name' was not found or the value could not be converted.
     @note
-        You shold of course not call this method before the command line has been parsed.
+        You should of course not call this method before the command line has been parsed.
     */
     const CommandLineArgument* CommandLineParser::getArgument(const std::string& name)
     {

Modified: code/branches/doc/src/libraries/core/CommandLineParser.h
===================================================================
--- code/branches/doc/src/libraries/core/CommandLineParser.h	2010-09-05 15:31:56 UTC (rev 7356)
+++ code/branches/doc/src/libraries/core/CommandLineParser.h	2010-09-05 16:50:17 UTC (rev 7357)
@@ -31,6 +31,7 @@
 
 #include "CorePrereqs.h"
 
+#include <fstream>
 #include <map>
 #include "util/OrxAssert.h"
 #include "util/MultiType.h"
@@ -164,6 +165,8 @@
 
         static void destroyAllArguments();
 
+        static void generateDoc(std::ofstream& file);
+
     private:
         //! Constructor initialises bFirstTimeParse_ with true.
         CommandLineParser() : bFirstTimeParse_(true) { }

Modified: code/branches/doc/src/libraries/core/Core.cc
===================================================================
--- code/branches/doc/src/libraries/core/Core.cc	2010-09-05 15:31:56 UTC (rev 7356)
+++ code/branches/doc/src/libraries/core/Core.cc	2010-09-05 16:50:17 UTC (rev 7357)
@@ -36,6 +36,7 @@
 #include "Core.h"
 
 #include <cassert>
+#include <fstream>
 #include <vector>
 
 #ifdef ORXONOX_PLATFORM_WINDOWS
@@ -76,13 +77,10 @@
     //! Static pointer to the singleton
     Core* Core::singletonPtr_s  = 0;
 
-    //! @cmdarg
     SetCommandLineArgument(settingsFile, "orxonox.ini").information("THE configuration file");
-    //! @cmdarg
     SetCommandLineSwitch(noIOConsole).information("Use this if you don't want to use the IOConsole (for instance for Lua debugging)");
 
 #ifdef ORXONOX_PLATFORM_WINDOWS
-    //! @cmdarg
     SetCommandLineArgument(limitToCPU, 1).information("Limits the program to one CPU/core (1, 2, 3, etc.). Default is the first core (faster than off)");
 #endif
 
@@ -173,6 +171,21 @@
 
         // Create singletons that always exist (in other libraries)
         this->rootScope_.reset(new Scope<ScopeID::Root>());
+
+        // Generate documentation instead of normal run?
+        std::string docFilename;
+        CommandLineParser::getValue("generateDoc", &docFilename);
+        if (!docFilename.empty())
+        {
+            std::ofstream docFile(docFilename.c_str());
+            if (docFile.is_open())
+            {
+                CommandLineParser::generateDoc(docFile);
+                docFile.close();
+            }
+            else
+                COUT(0) << "Error: Could not open file for documentation writing" << endl;
+        }
     }
 
     /**

Modified: code/branches/doc/src/libraries/core/Core.h
===================================================================
--- code/branches/doc/src/libraries/core/Core.h	2010-09-05 15:31:56 UTC (rev 7356)
+++ code/branches/doc/src/libraries/core/Core.h	2010-09-05 16:50:17 UTC (rev 7357)
@@ -32,7 +32,6 @@
 
 #include "CorePrereqs.h"
 
-#include <cassert>
 #include <string>
 #include <boost/scoped_ptr.hpp>
 #include <loki/ScopeGuard.h>

Modified: code/branches/doc/src/libraries/core/PathConfig.cc
===================================================================
--- code/branches/doc/src/libraries/core/PathConfig.cc	2010-09-05 15:31:56 UTC (rev 7356)
+++ code/branches/doc/src/libraries/core/PathConfig.cc	2010-09-05 16:50:17 UTC (rev 7357)
@@ -69,9 +69,7 @@
     //! Static pointer to the singleton
     PathConfig* PathConfig::singletonPtr_s  = 0;
 
-    //! @cmdarg
     SetCommandLineArgument(externalDataPath, "").information("Path to the external data files");
-    //! @cmdarg
     SetCommandLineOnlyArgument(writingPathSuffix, "").information("Additional subfolder for config and log files");
 
     PathConfig::PathConfig()

Modified: code/branches/doc/src/libraries/core/input/InputManager.cc
===================================================================
--- code/branches/doc/src/libraries/core/input/InputManager.cc	2010-09-05 15:31:56 UTC (rev 7356)
+++ code/branches/doc/src/libraries/core/input/InputManager.cc	2010-09-05 16:50:17 UTC (rev 7357)
@@ -59,7 +59,6 @@
 
 namespace orxonox
 {
-    //! @cmdarg
     SetCommandLineSwitch(keyboard_no_grab).information("Whether not to exclusively grab the keyboard");
 
     static const std::string __CC_InputManager_name = "InputManager";

Modified: code/branches/doc/src/orxonox/LevelManager.cc
===================================================================
--- code/branches/doc/src/orxonox/LevelManager.cc	2010-09-05 15:31:56 UTC (rev 7356)
+++ code/branches/doc/src/orxonox/LevelManager.cc	2010-09-05 16:50:17 UTC (rev 7357)
@@ -41,7 +41,6 @@
 
 namespace orxonox
 {
-    //! @cmdarg
     SetCommandLineArgument(level, "").shortcut("l").information("Default level file (overrides LevelManager::defaultLevelName_ configValue)");
 
     ManageScopedSingleton(LevelManager, ScopeID::Root, false);

Modified: code/branches/doc/src/orxonox/Main.cc
===================================================================
--- code/branches/doc/src/orxonox/Main.cc	2010-09-05 15:31:56 UTC (rev 7356)
+++ code/branches/doc/src/orxonox/Main.cc	2010-09-05 16:50:17 UTC (rev 7357)
@@ -47,25 +47,15 @@
 
 namespace orxonox
 {
-    //! @cmdarg
     SetCommandLineSwitch(console).information("Start in console mode (text IO only)");
-    //! @cmdarg
     SetCommandLineSwitch(server).information("Start in server mode");
-    //! @cmdarg
     SetCommandLineSwitch(client).information("Start in client mode");
-    //! @cmdarg
     SetCommandLineSwitch(dedicated).information("Start in dedicated server mode");
-    //! @cmdarg
     SetCommandLineSwitch(standalone).information("Start in standalone mode");
-    //! @cmdarg
     SetCommandLineSwitch(dedicatedClient).information("Start in dedicated client mode");
 
-    //! @cmdarg
-    SetCommandLineSwitch(generateDoc)
+    SetCommandLineArgument(generateDoc, "")
         .information("Generates a Doxygen file from things like SetConsoleCommand");
-    //! @cmdarg
-    SetCommandLineArgument(docFile, "Internal.dox")
-        .information("Name of the doc file to be generated with --generateDoc");
 
     /**
     @brief
@@ -75,14 +65,8 @@
     {
         Game* game = new Game(strCmdLine);
 
-        if (CommandLineParser::getValue("generateDoc").getBool())
+        if (CommandLineParser::getValue("generateDoc").getString().empty())
         {
-            // Generate additional documentation written to ONE file
-            std::string filename;
-            CommandLineParser::getValue("docFile", &filename);
-        }
-        else
-        {
             game->setStateHierarchy(
             "root"
             " graphics"
@@ -95,7 +79,7 @@
 
             game->requestState("root");
 
-            // Some development hacks (not really, but in the future, this calls won't make sense anymore)
+            // Some development hacks (not really, but in the future, these calls won't make sense anymore)
             if (CommandLineParser::getValue("standalone").getBool())
                 Game::getInstance().requestStates("graphics, standalone, level");
             else if (CommandLineParser::getValue("server").getBool())

Modified: code/branches/doc/src/orxonox/gamestates/GSClient.cc
===================================================================
--- code/branches/doc/src/orxonox/gamestates/GSClient.cc	2010-09-05 15:31:56 UTC (rev 7356)
+++ code/branches/doc/src/orxonox/gamestates/GSClient.cc	2010-09-05 16:50:17 UTC (rev 7357)
@@ -39,7 +39,6 @@
 {
     DeclareGameState(GSClient, "client", false, false);
 
-    //! @cmdarg
     SetCommandLineArgument(dest, "127.0.0.1").information("Server hostname/IP (IP in the form of #.#.#.#)");
 
     GSClient::GSClient(const GameStateInfo& info)

Modified: code/branches/doc/src/orxonox/gamestates/GSServer.cc
===================================================================
--- code/branches/doc/src/orxonox/gamestates/GSServer.cc	2010-09-05 15:31:56 UTC (rev 7356)
+++ code/branches/doc/src/orxonox/gamestates/GSServer.cc	2010-09-05 16:50:17 UTC (rev 7357)
@@ -38,7 +38,6 @@
 {
     DeclareGameState(GSServer, "server", false, false);
 
-    //! @cmdarg
     SetCommandLineArgument(port, 55556).shortcut("p").information("Network communication port to be used 0-65535 (default: 55556)");
 
     GSServer::GSServer(const GameStateInfo& info)




More information about the Orxonox-commit mailing list