BALL  1.4.79
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
paramFile.h
Go to the documentation of this file.
1 // vi: set ts=2:
3 //
4 
5 #ifndef BALL_FORMAT_PARAMFILE_H
6 #define BALL_FORMAT_PARAMFILE_H
7 
8 #ifndef BALL_SYSTEM_FILE_H
9 # include <BALL/SYSTEM/file.h>
10 #endif
11 
12 #ifndef BALL_DATATYPE_STRING_H
13 # include <BALL/DATATYPE/string.h>
14 #endif
15 
16 #include <QtXml/QXmlStreamReader>
17 #include <QtXml/QXmlStreamWriter>
18 #include <QtCore/QFile>
19 
20 #include <map>
21 #include <list>
22 
23 
24 namespace BALL
25 {
26  enum BALL_EXPORT ParameterType
27  {
29  OUTFILE,
30  STRING,
31  INT,
32  DOUBLE,
33  INFILELIST,
35  STRINGLIST,
36  INTLIST,
37  DOUBLELIST,
39  GALAXY_OPT_OUTID
40  };
41 
43  {
44  // constructor
46  {
47  name = "";
48  description = "";
49  category = "";
50  mandatory = false;
51  advanced = false;
52  type = INFILE;
53  output_format_source = "";
54  allowed_values.clear();
55  supported_formats.clear();
56  hidden = false;
57  };
58 
59  String name;
62  bool mandatory;
63  bool advanced;
64  ParameterType type;
65 
69 
71  list<String> allowed_values;
72 
75  list<String> supported_formats;
76 
77  // if parameters shall be hidden in galaxy
78  bool hidden;
79  };
80 
82  class BALL_EXPORT ParamFile : public File
83  {
84  public:
85 
86  ParamFile(const String& name, File::OpenMode open_mode);
87  ~ParamFile();
88 
95  void writeSection(String section_name, String section_description, String version, const String& section_helptext,
96  const String& category, const std::list<std::pair<String,ParameterDescription> >& descriptions,
97  const std::map<String,list<String> >& values);
98 
103  void readSection(String& section_name, String& section_description, String& version, String& section_helptext,
104  String& category, std::list<std::pair<String, ParameterDescription> >& descriptions,
105  std::map<String,list<String> >& values,
106  bool overwrite_existing=false);
107 
108  void close();
109 
110 
111  protected:
112 
116  QXmlStreamReader* xmlIn_;
117  QXmlStreamWriter* xmlOut_;
118  QFile* file_;
119  };
120 }
121 
122 #endif
INT
Definition: paramFile.h:28
QXmlStreamReader * xmlIn_
Definition: paramFile.h:116
File::OpenMode open_mode_
Definition: paramFile.h:114
list< String > allowed_values
Definition: paramFile.h:71
INFILELIST
Definition: paramFile.h:28
list< String > supported_formats
Definition: paramFile.h:75
DOUBLE
Definition: paramFile.h:28
std::ios::openmode OpenMode
Definition: file.h:168
INFILE
Definition: paramFile.h:28
String filename_
Definition: paramFile.h:113
STRING
Definition: paramFile.h:28
DOUBLELIST
Definition: paramFile.h:28
OUTFILE
Definition: paramFile.h:28
STRINGLIST
Definition: paramFile.h:28
OUTFILELIST
Definition: paramFile.h:28
INTLIST
Definition: paramFile.h:28
QFile * file_
Definition: paramFile.h:118
GALAXY_OPT_OUTDIR
Definition: paramFile.h:28
#define BALL_EXPORT
Definition: COMMON/global.h:50
QXmlStreamWriter * xmlOut_
Definition: paramFile.h:117