summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTobias Markmann <tm@ayena.de>2016-03-31 14:57:35 (GMT)
committerTobias Markmann <tm@ayena.de>2016-03-31 14:57:35 (GMT)
commitcfbdb43d2cadd40aa87338d41548e4bf89e146e6 (patch)
tree18d94153a302445196fc0c18586abf44a1ce4a38 /Swiften/Elements/FormField.h
parent1d545a4a7fb877f021508094b88c1f17b30d8b4e (diff)
downloadswift-cfbdb43d2cadd40aa87338d41548e4bf89e146e6.zip
swift-cfbdb43d2cadd40aa87338d41548e4bf89e146e6.tar.bz2
Convert tabs to 4 spaces for all source files
Removed trailing spaces and whitespace on empty lines in the process. Changed CheckTabs.py tool to disallow hard tabs in source files. Test-Information: Manually checked 30 random files that the conversion worked as expected. Change-Id: I874f99d617bd3d2bb55f02d58f22f58f9b094480
Diffstat (limited to 'Swiften/Elements/FormField.h')
-rw-r--r--Swiften/Elements/FormField.h242
1 files changed, 121 insertions, 121 deletions
diff --git a/Swiften/Elements/FormField.h b/Swiften/Elements/FormField.h
index d84dbb6..e62dec4 100644
--- a/Swiften/Elements/FormField.h
+++ b/Swiften/Elements/FormField.h
@@ -15,126 +15,126 @@
#include <Swiften/JID/JID.h>
namespace Swift {
- class SWIFTEN_API FormField {
- public:
- typedef boost::shared_ptr<FormField> ref;
-
- enum Type {
- UnknownType,
- BooleanType,
- FixedType,
- HiddenType,
- ListSingleType,
- TextMultiType,
- TextPrivateType,
- TextSingleType,
- JIDSingleType,
- JIDMultiType,
- ListMultiType
- };
-
- FormField(Type type = UnknownType) : type(type), required(false) {}
- FormField(Type type, const std::string& value) : type(type), required(false) {
- addValue(value);
- }
- virtual ~FormField();
-
- struct Option {
- Option(const std::string& label, const std::string& value) : label(label), value(value) {}
- std::string label;
- std::string value;
- };
-
- void setName(const std::string& name) { this->name = name; }
- const std::string& getName() const { return name; }
-
- void setLabel(const std::string& label) { this->label = label; }
- const std::string& getLabel() const { return label; }
-
- void setDescription(const std::string& description) { this->description = description; }
- const std::string& getDescription() const { return description; }
-
- void setRequired(bool required) { this->required = required; }
- bool getRequired() const { return required; }
-
- void addOption(const Option& option) {
- options.push_back(option);
- }
-
- const std::vector<Option>& getOptions() const {
- return options;
- }
-
- void clearOptions() {
- options.clear();
- }
-
- const std::vector<std::string>& getValues() const {
- return values;
- }
-
- void addValue(const std::string& value) {
- values.push_back(value);
- }
-
- Type getType() const {
- return type;
- }
-
- void setType(Type type) {
- this->type = type;
- }
-
- // Type specific
-
- bool getBoolValue() const {
- assert(type == BooleanType || type == UnknownType);
- if (values.empty()) {
- return false;
- }
- return values[0] == "true" || values[0] == "1";
- }
-
- void setBoolValue(bool b);
-
- JID getJIDSingleValue() const {
- assert(type == JIDSingleType || type == UnknownType);
- return values.empty() ? JID() : JID(values[0]);
- }
-
- JID getJIDMultiValue(size_t index) const {
- assert(type == JIDMultiType || type == UnknownType);
- return values.empty() ? JID() : JID(values[index]);
- }
-
- std::string getTextPrivateValue() const {
- assert(type == TextPrivateType || type == UnknownType);
- return values.empty() ? "" : values[0];
- }
-
- std::string getFixedValue() const {
- assert(type == FixedType || type == UnknownType);
- return values.empty() ? "" : values[0];
- }
-
- std::string getTextSingleValue() const {
- assert(type == TextSingleType || type == UnknownType);
- return values.empty() ? "" : values[0];
- }
-
- std::string getTextMultiValue() const;
- void setTextMultiValue(const std::string& value);
-
- protected:
-
- private:
- Type type;
- std::string name;
- std::string label;
- std::string description;
- bool required;
- std::vector<Option> options;
- std::vector<std::string> values;
- };
+ class SWIFTEN_API FormField {
+ public:
+ typedef boost::shared_ptr<FormField> ref;
+
+ enum Type {
+ UnknownType,
+ BooleanType,
+ FixedType,
+ HiddenType,
+ ListSingleType,
+ TextMultiType,
+ TextPrivateType,
+ TextSingleType,
+ JIDSingleType,
+ JIDMultiType,
+ ListMultiType
+ };
+
+ FormField(Type type = UnknownType) : type(type), required(false) {}
+ FormField(Type type, const std::string& value) : type(type), required(false) {
+ addValue(value);
+ }
+ virtual ~FormField();
+
+ struct Option {
+ Option(const std::string& label, const std::string& value) : label(label), value(value) {}
+ std::string label;
+ std::string value;
+ };
+
+ void setName(const std::string& name) { this->name = name; }
+ const std::string& getName() const { return name; }
+
+ void setLabel(const std::string& label) { this->label = label; }
+ const std::string& getLabel() const { return label; }
+
+ void setDescription(const std::string& description) { this->description = description; }
+ const std::string& getDescription() const { return description; }
+
+ void setRequired(bool required) { this->required = required; }
+ bool getRequired() const { return required; }
+
+ void addOption(const Option& option) {
+ options.push_back(option);
+ }
+
+ const std::vector<Option>& getOptions() const {
+ return options;
+ }
+
+ void clearOptions() {
+ options.clear();
+ }
+
+ const std::vector<std::string>& getValues() const {
+ return values;
+ }
+
+ void addValue(const std::string& value) {
+ values.push_back(value);
+ }
+
+ Type getType() const {
+ return type;
+ }
+
+ void setType(Type type) {
+ this->type = type;
+ }
+
+ // Type specific
+
+ bool getBoolValue() const {
+ assert(type == BooleanType || type == UnknownType);
+ if (values.empty()) {
+ return false;
+ }
+ return values[0] == "true" || values[0] == "1";
+ }
+
+ void setBoolValue(bool b);
+
+ JID getJIDSingleValue() const {
+ assert(type == JIDSingleType || type == UnknownType);
+ return values.empty() ? JID() : JID(values[0]);
+ }
+
+ JID getJIDMultiValue(size_t index) const {
+ assert(type == JIDMultiType || type == UnknownType);
+ return values.empty() ? JID() : JID(values[index]);
+ }
+
+ std::string getTextPrivateValue() const {
+ assert(type == TextPrivateType || type == UnknownType);
+ return values.empty() ? "" : values[0];
+ }
+
+ std::string getFixedValue() const {
+ assert(type == FixedType || type == UnknownType);
+ return values.empty() ? "" : values[0];
+ }
+
+ std::string getTextSingleValue() const {
+ assert(type == TextSingleType || type == UnknownType);
+ return values.empty() ? "" : values[0];
+ }
+
+ std::string getTextMultiValue() const;
+ void setTextMultiValue(const std::string& value);
+
+ protected:
+
+ private:
+ Type type;
+ std::string name;
+ std::string label;
+ std::string description;
+ bool required;
+ std::vector<Option> options;
+ std::vector<std::string> values;
+ };
}