3
* Ekiga -- A VoIP and Video-Conferencing application
4
* Copyright (C) 2000-2007 Damien Sandras
6
* This program is free software; you can redistribute it and/or modify
7
* it under the terms of the GNU General Public License as published by
8
* the Free Software Foundation; either version 2 of the License, or (at
9
* your option) any later version. This program is distributed in the hope
10
* that it will be useful, but WITHOUT ANY WARRANTY; without even the
11
* implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
12
* See the GNU General Public License for more details.
14
* You should have received a copy of the GNU General Public License along
15
* with this program; if not, write to the Free Software Foundation, Inc.,
16
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
18
* Ekiga is licensed under the GPL license and as a special exception, you
19
* have permission to link or otherwise combine this program with the
20
* programs OPAL, OpenH323 and PWLIB, and distribute the combination, without
21
* applying the requirements of the GNU GPL to the OPAL, OpenH323 and PWLIB
22
* programs, as long as you do follow the requirements of the GNU GPL for all
23
* the rest of the software thus combined.
28
* form-builder.h - description
29
* ------------------------------------------
30
* begin : written in 2007 by Julien Puydt
31
* copyright : (c) 2007 by Julien Puydt
32
* description : declaration of an object able to build a form
36
#ifndef __FORM_BUILDER_H__
37
#define __FORM_BUILDER_H__
51
class FormBuilder: public virtual Form, public virtual FormVisitor
59
void visit (FormVisitor &visitor) const;
61
const std::string hidden (const std::string name) const;
63
bool boolean (const std::string name) const;
65
const std::string text (const std::string name) const;
67
const std::string private_text (const std::string name) const;
69
const std::string multi_text (const std::string name) const;
71
const std::string single_choice (const std::string name) const;
73
const std::set<std::string> multiple_choice (const std::string name) const;
75
const std::set<std::string> editable_set (const std::string name) const;
79
void title (const std::string title);
81
void instructions (const std::string instructions);
83
void link (const std::string link,
84
const std::string uri);
86
void error (const std::string error);
88
void hidden (const std::string name,
89
const std::string value);
91
void boolean (const std::string name,
92
const std::string description,
95
void text (const std::string text,
96
const std::string description,
97
const std::string value);
99
void private_text (const std::string text,
100
const std::string description,
101
const std::string value);
103
void multi_text (const std::string text,
104
const std::string description,
105
const std::string value);
107
void single_choice (const std::string name,
108
const std::string description,
109
const std::string value,
110
const std::map<std::string, std::string> choices);
112
void multiple_choice (const std::string name,
113
const std::string description,
114
const std::set<std::string> values,
115
const std::map<std::string, std::string> choices);
117
void editable_set (const std::string name,
118
const std::string description,
119
const std::set<std::string> values,
120
const std::set<std::string> proposed_values);
125
HiddenField (const std::string _name,
126
const std::string _value): name(_name), value(_value)
129
const std::string name;
130
const std::string value;
135
BooleanField (const std::string _name,
136
const std::string _description,
137
bool _value): name(_name), description(_description),
141
const std::string name;
142
const std::string description;
148
TextField (const std::string _name,
149
const std::string _description,
150
const std::string _value): name(_name),
151
description(_description),
155
const std::string name;
156
const std::string description;
157
const std::string value;
160
struct MultiTextField
162
MultiTextField (const std::string _name,
163
const std::string _description,
164
const std::string _value): name(_name),
165
description(_description),
169
const std::string name;
170
const std::string description;
171
const std::string value;
174
struct SingleChoiceField
176
SingleChoiceField (const std::string _name,
177
const std::string _description,
178
const std::string _value,
179
const std::map<std::string, std::string> _choices):
180
name(_name), description(_description),
181
value(_value), choices(_choices)
184
const std::string name;
185
const std::string description;
186
const std::string value;
187
const std::map<std::string, std::string> choices;
191
struct MultipleChoiceField
193
MultipleChoiceField (const std::string _name,
194
const std::string _description,
195
const std::set<std::string> _values,
196
const std::map<std::string, std::string> _choices):
197
name(_name), description(_description),
198
values(_values), choices(_choices)
201
const std::string name;
202
const std::string description;
203
const std::set<std::string> values;
204
const std::map<std::string, std::string> choices;
207
struct EditableSetField
209
EditableSetField (const std::string _name,
210
const std::string _description,
211
const std::set<std::string> _values,
212
const std::set<std::string> _proposed_values):
213
name(_name), description(_description),
214
values(_values), proposed_values(_proposed_values)
217
const std::string name;
218
const std::string description;
219
const std::set<std::string> values;
220
const std::set<std::string> proposed_values;
235
std::string my_title;
236
std::string my_instructions;
237
std::pair<std::string, std::string> my_link;
238
std::string my_error;
239
std::list<FieldType> ordering;
240
std::list<struct HiddenField> hiddens;
241
std::list<struct BooleanField> booleans;
242
std::list<struct TextField> texts;
243
std::list<struct TextField> private_texts;
244
std::list<struct MultiTextField> multi_texts;
245
std::list<struct SingleChoiceField> single_choices;
246
std::list<struct MultipleChoiceField> multiple_choices;
247
std::list<struct EditableSetField> editable_sets;