File indexing completed on 2025-01-18 10:10:30
0001
0002
0003
0004
0005
0006
0007
0008
0009 #ifndef ROOT7_Browsable_RElement
0010 #define ROOT7_Browsable_RElement
0011
0012 #include <ROOT/Browsable/RHolder.hxx>
0013
0014 #include <string>
0015 #include <vector>
0016
0017 namespace ROOT {
0018 namespace Browsable {
0019
0020 using RElementPath_t = std::vector<std::string>;
0021
0022 class RLevelIter;
0023
0024 class RItem;
0025
0026
0027
0028
0029
0030
0031
0032
0033
0034 class RElement {
0035 public:
0036
0037 enum EContentKind {
0038 kNone,
0039 kText,
0040 kImage,
0041 kPng,
0042 kJpeg,
0043 kJson,
0044 kFileName
0045 };
0046
0047 static EContentKind GetContentKind(const std::string &kind);
0048
0049
0050 enum EActionKind {
0051 kActNone,
0052 kActBrowse,
0053 kActEdit,
0054 kActImage,
0055 kActDraw6,
0056 kActDraw7,
0057 kActCanvas,
0058 kActTree,
0059 kActGeom
0060 };
0061
0062 virtual ~RElement() = default;
0063
0064
0065 virtual std::string GetName() const = 0;
0066
0067
0068 virtual bool MatchName(const std::string &name) const { return name == GetName(); }
0069
0070
0071 virtual std::string GetTitle() const { return ""; }
0072
0073
0074 virtual std::unique_ptr<RLevelIter> GetChildsIter();
0075
0076
0077 virtual std::string GetContent(const std::string & = "text");
0078
0079
0080 virtual std::unique_ptr<RHolder> GetObject() { return nullptr; }
0081
0082
0083 virtual bool IsObject(void *) { return false; }
0084
0085
0086 virtual bool IsFolder() const { return false; }
0087
0088 virtual int GetNumChilds();
0089
0090
0091 virtual bool CheckValid() { return true; }
0092
0093
0094 virtual EActionKind GetDefaultAction() const { return kActNone; }
0095
0096
0097 virtual bool IsCapable(EActionKind action) const { return action == GetDefaultAction(); }
0098
0099
0100 virtual bool IsExpandByDefault() const { return false; }
0101
0102
0103 virtual bool cd() { return false; }
0104
0105 virtual std::unique_ptr<RItem> CreateItem() const;
0106
0107 static std::shared_ptr<RElement> GetSubElement(std::shared_ptr<RElement> &elem, const RElementPath_t &path);
0108
0109 static RElementPath_t ParsePath(const std::string &str);
0110
0111 static int ComparePaths(const RElementPath_t &path1, const RElementPath_t &path2);
0112
0113 static std::string GetPathAsString(const RElementPath_t &path);
0114
0115 static int ExtractItemIndex(std::string &name);
0116 };
0117
0118 }
0119 }
0120
0121 #endif