QGpCoreTools/ApplicationHelp.h
Go to the documentation of this file.
00001 /***************************************************************************
00002 **
00003 **  This file is part of QGpCoreTools.
00004 **
00005 **  This library is free software; you can redistribute it and/or
00006 **  modify it under the terms of the GNU Lesser General Public
00007 **  License as published by the Free Software Foundation; either
00008 **  version 2.1 of the License, or (at your option) any later version.
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 Lesser General Public
00013 **  License for more details.
00014 **
00015 **  You should have received a copy of the GNU Lesser General Public
00016 **  License along with this library; if not, write to the Free Software
00017 **  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
00018 **
00019 **  See http://www.geopsy.org for more information.
00020 **
00021 **  Created : 2007-02-09
00022 **  Authors :
00023 **    Marc Wathelet
00024 **    Marc Wathelet (LGIT, Grenoble, France)
00025 **
00026 ***************************************************************************/
00027 
00028 #ifndef APPLICATIONHELP_H
00029 #define APPLICATIONHELP_H
00030 
00031 #include "QGpCoreToolsDLLExport.h"
00032 #include "Translations.h"
00033 
00034 namespace QGpCoreTools {
00035 
00036 class QGPCORETOOLS_EXPORT ApplicationHelp
00037 {
00038   TRANSLATIONS("ApplicationHelp")
00039 public:
00040   ApplicationHelp();
00041   ~ApplicationHelp();
00042 
00043   void exec(const char * group=0);
00044 
00045   void addGroup(QString title, QByteArray section);
00046   void addOption(QString option, QString comments);
00047   void setOptionSummary(QString optionSummary) {_optionSummary=optionSummary;}
00048   void setComments(QString comments) {_comments=comments;}
00049   void setSeeAlso(QString seeAlso) {_seeAlso=seeAlso;}
00050   void addExample(QString command, QString comments);
00051 
00052   QList<QByteArray> sections();
00053   static void print(QString p, QString linePrefix=QString::null, int indent=0);
00054   static QString getLine(QString& text, int maxLength, bool * newLine =0);
00055   static QString encodeToHtml(QString str);
00056   static QString encodeToLatex(QString str);
00057 private:
00058   struct Option {
00059     QString option;
00060     QString comments;
00061   };
00062   struct OptionGroup {
00063     QList<Option> options;
00064     QString title;
00065     QByteArray section;
00066   };
00067   struct Example {
00068     QString command;
00069     QString comments;
00070   };
00071   QList<OptionGroup> _options;
00072   QList<Example> _examples;
00073   QString _optionSummary;
00074   QString _comments;
00075   QString _seeAlso;
00076   void print(const OptionGroup& g);
00077   void execHtml();
00078   void execLatex();
00079   static QString getCustomIndent(QString& text);
00080 };
00081 
00082 } // namespace QGpCoreTools
00083 
00084 #endif // APPLICATIONHELP_H
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines