CLucene - a full-featured, c++ search engine
API Documentation
00001 /*------------------------------------------------------------------------------ 00002 * Copyright (C) 2003-2006 Matt J. Weinstein 00003 * 00004 * Distributable under the terms of either the Apache License (Version 2.0) or 00005 * the GNU Lesser General Public License, as specified in the COPYING file. 00006 ------------------------------------------------------------------------------*/ 00007 #ifndef lucene_util_dirent_H 00008 #define lucene_util_dirent_H 00009 00010 #if defined(_LUCENE_PRAGMA_ONCE) 00011 # pragma once 00012 #endif 00013 00014 #if !defined(_CL_HAVE_DIRENT_H) && !defined(_CL_HAVE_SYS_NDIR_H) && !defined(_CL_HAVE_SYS_DIR_H) && !defined(_CL_HAVE_NDIR_H) 00015 00032 struct dirent 00033 { 00034 unsigned short d_namlen; /* Length of name in d_name. */ 00035 char *d_name; /* File name. */ 00036 }; 00037 00039 struct DIR 00040 { 00042 struct _finddata_t dd_dta; 00043 00044 /* dirent struct to return from dir (NOTE: this makes this thread 00045 * safe as long as only one thread uses a particular DIR struct at 00046 * a time) */ 00047 struct dirent dd_dir; 00048 00050 intptr_t dd_handle; 00051 00058 int32_t dd_stat; 00059 00061 char dd_name[CL_MAX_DIR]; 00062 00063 }; 00064 00065 #define DIRENT_SEARCH_SUFFIX "*" 00066 #define DIRENT_SLASH PATH_DELIMITERA 00067 00068 00073 DIR* opendir (const char* filespec); 00074 00079 struct dirent* readdir (DIR* dir); 00080 00084 int32_t closedir (DIR* dir); 00085 00086 00087 #elif defined (_CL_HAVE_DIRENT_H) 00088 # include <dirent.h> 00089 # define NAMLEN(dirent) strlen((dirent)->d_name) 00090 00091 #else 00092 # define dirent direct 00093 # define NAMLEN(dirent) (dirent)->d_namlen 00094 # if defined(_CL_HAVE_SYS_NDIR_H) 00095 # include <sys/ndir.h> 00096 # endif 00097 # if defined(_CL_HHAVE_SYS_DIR_H) 00098 # include <sys/dir.h> 00099 # endif 00100 # if defined(_CL_HHAVE_NDIR_H) 00101 # include <ndir.h> 00102 # endif 00103 00104 #endif //HAVE_DIRENT_H 00105 #endif