EpcTools
An event based multi-threaded C++ development framework.
edir.h
Go to the documentation of this file.
1 /*
2 * Copyright (c) 2009-2019 Brian Waters
3 * Copyright (c) 2019 Sprint
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 */
17 
18 #ifndef __edir_h_included
19 #define __edir_h_included
20 
23 
24 #include <dirent.h>
25 
28 
30 DECLARE_ERROR_ADVANCED(EDirectoryError_GetFirstEntry);
31 DECLARE_ERROR_ADVANCED(EDirectoryError_OutOfSequence);
32 DECLARE_ERROR_ADVANCED(EDirectoryError_CurrentDirectory);
33 DECLARE_ERROR_ADVANCED2(EDirectoryError_GetNextEntry);
35 
38 
41 {
42 public:
44  EDirectory();
46  ~EDirectory();
47 
58  cpStr getFirstEntry(cpStr pDirectory, cpStr pFileMask);
67  cpStr getNextEntry();
68 
73  static Void getCurrentDirectory(EString& dir);
74 
75 private:
76  Void closeHandle();
77 
78  EString mDirectory;
79  EString mFileMask;
80  EString mFileName;
81 
82 #define PATH_SEPERATOR '/'
83  static pStr mTable;
84  static Void buildTable();
85  static Bool match(cpStr str, cpStr mask, Bool ignoreCase = False);
86  DIR* mHandle;
87 };
88 
89 #endif // #define __edir_h_included
EDirectory::~EDirectory
~EDirectory()
Class destructor.
Definition: edir.cpp:68
EDirectory
Retrieve file names in a directory.
Definition: edir.h:40
EDirectory::getNextEntry
cpStr getNextEntry()
Gets the next entry from the directory.
Definition: edir.cpp:116
DECLARE_ERROR_ADVANCED2
#define DECLARE_ERROR_ADVANCED2(__e__)
Declares exception class derived from EError with an Int as a constructor parameter and developer def...
Definition: eerror.h:67
EDirectory::getCurrentDirectory
static Void getCurrentDirectory(EString &dir)
Returns the current working directory.
Definition: edir.cpp:138
EDirectory::EDirectory
EDirectory()
Class constructor.
Definition: edir.cpp:63
False
#define False
False.
Definition: ebase.h:27
DECLARE_ERROR_ADVANCED
#define DECLARE_ERROR_ADVANCED(__e__)
Declares exception class derived from EError with no constructor parameters and developer defined con...
Definition: eerror.h:59
EString
String class.
Definition: estring.h:30
EDirectory::getFirstEntry
cpStr getFirstEntry(cpStr pDirectory, cpStr pFileMask)
Gets the first entry from the directory.
Definition: edir.cpp:73