nx_server_plugin_sdk 1.0 Server Plugin SDK

dir_iterator.h
1 // Copyright 2018-present Network Optix, Inc. Licensed under MPL 2.0: www.mozilla.org/MPL/2.0/
2
3 #pragma once
4
5 #include <string>
6
7 #include <stdint.h>
8
9 namespace FsEntryType
10 {
11 enum Value
12 {
13 etRegularFile = 0x01,
14 etDirectory = 0x02,
15 etOther = 0x04
16 };
17
18 const char* toString( Value val );
19 }
20
21 class DirIteratorImpl;
22
24
36 class DirIterator
37 {
38 public:
43 DirIterator( const std::string& dirPath );
44 ~DirIterator();
45
47 void setRecursive( bool _recursive );
52 void setWildCardMask( const std::string& wildcardMask );
54
58 void setEntryTypeFilter( unsigned int entryTypeMask );
59
61
64 bool next();
65
67 std::string entryPath() const;
69 std::string entryFullPath() const;
70 FsEntryType::Value entryType() const;
71 uint64_t entrySize() const;
72
73 private:
74 DirIteratorImpl* m_impl;
75 };
DirIterator
Iterates through contents of specified directory.
Definition: dir_iterator.h:36
DirIteratorImpl
Definition: dir_iterator.cpp:44
DirIterator::setWildCardMask
void setWildCardMask(const std::string &wildcardMask)
Definition: dir_iterator.cpp:297
DirIterator::next
bool next()
Moves iterator to the next entry.
Definition: dir_iterator.cpp:307
DirIterator::setRecursive
void setRecursive(bool _recursive)
Enable/disable reading child directories. By default recursive mode is off.
Definition: dir_iterator.cpp:292
DirIterator::entryFullPath
std::string entryFullPath() const
Returns "search dir path" / "entry path".
Definition: dir_iterator.cpp:328
DirIterator::DirIterator
DirIterator(const std::string &dirPath)
Definition: dir_iterator.cpp:279
FsEntryType
Definition: dir_iterator.cpp:24
DirIterator::entryPath
std::string entryPath() const
Returns path to current entry (path relative to dirPath, specified at initialization) ...
Definition: dir_iterator.cpp:323
DirIterator::setEntryTypeFilter
void setEntryTypeFilter(unsigned int entryTypeMask)
Filter found entries by entry type.
Definition: dir_iterator.cpp:302