blob: 27ced8216241dac7cbf222f1fc4c59e59a515d3e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
/*
* Copyright (c) 2013 Remko Tronçon
* Licensed under the GNU General Public License.
* See the COPYING file for more information.
*/
#include <Swiften/Elements/FormField.h>
#include <boost/algorithm/string/split.hpp>
#include <boost/algorithm/string/join.hpp>
#include <boost/algorithm/string/classification.hpp>
using namespace Swift;
FormField::~FormField() {
}
std::string FormField::getTextMultiValue() const {
assert(type == TextMultiType || type == UnknownType);
return boost::algorithm::join(values, "\n");
}
void FormField::setTextMultiValue(const std::string& value) {
assert(type == TextMultiType || type == UnknownType);
values.clear();
boost::split(values, value, boost::is_any_of("\n"));
}
void FormField::setBoolValue(bool b) {
assert(type == BooleanType || type == UnknownType);
values.clear();
values.push_back(b ? "1" : "0");
}
|