acme
Foundational cross-platform layer of the ca2 framework
Loading...
Searching...
No Matches
item.h
1#pragma once
2
3
4//#include "acme/filesystem/filesystem/path.h"
5#include "acme/handler/item.h"
6
7
8namespace file
9{
10
11
12 class CLASS_DECL_ACME item :
13 virtual public ::item
14 {
15 protected:
16
17
18 ::file::path m_pathUser;
19 ::file::path m_pathFinal;
20
21
22 public:
23
24
25 e_flag m_flags;
26 string m_strName;
27
28
29 item() {}
30
31
32 item(const item & item) :
33 m_pathUser(item.m_pathUser),
34 m_pathFinal(item.m_pathFinal),
35 m_flags(item.m_flags),
36 m_strName(item.m_strName)
37 {
38
39
40 }
41
42
43 item(const ::file::path & pathUser, const ::file::path & pathFinal) :
44 m_pathUser(pathUser),
45 m_pathFinal(pathFinal),
46 m_strName(pathUser.name())
47 {
48
49 if (m_pathFinal.has_character())
50 {
51
52 if (m_pathFinal.flags() & e_flag_final_path)
53 {
54
55 m_flags += e_flag_final_path;
56
57 }
58 else
59 {
60
61 ASSERT(false);
62
63 }
64
65 }
66
67 }
68
69
70 item(const ::file::path & pathUser, const ::file::path & pathFinal, const e_flag & flags) :
71 m_pathUser(pathUser),
72 m_pathFinal(pathFinal),
73 m_flags(flags),
74 m_strName(pathUser.name())
75 {
76
77 if (m_pathFinal.has_character())
78 {
79
80 if (m_pathFinal.flags() & e_flag_final_path)
81 {
82
83 m_flags += e_flag_final_path;
84
85 }
86 else
87 {
88
89 ASSERT(false);
90
91 }
92
93 }
94
95 }
96 ~item() override {}
97
98
99 const ::file::path & user_path() const { return m_pathUser.has_character() ? m_pathUser : m_pathFinal; }
100 const ::file::path & final_path() const { return m_pathFinal.has_character() ? m_pathFinal : m_pathUser; }
101
102 ::file::path & user_path_reference() { return m_pathUser; }
103 ::file::path & final_path_reference() { return m_pathFinal; }
104
105
106 virtual void set_user_path(const ::file::path & pathUser) { m_pathUser = pathUser; m_flags -= e_flag_final_path;}
107 virtual void set_final_path(const ::file::path & pathFinal) { ASSERT(pathFinal.flags() & e_flag_final_path); m_pathFinal = pathFinal; m_flags += e_flag_final_path; }
108
109
110 virtual e_type get_final_path_type() const { return m_pathFinal.m_etype; }
111 virtual void set_final_path_type(const e_type & etype) { m_pathFinal.m_etype = etype; }
112
113
114 inline bool has_final_path() const { return m_flags.has(e_flag_final_path); }
115
116 virtual void truncate();
117 virtual ::i32_boolean is_folder() const;
118 virtual bool exists() const;
119 virtual ::i32_boolean is_file() const;
120
121 virtual void erase();
122 virtual void create_folder();
123
124 virtual ::file::listing_base list();
125
126 virtual ::filesize size() const;
127 virtual class ::time last_modified_time() const;
128 virtual void set_last_modified_time(const class ::time & time);
129
130
131 };
132
133
134} // namespace file
135
136
137
Definition path.h:52
Definition flags.h:13
Definition aaa_time.h:13
Definition filesystem.h:16