| @ -0,0 +1,9 @@ | |||||
| #pragma once | |||||
| #include <QtWidgets> | |||||
| class CharacterView : public QWidget | |||||
| { | |||||
| public: | |||||
| CharacterView(); | |||||
| }; | |||||
| @ -0,0 +1,7 @@ | |||||
| #pragma once | |||||
| class Character | |||||
| { | |||||
| public: | |||||
| Character(); | |||||
| }; | |||||
| @ -0,0 +1,33 @@ | |||||
| #pragma once | |||||
| #include <iostream> | |||||
| #include <optional> | |||||
| class CharacterProperty | |||||
| { | |||||
| public: | |||||
| using StringType = std::string; | |||||
| using IntegerType = int; | |||||
| using FloatingType = double; | |||||
| public: | |||||
| enum Type { | |||||
| string, | |||||
| integer, | |||||
| floating_point | |||||
| }; | |||||
| public: | |||||
| CharacterProperty(); | |||||
| std::optional<StringType> toString() const; | |||||
| std::optional<IntegerType> toInt() const; | |||||
| std::optional<FloatingType> toFloat() const; | |||||
| private: | |||||
| Type m_valueType; | |||||
| StringType m_valueString; | |||||
| IntegerType m_valueInt; | |||||
| FloatingType m_valueFloat; | |||||
| }; | |||||
| @ -0,0 +1,9 @@ | |||||
| #pragma once | |||||
| #include <QtWidgets> | |||||
| class CharacterView : public QWidget | |||||
| { | |||||
| public: | |||||
| CharacterView(); | |||||
| }; | |||||
| @ -0,0 +1,6 @@ | |||||
| #include "character.h" | |||||
| Character::Character() | |||||
| { | |||||
| } | |||||
| @ -0,0 +1,29 @@ | |||||
| #include "characterproperty.h" | |||||
| CharacterProperty::CharacterProperty() | |||||
| { | |||||
| } | |||||
| std::optional<CharacterProperty::StringType> CharacterProperty::toString() const | |||||
| { | |||||
| if(m_valueType != Type::string) | |||||
| return std::nullopt; | |||||
| return std::make_optional(m_valueString); | |||||
| } | |||||
| std::optional<CharacterProperty::IntegerType> CharacterProperty::toInt() const | |||||
| { | |||||
| if(m_valueType != Type::integer) | |||||
| return std::nullopt; | |||||
| return std::make_optional(m_valueInt); | |||||
| } | |||||
| std::optional<CharacterProperty::FloatingType> CharacterProperty::toFloat() const | |||||
| { | |||||
| if(m_valueType != Type::floating_point) | |||||
| return std::nullopt; | |||||
| return std::make_optional(m_valueFloat); | |||||
| } | |||||
| @ -0,0 +1,5 @@ | |||||
| #include "characterview.h" | |||||
| CharacterView::CharacterView() | |||||
| { | |||||
| } | |||||
| @ -1,9 +1,13 @@ | |||||
| #include <iostream> | #include <iostream> | ||||
| #include <QApplication> | #include <QApplication> | ||||
| #include "characterview.h" | |||||
| int main(int argc, char** argv) | int main(int argc, char** argv) | ||||
| { | { | ||||
| QApplication app(argc, argv); | QApplication app(argc, argv); | ||||
| CharacterView window; | |||||
| window.show(); | |||||
| return app.exec(); | return app.exec(); | ||||
| } | } | ||||