Confdump Agent  1.4.0
Options.hpp
Go to the documentation of this file.
00001 /* 
00002  * Confdump-Agent - Dump static and runtime system configuration
00003  * Copyright (C) 2009-2012  Straton IT, SAS
00004  * 
00005  * This program is free software: you can redistribute it and/or modify
00006  * it under the terms of the GNU General Public License version 3 as
00007  * published by the Free Software Foundation.
00008  * 
00009  * This program is distributed in the hope that it will be useful,
00010  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012  * GNU General Public License for more details.
00013  * 
00014  * You should have received a copy of the GNU General Public License
00015  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
00016  */
00017 
00018 #ifndef INCLUDED_CONFDUMP_OPTIONS_H
00019 #define INCLUDED_CONFDUMP_OPTIONS_H
00020 
00021 #include <vector>
00022 #include <string>
00023 #include <iosfwd>
00024 #include <map>
00025 #include <QStringList>
00026 #include "Confdump/DumperSpecification.hpp"
00027 
00028 namespace Confdump
00029 {
00030 
00031 class DumperFactory;
00032 
00039 class Options : public QObject
00040 {
00041     Q_OBJECT
00042     Options();
00043 
00044 public:
00045     enum LogLevel
00046     {
00047         Trace,
00048         Debug,
00049         Info,
00050         Warning,
00051         Error
00052     };
00053 
00054     enum OutputFormat
00055     {
00056         TextFormat,
00057         XmlFormat
00058     };
00059 
00060     enum OperatingMode
00061     {
00062         NormalMode,
00063         HelpMode,
00064         HelpTablesMode
00065     };
00066 
00067     Options( int argc, char **argv, std::ostream &out );
00068     ~Options();
00069 
00070     typedef QList< std::pair<QString, QString> > TableList;
00071     TableList tables() const;
00072     LogLevel logLevel() const { return logLevel_; }
00073     OutputFormat outputFormat() const { return outputFormat_; }
00074     QString outputFile() const { return outputFile_; }
00075     OperatingMode operatingMode() const { return operatingMode_; }
00076     std::map<QString, DumperSpecification> dumperSpecifications() const;
00077 
00078 private:
00079     void setVerbosity( const std::string &value );
00080     void setOutputFormat( const std::string &format );
00081     void setOutputFile( const std::string &file );
00082     void setTables( const std::vector< std::string > &tables );
00083     void readTablesFrom( const std::string &file );
00084     void setDumpers( const std::vector< std::string > &raw_dumpers );
00085     void setDumperArgs( const std::vector< std::string > &raw_args );
00086 
00087     TableList tables_;
00088     LogLevel logLevel_;
00089     OutputFormat outputFormat_;
00090     QString outputFile_;
00091     OperatingMode operatingMode_;
00093     typedef std::map<QString, QString> DumperAliases;
00094     DumperAliases dumperAliases_;
00096     typedef std::map<QString, std::map<QString, QString> > DumperArguments;
00097     mutable DumperArguments dumperArguments_;
00098 };
00099 
00100 } 
00101 
00102 
00103 #endif /* INCLUDED_CONFDUMP_OPTIONS_H */
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends