]> git.tdb.fi Git - libs/core.git/blob - source/fs/stat.cpp
ae9f803a9d16f1030da32d1c9e63f14cf7b48356
[libs/core.git] / source / fs / stat.cpp
1 #include "path.h"
2 #include "stat.h"
3 #include "stat_private.h"
4
5 using namespace std;
6
7 namespace Msp {
8 namespace FS {
9
10 Stat::Stat(const Stat &other):
11         exists(other.exists),
12         type(other.type),
13         size(other.type),
14         alloc_size(other.alloc_size),
15         mtime(other.mtime),
16         owner_info(other.owner_info),
17         priv(other.priv ? new Private(*other.priv) : 0)
18 { }
19
20 Stat &Stat::operator=(const Stat &other)
21 {
22         exists = other.exists;
23         type = other.type;
24         size = other.size;
25         alloc_size = other.alloc_size;
26         mtime = other.mtime;
27         owner_info = other.owner_info;
28         delete priv;
29         priv = (other.priv ? new Private(*other.priv) : 0);
30
31         return *this;
32 }
33
34 Stat::~Stat()
35 {
36         delete priv;
37 }
38
39 const string &Stat::get_owner() const
40 {
41         if(priv && owner_info.owner.empty())
42                 priv->fill_owner_info(owner_info);
43         return owner_info.owner;
44 }
45
46 const string &Stat::get_group() const
47 {
48         if(priv && owner_info.group.empty())
49                 priv->fill_owner_info(owner_info);
50         return owner_info.group;
51 }
52
53 } // namespace FS
54 } // namespace Msp