GpCoreTools/ApplicationHelp.h
Go to the documentation of this file.
00001 /***************************************************************************
00002 **
00003 **  This file is part of GpCoreTools.
00004 **
00005 **  This file may be distributed and/or modified under the terms of the
00006 **  GNU General Public License version 2 or 3 as published by the Free
00007 **  Software Foundation and appearing in the file LICENSE.GPL included
00008 **  in the packaging of this file.
00009 **
00010 **  This file is distributed in the hope that it will be useful, but WITHOUT
00011 **  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00012 **  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
00013 **  more details.
00014 **
00015 **  You should have received a copy of the GNU General Public License
00016 **  along with this program. If not, see <http://www.gnu.org/licenses/>.
00017 **
00018 **  See http://www.geopsy.org for more information.
00019 **
00020 **  Created: 2009-07-01
00021 **  Authors:
00022 **    Marc Wathelet
00023 **    Marc Wathelet (LGIT, Grenoble, France)
00024 **
00025 ***************************************************************************/
00026 
00027 #ifndef APPLICATIONHELP_H
00028 #define APPLICATIONHELP_H
00029 
00030 #include <list>
00031 #include <string>
00032 
00033 #include "GpCoreToolsDLLExport.h"
00034 
00035 namespace GpCoreTools {
00036 
00037 class GPCORETOOLS_EXPORT ApplicationHelp
00038 {
00039 public:
00040   ApplicationHelp();
00041   ~ApplicationHelp();
00042 
00043   void exec(const char * group=0);
00044 
00045   void addGroup(const char * title, const char * section);
00046   void addOption(const char * option, const char * comments);
00047   void setOptionSummary(const char * optionSummary) {_optionSummary=optionSummary;}
00048   void setComments(const char * comments) {_comments=comments;}
00049   void setSeeAlso(const char * seeAlso) {_seeAlso=seeAlso;}
00050   void addExample(const char * command, const char * comments);
00051 
00052   std::list<const char *> sections();
00053   static void print(std::string p, const std::string& linePrefix="", int indent=0);
00054   static std::string getLine(std::string& text, int maxLength, bool * newLine=0);
00055 private:
00056   struct Option {
00057     std::string option;
00058     std::string comments;
00059   };
00060   struct OptionGroup {
00061     std::list<Option> options;
00062     std::string title;
00063     std::string section;
00064   };
00065   struct Example {
00066     std::string command;
00067     std::string comments;
00068   };
00069   std::list<OptionGroup> _options;
00070   std::list<Example> _examples;
00071   std::string _optionSummary;
00072   std::string _comments;
00073   std::string _seeAlso;
00074 
00075   void print(const OptionGroup& g);
00076   void execHtml();
00077   static std::string getCustomIndent(std::string& text);
00078 };
00079 
00080 } // namespace GpCoreTools
00081 
00082 #endif // APPLICATIONHELP_H
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines