schema_editor/comdel/domain/attribute.h

66 lines
1.2 KiB
C++

#ifndef DOMAIN_ATTRIBUTE_H
#define DOMAIN_ATTRIBUTE_H
#include <vector>
#include "rule.h"
#include "value.h"
namespace domain {
class Enumeration {
std::string name;
Value value;
public:
Enumeration(std::string name, Value value);
std::string getName();
Value getValue();
};
class Popup {
public:
enum PopupType {
AUTOMATIC,
ON_DEMAND
};
private:
std::string title;
std::string text;
PopupType type;
bool enumerated;
std::vector<Enumeration> enumeration;
std::vector<Rule> rules;
public:
Popup(std::string title, std::string text, PopupType type, std::vector<Rule> rules, std::vector<Enumeration> enumeration);
std::string getTitle();
std::string getText();
PopupType getType();
std::vector<Rule> getRules();
bool isEnumerated();
std::vector<Enumeration> &getEnumeration();
};
class Attribute
{
std::string name;
Value defaultValue;
std::optional<Popup> popup;
public:
Attribute(std::string name, Value defaultValue, std::optional<Popup> popup = std::nullopt);
std::string getName();
Value getDefault();
std::optional<Popup> getPopup();
};
} // namespace domain
#endif // DOMAIN_ATTRIBUTE_H