File indexing completed on 2025-01-18 10:10:48
0001
0002
0003
0004
0005
0006
0007
0008
0009 #ifndef ROOT7_RStyle
0010 #define ROOT7_RStyle
0011
0012 #include <ROOT/RAttrMap.hxx>
0013
0014 #include <string>
0015 #include <list>
0016 #include <memory>
0017
0018 namespace ROOT {
0019 namespace Experimental {
0020
0021 class RDrawable;
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032 class RStyle {
0033
0034 public:
0035
0036 struct Block_t {
0037 std::string selector;
0038 RAttrMap map;
0039 Block_t() = default;
0040 Block_t(const std::string &_selector) : selector(_selector) {}
0041
0042 Block_t(const Block_t &src) : selector(src.selector), map(src.map) {}
0043 Block_t& operator=(const Block_t &) = delete;
0044 };
0045
0046 const RAttrMap::Value_t *Eval(const std::string &field, const RDrawable &drawable) const;
0047
0048 const RAttrMap::Value_t *Eval(const std::string &field, const std::string &selector) const;
0049
0050 RAttrMap &AddBlock(const std::string &selector)
0051 {
0052 fBlocks.emplace_back(selector);
0053 return fBlocks.back().map;
0054 }
0055
0056 void Clear();
0057
0058 static std::shared_ptr<RStyle> Parse(const std::string &css_code);
0059
0060 bool ParseString(const std::string &css_code);
0061
0062 private:
0063
0064 std::list<Block_t> fBlocks;
0065
0066 };
0067
0068 }
0069 }
0070
0071 #endif