File indexing completed on 2025-01-18 10:10:31
0001
0002
0003
0004
0005
0006
0007
0008
0009 #ifndef ROOT7_Browsabl_RSysFileItem
0010 #define ROOT7_Browsabl_RSysFileItem
0011
0012 #include <ROOT/Browsable/RItem.hxx>
0013
0014 namespace ROOT {
0015 namespace Browsable {
0016
0017
0018 class RSysDirLevelIter;
0019
0020
0021
0022
0023
0024
0025 class RSysFileItem : public RItem {
0026
0027 friend class RSysDirLevelIter;
0028
0029 private:
0030
0031 int type{0};
0032 int uid{0};
0033 int gid{0};
0034 bool islink{false};
0035 bool isdir{false};
0036 long modtime{0};
0037 int64_t size{0};
0038
0039 protected:
0040
0041 std::string ftype;
0042 std::string fuid;
0043 std::string fgid;
0044
0045 public:
0046
0047
0048 RSysFileItem() = default;
0049
0050 RSysFileItem(const std::string &_name, int _nchilds) : RItem(_name, _nchilds) {}
0051
0052
0053 virtual ~RSysFileItem() = default;
0054
0055 void SetType(const std::string &_type) { ftype = _type; }
0056 void SetUid(const std::string &_uid) { fuid = _uid; }
0057 void SetGid(const std::string &_gid) { fgid = _gid; }
0058
0059 const std::string &GetType() const { return ftype; }
0060 const std::string &GetUid() const { return fuid; }
0061 const std::string &GetGid() const { return fgid; }
0062
0063
0064
0065 bool IsFolder() const override { return isdir; }
0066
0067
0068 bool IsHidden() const override
0069 {
0070 auto &n = GetName();
0071 if ((n.length() == 0) || (n[0] != '.')) return false;
0072 return (n != ".") && (n != "..");
0073 }
0074
0075 bool Compare(const RItem *b, const std::string &method) const override
0076 {
0077 if (IsFolder() != b->IsFolder())
0078 return IsFolder();
0079
0080 if (method == "size") {
0081 auto fb = dynamic_cast<const RSysFileItem *> (b);
0082 if (fb)
0083 return size < fb->size;
0084 }
0085
0086 return GetName() < b->GetName();
0087 }
0088 };
0089
0090 }
0091 }
0092
0093
0094 #endif