|
27 | 27 | namespace olp { |
28 | 28 | namespace utils { |
29 | 29 |
|
| 30 | +/** @brief Manages directories. |
| 31 | +*/ |
30 | 32 | class CORE_API Dir { |
31 | 33 | public: |
32 | | - /// Alias for filter function. |
| 34 | + /// An alias for the filter function. |
33 | 35 | using FilterFunction = std::function<bool(const std::string&)>; |
34 | 36 |
|
35 | 37 | /** |
36 | | - * @brief Checks if directory exists. |
| 38 | + * @brief Checks whether a directory exists. |
37 | 39 | * |
38 | | - * @param path Path of the directory. |
| 40 | + * @param path The path of the directory. |
39 | 41 | * |
40 | | - * @return \c true if directory exists, \c false otherwise. |
| 42 | + * @return True if the directory exists; false otherwise. |
41 | 43 | * |
42 | | - * @deprecated Will be removed by 10.2020. Please use Exists() instead. |
| 44 | + * @deprecated Will be removed by 10/2020. Use `Exists()` instead. |
43 | 45 | */ |
44 | 46 | static bool exists(const std::string& path); |
45 | 47 |
|
46 | 48 | /** |
47 | | - * @brief Checks if directory exists. |
| 49 | + * @brief Checks whether a directory exists. |
48 | 50 | * |
49 | | - * @param path Path of the directory. |
| 51 | + * @param path The path of the directory. |
50 | 52 | * |
51 | | - * @return true if directory exists, false otherwise. |
| 53 | + * @return True if the directory exists; false otherwise. |
52 | 54 | */ |
53 | 55 | static bool Exists(const std::string& path); |
54 | 56 |
|
55 | 57 | /** |
56 | | - * @brief Removes the directory, deleting all subfolders and files. |
| 58 | + * @brief Removes a directory and deletes all its subfolders and files. |
57 | 59 | * |
58 | | - * @param path Path of the directory. |
| 60 | + * @param path The path of the directory. |
59 | 61 | * |
60 | | - * @return true if operation is successfull, false otherwise. |
| 62 | + * @return True if the operation is successful; false otherwise. |
61 | 63 | * |
62 | | - * @deprecated Will be removed by 10.2020. Please use Remove() instead. |
| 64 | + * @deprecated Will be removed by 10/2020. Use `Remove()` instead. |
63 | 65 | */ |
64 | 66 | static bool remove(const std::string& path); |
65 | 67 |
|
66 | 68 | /** |
67 | | - * @brief Removes the directory, deleting all subfolders and files. |
| 69 | + * @brief Removes a directory and deletes all its subfolders and files. |
68 | 70 | * |
69 | | - * @param path Path of the directory. |
| 71 | + * @param path The path of the directory. |
70 | 72 | * |
71 | | - * @return \c true if operation is successfull, \c false otherwise. |
| 73 | + * @return True if the operation is successful; false otherwise. |
72 | 74 | */ |
73 | 75 | static bool Remove(const std::string& path); |
74 | 76 |
|
75 | 77 | /** |
76 | | - * @brief Creates the directory including all required directories on |
77 | | - * the path. |
| 78 | + * @brief Creates a directory and all required directories specified |
| 79 | + * in the path. |
78 | 80 | * |
79 | | - * @param path Path of the directory. |
| 81 | + * @param path The path of the directory. |
80 | 82 | * |
81 | | - * @return \c true if operation is successfull, \c false otherwise. |
| 83 | + * @return True if the operation is successful; false otherwise. |
82 | 84 | * |
83 | | - * @deprecated Will be removed by 10.2020. Please use Create() instead. |
| 85 | + * @deprecated Will be removed by 10/2020. Use `Create()` instead. |
84 | 86 | */ |
85 | 87 | static bool create(const std::string& path); |
86 | 88 |
|
87 | 89 | /** |
88 | | - * @brief Creates the directory including all required directories on |
89 | | - * the path. |
| 90 | + * @brief Creates a directory and all required directories specified |
| 91 | + * in the path. |
90 | 92 | * |
91 | | - * @param path Path of the directory. |
| 93 | + * @param path The path of the directory. |
92 | 94 | * |
93 | | - * @return \c true if operation is successfull, \c false otherwise. |
| 95 | + * @return True if the operation is successful; false otherwise. |
94 | 96 | */ |
95 | 97 | static bool Create(const std::string& path); |
96 | 98 |
|
97 | 99 | /** |
98 | | - * @brief Returns the platform-specific temporary path. |
| 100 | + * @brief Gets a platform-specific temporary path. |
99 | 101 | * |
100 | | - * @return The platform specific temporary directory path. |
| 102 | + * @return The platform-specific temporary path of the directory. |
101 | 103 | */ |
102 | 104 | static std::string TempDirectory(); |
103 | 105 |
|
104 | 106 | /** |
105 | | - * @brief Check whether the provided file exists. |
| 107 | + * @brief Checks whether the provided file exists. |
106 | 108 | * |
107 | | - * @param file_path Path to the file. |
| 109 | + * @param file_path The path of the file. |
108 | 110 | * |
109 | | - * @return \c true if any file with the given path exists, \c false otherwise. |
| 111 | + * @return True if the file with the given path exists; false otherwise. |
110 | 112 | */ |
111 | 113 | static bool FileExists(const std::string& file_path); |
112 | 114 |
|
113 | 115 | /** |
114 | | - * @brief Calculates size of the directory. Filter may be applied to exclude |
115 | | - * unnecessary files or directories from calculation. |
| 116 | + * @brief Calculates the size of a directory. |
116 | 117 | * |
117 | | - * @param path Path of the directory. |
118 | | - * @param filter_fn Filter function. |
| 118 | + * Use a filter to exclude |
| 119 | + * unnecessary files or directories from the calculation. |
119 | 120 | * |
120 | | - * @return Calculated size. |
| 121 | + * @param path The path of the directory. |
| 122 | + * @param filter_fn The filter function. |
| 123 | + * |
| 124 | + * @return The calculated size. |
121 | 125 | */ |
122 | 126 | static uint64_t Size(const std::string& path, FilterFunction filter_fn = {}); |
123 | 127 | }; |
|
0 commit comments