OpenTwin 0.1
OpenTwin
 
Loading...
Searching...
No Matches
PropertyFilePath.h
Go to the documentation of this file.
1
4// ###########################################################################################################################################################################################################################################################################################################################
5
6#pragma once
7
8// OpenTwin header
9#include "OTGui/Property.h"
10
11// std header
12#include <string>
13
14namespace ot {
15
18 public:
20 ReadFile = 0,
21 WriteFile = 1
22 };
23
24 struct FilterInfo {
25 std::string extension;
26 std::string text;
27 };
28
30 PropertyFilePath(const PropertyBase& _base);
31 PropertyFilePath(BrowseMode _mode = ReadFile, PropertyFlags _flags = PropertyFlags(NoFlags));
32 PropertyFilePath(const std::string& _path, BrowseMode _mode = ReadFile, PropertyFlags _flags = PropertyFlags(NoFlags));
33 PropertyFilePath(const std::string& _name, const std::string& _path, BrowseMode _mode = ReadFile, PropertyFlags _flags = PropertyFlags(NoFlags));
34 virtual ~PropertyFilePath() {};
35
36 static std::string propertyTypeString(void) { return "FilePath"; };
37 virtual std::string getPropertyType(void) const override { return PropertyFilePath::propertyTypeString(); };
38
39 virtual Property* createCopy(void) const override;
40
41 void setPath(const std::string& _path) { m_path = _path; };
42 const std::string& getPath(void) const { return m_path; };
43
44 void setBrowseMode(BrowseMode _mode) { m_browseMode = _mode; };
45 BrowseMode getBrowseMode(void) const { return m_browseMode; };
46
47 void setFilters(const std::list<FilterInfo>& _filters) { m_filters = _filters; };
48 void addFilter(const std::string& _extension, const std::string& _text) { this->addFilter(FilterInfo{ _extension, _text }); };
49 void addFilter(const FilterInfo& _info);
50 const std::list<FilterInfo>& getFilters(void) const { return m_filters; }
51
52 protected:
57 virtual void getPropertyData(ot::JsonValue& _object, ot::JsonAllocator& _allocator) const override;
58
62 virtual void setPropertyData(const ot::ConstJsonObject& _object) override;
63
64 private:
65 std::string m_path;
66 BrowseMode m_browseMode;
67 std::list<FilterInfo> m_filters;
68 };
69
70}
#define OT_DECL_NOCOPY(___class)
Removes the default copy constructor and assignment operator.
Definition OTClassHelper.h:14
#define OT_GUI_API_EXPORT
Definition OTGuiAPIExport.h:9
The PropertyBase class is used to hold general Property information.
Definition PropertyBase.h:25
Definition PropertyFilePath.h:16
BrowseMode
Definition PropertyFilePath.h:19
void setFilters(const std::list< FilterInfo > &_filters)
Definition PropertyFilePath.h:47
void setBrowseMode(BrowseMode _mode)
Definition PropertyFilePath.h:44
BrowseMode getBrowseMode(void) const
Definition PropertyFilePath.h:45
void addFilter(const std::string &_extension, const std::string &_text)
Definition PropertyFilePath.h:48
void setPath(const std::string &_path)
Definition PropertyFilePath.h:41
const std::list< FilterInfo > & getFilters(void) const
Definition PropertyFilePath.h:50
const std::string & getPath(void) const
Definition PropertyFilePath.h:42
virtual std::string getPropertyType(void) const override
Definition PropertyFilePath.h:37
virtual ~PropertyFilePath()
Definition PropertyFilePath.h:34
static std::string propertyTypeString(void)
Definition PropertyFilePath.h:36
The Property class is used as a base class for all Properties that can be displayed and modified in t...
Definition Property.h:21
Definition Connector.h:8
rapidjson::Value JsonValue
Writable JSON value.
Definition JSON.h:27
rapidjson::GenericObject< true, rapidjson::GenericValue< rapidjson::UTF8<>, rapidjson::MemoryPoolAllocator< rapidjson::CrtAllocator > > > ConstJsonObject
Read only JSON Object.
Definition JSON.h:35
rapidjson::MemoryPoolAllocator< rapidjson::CrtAllocator > JsonAllocator
Allocator used for writing to JSON values.
Definition JSON.h:30
Definition PropertyFilePath.h:24
std::string extension
Definition PropertyFilePath.h:25
std::string text
Definition PropertyFilePath.h:26