Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
RSysFileItem.hxx
Go to the documentation of this file.
1/*************************************************************************
2 * Copyright (C) 1995-2020, Rene Brun and Fons Rademakers. *
3 * All rights reserved. *
4 * *
5 * For the licensing terms see $ROOTSYS/LICENSE. *
6 * For the list of contributors see $ROOTSYS/README/CREDITS. *
7 *************************************************************************/
8
9#ifndef ROOT7_Browsabl_RSysFileItem
10#define ROOT7_Browsabl_RSysFileItem
11
13
14namespace ROOT {
15namespace Experimental {
16namespace Browsable {
17
18/** \class RSysFileItem
19\ingroup rbrowser
20\brief Representation of single item in the file browser
21*/
22
23class RSysFileItem : public RItem {
24public:
25 // internal data, used for generate directory list
26 int type{0}; ///<! file type
27 int uid{0}; ///<! file uid
28 int gid{0}; ///<! file gid
29 bool islink{false}; ///<! true if symbolic link
30 bool isdir{false}; ///<! true if directory
31 long modtime{0}; ///<! modification time
32 int64_t size{0}; ///<! file size
33
34 // this is part for browser, visible for I/O
35 std::string mtime; ///< modification time
36 std::string ftype; ///< file attributes
37 std::string fuid; ///< user id
38 std::string fgid; ///< group id
39
40 /** Default constructor */
41 RSysFileItem() = default;
42
43 RSysFileItem(const std::string &_name, int _nchilds) : RItem(_name, _nchilds) {}
44
45 // should be here, one needs virtual table for correct streaming of RRootBrowserReply
46 virtual ~RSysFileItem() = default;
47
48 // only subdir is folder for files items
49 bool IsFolder() const override { return isdir; }
50
51 // return true for hidden files
52 bool IsHidden() const override
53 {
54 auto &n = GetName();
55 if ((n.length() == 0) || (n[0] != '.')) return false;
56 return (n != ".") && (n != "..");
57 }
58
59 bool Compare(const RItem *b, const std::string &method) const override
60 {
61 if (IsFolder() != b->IsFolder())
62 return IsFolder();
63
64 if (method == "size") {
65 auto fb = dynamic_cast<const RSysFileItem *> (b);
66 if (fb)
67 return size < fb->size;
68 }
69
70 return GetName() < b->GetName();
71 }
72};
73
74} // namespace Browsable
75} // namespace Experimental
76} // namespace ROOT
77
78
79#endif
#define b(i)
Definition RSha256.hxx:100
Representation of single item in the browser.
Definition RItem.hxx:24
const std::string & GetName() const
Definition RItem.hxx:40
Representation of single item in the file browser.
RSysFileItem(const std::string &_name, int _nchilds)
bool Compare(const RItem *b, const std::string &method) const override
RSysFileItem()=default
Default constructor.
const Int_t n
Definition legend1.C:16
tbb::task_arena is an alias of tbb::interface7::task_arena, which doesn't allow to forward declare tb...