Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | Related Pages

directory.h

Go to the documentation of this file.
00001 /***************************************************************************
00002                      directory.h  -  Directory abstraction
00003                              -------------------
00004     begin                : Wed Sep 18 2002
00005     copyright            : (C) 2002 by Reality Rift Studios
00006     email                : mattias@realityrift.com
00007  ***************************************************************************
00008 
00009  The contents of this file are subject to the Mozilla Public License Version
00010  1.1 (the "License"); you may not use this file except in compliance with
00011  the License. You may obtain a copy of the License at 
00012  http://www.mozilla.org/MPL/
00013 
00014  Software distributed under the License is distributed on an "AS IS" basis,
00015  WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
00016  for the specific language governing rights and limitations under the
00017  License.
00018 
00019  The Original Code is the NeoEngine, directory.h
00020 
00021  The Initial Developer of the Original Code is Mattias Jansson.
00022  Portions created by Mattias Jansson are Copyright (C) 2002
00023  Reality Rift Studios. All Rights Reserved.
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 // External classes
00049 class File;
00050 
00051 
00052 // Forward declarations
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 }; // namespace NeoEngine
00233 
00234 
00235 #endif

Generated on Wed Jan 21 14:21:06 2004 for NeoEngine by doxygen 1.3.5