Main Page   Modules   Class Hierarchy   Data Structures   File List   Data Fields   Globals   Related Pages  

oscl_file_find.h

Go to the documentation of this file.
00001 // -*- c++ -*-
00002 // = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
00003 
00004 //                     O S C L _ F I L E  _ FIND
00005 
00006 // = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
00007 
00019 #ifndef OSCL_FILE_FIND_H_INCLUDED
00020 #define OSCL_FILE_FIND_H_INCLUDED
00021 
00022 #ifndef OSCLCONFIG_IO_H_INCLUDED
00023 #include "osclconfig_io.h"
00024 #endif
00025 
00026 #ifndef OSCL_BASE_H_INCLUDED
00027 #include "oscl_base.h"
00028 #endif
00029 
00030 #ifndef OSCL_MEM_H_INCLUDED
00031 #include "oscl_mem.h"
00032 #endif
00033 
00034 #ifndef OSCL_VECTOR_H_INCLUDED
00035 #include "oscl_vector.h"
00036 #endif
00037 
00038 #ifndef OSCL_STRING_CONTAINERS_H_INCLUDED
00039 #include "oscl_string_containers.h"
00040 #endif
00041 
00042 #ifndef OSCL_FILE_TYPES_H_INCLUDED
00043 #include "oscl_file_types.h"
00044 #endif
00045 
00050 class Oscl_FileFind
00051 {
00052     public:
00053 
00064         OSCL_IMPORT_REF const char *FindFirst(const char *directory, const char *pattern, char *buf, uint32 buflen);
00075         OSCL_IMPORT_REF const oscl_wchar *FindFirst(const oscl_wchar *directory, const oscl_wchar *pattern, oscl_wchar *buf, uint32 buflen);
00084         OSCL_IMPORT_REF char *FindNext(char *buf, uint32 buflen);
00093         OSCL_IMPORT_REF oscl_wchar *FindNext(oscl_wchar *buf, uint32 buflen);
00098         OSCL_IMPORT_REF void Close();
00099 
00100         typedef enum
00101         {
00102             E_OK = 0,
00103             E_INVALID_STATE,
00104             E_INVALID_ARG,
00105             E_PATH_TOO_LONG,
00106             E_PATH_NOT_FOUND,
00107             E_NO_MATCH,
00108             E_BUFFER_TOO_SMALL,
00109             E_NOT_IMPLEMENTED,
00110             E_MEMORY_ERROR,
00111             E_OTHER
00112         } error_type;
00113 
00114         typedef enum
00115         {
00116             FILE_TYPE = 0, /* file */
00117             DIR_TYPE,      /* directory */
00118             INVALID_TYPE   /* no element available */
00119         } element_type;
00120 
00125         OSCL_IMPORT_REF element_type GetElementType();
00126 
00127 
00132         OSCL_IMPORT_REF error_type GetLastError();
00133 
00138         OSCL_IMPORT_REF Oscl_FileFind();
00144         OSCL_IMPORT_REF ~Oscl_FileFind();
00145 
00146     private:
00147 
00148         typedef char chartype;
00149         bool setpathanddelimiter(const chartype* directory);
00150 
00151 #if   (OSCL_HAS_GLOB)
00152         glob_t hFind;
00153 #else
00154         Oscl_Vector<OSCL_HeapString<OsclMemAllocator>, OsclMemAllocator> iDirEntVec;
00155 #endif
00156         uint32 count;
00157         bool foundfirst;
00158         error_type lastError;
00159         element_type type;
00160         bool appendPathDelimiter;
00161         chartype* pathname;
00162         const chartype* delimeter;
00163         const chartype* nullchar;
00164 };
00165 
00166 
00167 #endif // OSCL_FILE_FIND_H_INCLUDED
00168 

OSCL API
Posting Version: CORE_8.000.1.1_RC4