ZenLib
Dir.h
Go to the documentation of this file.
1/* Copyright (c) MediaArea.net SARL. All Rights Reserved.
2 *
3 * Use of this source code is governed by a zlib-style license that can
4 * be found in the License.txt file in the root of the source tree.
5 */
6
7//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
8//
9// Directories functions
10//
11//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
12
13//---------------------------------------------------------------------------
14#ifndef ZenLib_DirH
15#define ZenLib_DirH
16//---------------------------------------------------------------------------
17
18//---------------------------------------------------------------------------
19#include "ZenLib/ZtringList.h"
20//---------------------------------------------------------------------------
21
22namespace ZenLib
23{
24
25//***************************************************************************
26/// @brief Directory manipulation
27//***************************************************************************
28
29class Dir
30{
31public :
32 //---------------------------------------------------------------------------
33 /// @brief Options for Open method
35 {
36 Nothing = 0x00, ///<
37 Include_Files = 0x01, ///< Include files
38 Include_Dirs = 0x02, ///< Include directories
39 Include_Hidden = 0x04, ///< Include hidden files
40 Parse_SubDirs = 0x10 ///< Parse subdirectories
41 };
42
43 //Constructor/Destructor
44
45 //Open/close
47 //Names given by a call of GetAllFileNames() which are no longer needed: with UWP, the items listed are kept for opening them by their
48 //name (e.g. File::Open()) also when the WinRT functions don't give them by their path, until each listing which gave them is released
49 static void ReleaseFileNames(const ZtringList &File_Names);
50
51 //Helpers
52 static bool Exists(const Ztring &Dir_Name);
53 static bool Create(const Ztring &Dir_Name);
54};
55
56#if defined WINDOWS && !defined WINDOWS_UWP
57class GetAllFileNames_Private;
58class GetAllFileNames
59{
60public:
61 //Constructor/Destructor
62 GetAllFileNames();
63 ~GetAllFileNames();
64
65 //
66 void Start (const Ztring &Dir_Name, Dir::dirlist_t Options=(Dir::dirlist_t)(Dir::Include_Files|Dir::Parse_SubDirs));
67 bool Next (Ztring& Name);
68 void Close ();
69
70private:
71 GetAllFileNames_Private* p;
72};
73#endif //WINDOWS && !WINDOWS_UWP
74
75} //NameSpace
76
77#endif
Directory manipulation.
Definition Dir.h:30
static bool Create(const Ztring &Dir_Name)
static ZtringList GetAllFileNames(const Ztring &Dir_Name, dirlist_t Options=(dirlist_t)(Include_Files|Parse_SubDirs))
static bool Exists(const Ztring &Dir_Name)
dirlist_t
Options for Open method.
Definition Dir.h:35
@ Include_Hidden
Include hidden files.
Definition Dir.h:39
@ Include_Dirs
Include directories.
Definition Dir.h:38
@ Nothing
Definition Dir.h:36
@ Include_Files
Include files.
Definition Dir.h:37
@ Parse_SubDirs
Parse subdirectories.
Definition Dir.h:40
static void ReleaseFileNames(const ZtringList &File_Names)
Vector of strings manipulation (based on std::vector<std::(w)string>).
Definition ZtringList.h:31
String manipulation (based on std::(w)string).
Definition Ztring.h:50
Definition BitStream.h:24