Main Page | Alphabetical List | Compound List | File List | Compound Members | File Members

dirtree-common.h File Reference

#include "vfile.h"

Go to the source code of this file.

Compounds

struct  DirTree_Header

Defines

#define DIRTREE_LIST_TERMINATED   0xffffffff
#define DIRTREE_LIST_NOTTERMINATED   0
#define MAKEFOURCC(ch0, ch1, ch2, ch3)

Typedefs

typedef DirTree_Header DirTree_Header

Functions

char * DuplicateString (const char *String)
const char * GetNextDir (const char *Path, char *Buff)
geBoolean MatchPattern (const char *Source, const char *Pattern)
geBoolean PathHasDir (const char *Path)


Define Documentation

#define DIRTREE_LIST_NOTTERMINATED   0
 

Definition at line 36 of file dirtree-common.h.

Referenced by WriteTree().

#define DIRTREE_LIST_TERMINATED   0xffffffff
 

Definition at line 35 of file dirtree-common.h.

Referenced by ReadTree(), and WriteTree().

#define MAKEFOURCC ch0,
ch1,
ch2,
ch3   ) 
 

Value:

((unsigned long)(unsigned char)(ch0) | ((unsigned long)(unsigned char)(ch1) << 8) |   \
                ((unsigned long)(unsigned char)(ch2) << 16) | ((unsigned long)(unsigned char)(ch3) << 24 ))

Definition at line 39 of file dirtree-common.h.


Typedef Documentation

typedef struct DirTree_Header DirTree_Header
 


Function Documentation

char* DuplicateString const char *  String  ) 
 

Definition at line 29 of file dirtree-common.c.

References geRam_Allocate.

Referenced by DirTree_AddFile(), DirTree_Create(), and DirTree_CreateFinder().

00030 {
00031         int             Length;
00032         char *  NewString;
00033 
00034         Length = strlen(String) + 1;
00035         NewString = geRam_Allocate(Length);
00036         if      (NewString)
00037                 memcpy(NewString, String, Length);
00038         return NewString;
00039 }

const char* GetNextDir const char *  Path,
char *  Buff
 

Definition at line 41 of file dirtree-common.c.

Referenced by DirTree_FindExact(), and DirTree_FindPartial().

00042 {
00043         while   (*Path && *Path != '\\')
00044                 *Buff++ = *Path++;
00045         *Buff = '\0';
00046 
00047         if      (*Path == '\\')
00048                 Path++;
00049 
00050         return Path;
00051 }

geBoolean MatchPattern const char *  Source,
const char *  Pattern
 

Definition at line 53 of file dirtree-common.c.

References GE_FALSE, GE_TRUE, geBoolean, and Source.

Referenced by DirTree_FinderGetNextFile().

00054 {
00055         assert(Source);
00056         assert(Pattern);
00057 
00058         switch  (*Pattern)
00059         {
00060         case    '\0':
00061                 if      (*Source)
00062                         return GE_FALSE;
00063                 break;
00064 
00065         case    '*':
00066                 if      (*(Pattern + 1) != '\0')
00067                 {
00068                         Pattern++;
00069                         while   (*Source)
00070                         {
00071                                 if      (MatchPattern(Source, Pattern) == GE_TRUE)
00072                                         return GE_TRUE;
00073                                 Source++;
00074                         }
00075                         return GE_FALSE;
00076                 }
00077                 break;
00078 
00079         case    '?':
00080                 return MatchPattern(Source + 1, Pattern + 1);
00081 
00082         default:
00083                 if      (*Source == *Pattern)
00084                         return MatchPattern(Source + 1, Pattern + 1);
00085                 else
00086                         return GE_FALSE;
00087         }
00088 
00089         return GE_TRUE;
00090 }

geBoolean PathHasDir const char *  Path  ) 
 

Definition at line 92 of file dirtree-common.c.

References GE_FALSE, GE_TRUE, and geBoolean.

Referenced by DirTree_AddFile().

00093 {
00094         if      (strchr(Path, '\\'))
00095                 return GE_TRUE;
00096 
00097         return GE_FALSE;
00098 }


Generated on Tue Sep 30 12:37:24 2003 for GTestAndEngine by doxygen 1.3.2