/* * Copyright (c) 2010-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #pragma once #include #include #include #include #include #include namespace Swift { class SWIFTEN_API FormField { public: typedef std::shared_ptr 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