-
Notifications
You must be signed in to change notification settings - Fork 57
Expand file tree
/
Copy pathFilesystem.hh
More file actions
93 lines (76 loc) · 2.92 KB
/
Filesystem.hh
File metadata and controls
93 lines (76 loc) · 2.92 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
/*
* Copyright 2018 Open Source Robotics Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
#ifndef GZ_MSGS_FILESYSTEM_HH_
#define GZ_MSGS_FILESYSTEM_HH_
#include <memory>
#include <string>
#include <gz/msgs/Export.hh>
#include <gz/utils/SuppressWarning.hh>
namespace ignition
{
namespace msgs
{
/// \brief Options for how to handle errors that occur in functions that
/// manipulate the filesystem.
enum FilesystemWarningOp
{
/// \brief Errors that occur during filesystem manipulation should be
/// logged as warnings using ignwarn. (Recommended)
FSWO_LOG_WARNINGS = 0,
/// \brief Errors that occur during filesystem manipulation should not be
/// logged. The user will be responsible for checking the system's error
/// flags.
FSWO_SUPPRESS_WARNINGS
};
// /// \internal
class DirIterPrivate;
/// \class DirIter Filesystem.hh
/// \brief A class for iterating over all items in a directory.
class IGNITION_MSGS_VISIBLE DirIter
{
/// \brief Constructor.
/// \param[in] _in Directory to iterate over.
public: explicit DirIter(const std::string &_in);
/// \brief Constructor for end element.
public: DirIter();
/// \brief Dereference operator; returns current directory record.
/// \return A string representing the entire path of the directory record.
public: std::string operator*() const;
/// \brief Pre-increment operator; moves to next directory record.
/// \return This iterator.
public: const DirIter& operator++();
/// \brief Comparison operator to see if this iterator is at the
/// same point as another iterator.
/// \param[in] _other The other iterator to compare against.
/// \return true if the iterators are equal, false otherwise.
public: bool operator!=(const DirIter &_other) const;
/// \brief Destructor
public: ~DirIter();
/// \brief Move to the next directory record, skipping . and .. records.
private: void Next();
/// \brief Set the internal variable to the empty string.
private: void SetInternalEmpty();
/// \brief Close an open directory handle.
private: void CloseHandle();
IGN_UTILS_WARN_IGNORE__DLL_INTERFACE_MISSING
/// \brief Private data.
private: std::unique_ptr<DirIterPrivate> dataPtr;
IGN_UTILS_WARN_RESUME__DLL_INTERFACE_MISSING
};
}
}
#endif