Debian Codegraph @

src/utils/davix_fileproperties.hpp

raw
1 /*
2 * This File is part of Davix, The IO library for HTTP based protocols
3 * Copyright (C) CERN 2013
4 * Author: Adrien Devresse <[email protected]>
5 *
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
10 *
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19 *
20 */
21
22 #ifndef DAVIX_FILEPROPERTIES_H
23 #define DAVIX_FILEPROPERTIES_H
24
25 #include <davix_internal_config.hpp>
26 #include <string>
27 #include <vector>
28
29 #include <file/davix_file_info.hpp>
30 #include <utils/stringutils.hpp>
31
32
33 namespace Davix {
34
35
36 struct QuotaInfo::Internal {
37 dav_size_t free_space;
38 dav_size_t used_bytes;
39
40 Internal() {
41 free_space = 0;
42 used_bytes = 0;
43 }
44 };
45
46 struct FileProperties
47 {
48 FileProperties() :
49 filename(),
50 req_status(0),
51 info(){}
52
53 std::string filename;
54 unsigned int req_status; /* status code of the request associated ( ex: http 200) */
55
56 // stat() metadata
57 StatInfo info;
58 QuotaInfo::Internal quota;
59
60 inline void clear(){
61 info = StatInfo();
62 filename.clear();
63 req_status = 0;
64 }
65
66
67 };
68
69 struct FileDeleteStatus
70 {
71 FileDeleteStatus() :
72 filename(),
73 message(),
74 error_code(),
75 req_status(0),
76 error(false){}
77
78 std::string filename;
79 std::string message;
80 std::string error_code; // for when server return a text code
81 unsigned int req_status; /* status code of the request associated ( ex: http 200) */
82 bool error;
83
84 inline void clear(){
85 filename.clear();
86 message.clear();
87 error_code.clear();
88 req_status = 0;
89 error = false;
90 }
91 };
92
93 } // namespace Davix
94
95 #endif // DAVIX_FILEPROPERTIES_H