BALL 1.5.0
paramFile.h
Go to the documentation of this file.
1// -*- Mode: C++; tab-width: 2; -*-
2// vi: set ts=2:
3//
4
5#ifndef BALL_FORMAT_PARAMFILE_H
6#define BALL_FORMAT_PARAMFILE_H
7
8#include <BALL/SYSTEM/file.h>
10
11#include <QtCore/QXmlStreamReader>
12#include <QtCore/QXmlStreamWriter>
13#include <QtCore/QFile>
14
15#include <map>
16#include <list>
17#include <set>
18
19
20namespace BALL
21{
23 class BALL_EXPORT ParamFile : public File
24 {
25 public:
26
28 {
39 //TODO: do we REALLY need these two openly galaxy specific parameter types?
40 // couldn't we do it with tags or something more elegant?
42 GALAXY_OPT_OUTID
43 };
44
46 {
47 // constructor
49 {
50 name = "";
51 description = "";
52 category = "";
53 mandatory = false;
54 advanced = false;
55 type = INFILE;
56 allowed_values.clear();
57 supported_formats.clear();
58 hidden = false;
59 }
60
67
69 list<String> allowed_values;
70
73 list<String> supported_formats;
74
75 // if parameters shall be hidden in galaxy
76 bool hidden;
77 };
78
79 ParamFile(const String& name, File::OpenMode open_mode);
81
88 void writeSection(String section_name, String section_description, String version, const String& section_helptext,
89 const String& category, const std::list<std::pair<String,ParameterDescription> >& descriptions,
90 const std::map<String,list<String> >& values);
91
96 void readSection(String& tool_name, String& section_description, String& version, String& section_helptext,
97 String& category, std::list<std::pair<String, ParameterDescription> >& descriptions,
98 std::map<String,list<String> >& values,
99 bool overwrite_existing=false);
100
101 void close();
102
104 static String buildNestedParameterName(const String& category, const String& parameter_name);
105
107 static Size parseNestedParameterName(const String& parameter_name, String string_array[]);
108
109
110 protected:
111
115 QXmlStreamReader* xmlIn_;
116 QXmlStreamWriter* xmlOut_;
117 QFile* file_;
118
119 private:
120
130 std::set<String> getTags(QXmlStreamAttributes& attributes);
131 };
132}
133
134#endif
Definition: constants.h:13
void readSection(String &tool_name, String &section_description, String &version, String &section_helptext, String &category, std::list< std::pair< String, ParameterDescription > > &descriptions, std::map< String, list< String > > &values, bool overwrite_existing=false)
ParamFile(const String &name, File::OpenMode open_mode)
static String buildNestedParameterName(const String &category, const String &parameter_name)
QFile * file_
Definition: paramFile.h:117
QXmlStreamWriter * xmlOut_
Definition: paramFile.h:116
String filename_
Definition: paramFile.h:112
static Size parseNestedParameterName(const String &parameter_name, String string_array[])
QXmlStreamReader * xmlIn_
Definition: paramFile.h:115
void writeSection(String section_name, String section_description, String version, const String &section_helptext, const String &category, const std::list< std::pair< String, ParameterDescription > > &descriptions, const std::map< String, list< String > > &values)
File::OpenMode open_mode_
Definition: paramFile.h:113
std::ios::openmode OpenMode
Definition: file.h:165
#define BALL_EXPORT
Definition: COMMON/global.h:50