00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027 #ifndef __NEDIRECTORY_H
00028 #define __NEDIRECTORY_H
00029
00030
00037 #include "base.h"
00038 #include "hashtable.h"
00039
00040 #include <string>
00041 #include <vector>
00042
00043
00044 namespace NeoEngine
00045 {
00046
00047
00048
00049 class File;
00050
00051
00052
00053 class Directory;
00054
00055
00056
00057 #ifdef WIN32
00058 # ifdef _MSC_VER
00059 # pragma warning( disable : 4231 )
00060 # endif
00061 # ifndef __HAVE_VECTOR_NEDIRECTORY
00062 UDTVectorEXPIMP( class Directory* );
00063 # define __HAVE_VECTOR_NEDIRECTORY
00064 # endif
00065 #endif
00066
00067
00068
00082 class NEOENGINE_API FileTemplate
00083 {
00084 public:
00085
00092 virtual File *AllocateFile( const std::string &rstrName, Directory *pkParent );
00093 };
00094
00095
00096
00097 HashTableExport( FileTemplate );
00098
00099
00108 class NEOENGINE_API Directory
00109 {
00110 friend class Package;
00111
00112 protected:
00113
00115 HashTable< FileTemplate > *m_pkFiles;
00116
00118 std::vector< Directory* > m_vpkDirectories;
00119
00121 Directory *m_pkParent;
00122
00124 std::string m_strName;
00125
00127 std::string m_strFullPath;
00128
00130 bool m_bIsParsed;
00131
00133 bool m_bIsPackage;
00134
00135
00136 public:
00137
00145 Directory( const std::string &rstrName, Directory *pkParent, bool bParse = false, bool bRecurse = true );
00146
00150 virtual ~Directory();
00151
00157 bool Parse( bool bRecurse = true );
00158
00162 const std::string &GetName() const { return m_strName; }
00163
00167 const std::string &GetFullPath();
00168
00173 void AttachNode( Directory *pkDirectory );
00174
00179 void DetachNode( Directory *pkDirectory );
00180
00187 File *GetByName( const std::string &rstrName, bool bRecurse = true );
00188
00194 Directory *GetDirectoryByName( const std::string &rstrName );
00195
00200 void GetFiles( std::vector< File* > *pvpkFiles ) const;
00201
00206 const std::vector< Directory* > &GetDirectories() const { return m_vpkDirectories; }
00207
00211 Directory *GetParentDirectory();
00212
00217 bool IsPackage() const { return m_bIsPackage; }
00218
00222 bool IsParsed() const { return m_bIsParsed; }
00223
00228 void PrintHierarchy( int iDepth );
00229 };
00230
00231
00232 };
00233
00234
00235 #endif