version 1.23, 2005/02/13 22:32:06
|
version 1.33, 2007/06/06 19:54:34
|
|
|
//%2005//////////////////////////////////////////////////////////////////////// |
//%2006//////////////////////////////////////////////////////////////////////// |
// | // |
// Copyright (c) 2000, 2001, 2002 BMC Software; Hewlett-Packard Development | // Copyright (c) 2000, 2001, 2002 BMC Software; Hewlett-Packard Development |
// Company, L.P.; IBM Corp.; The Open Group; Tivoli Systems. | // Company, L.P.; IBM Corp.; The Open Group; Tivoli Systems. |
|
|
// IBM Corp.; EMC Corporation; VERITAS Software Corporation; The Open Group. | // IBM Corp.; EMC Corporation; VERITAS Software Corporation; The Open Group. |
// Copyright (c) 2005 Hewlett-Packard Development Company, L.P.; IBM Corp.; | // Copyright (c) 2005 Hewlett-Packard Development Company, L.P.; IBM Corp.; |
// EMC Corporation; VERITAS Software Corporation; The Open Group. | // EMC Corporation; VERITAS Software Corporation; The Open Group. |
|
// Copyright (c) 2006 Hewlett-Packard Development Company, L.P.; IBM Corp.; |
|
// EMC Corporation; Symantec Corporation; The Open Group. |
// | // |
// Permission is hereby granted, free of charge, to any person obtaining a copy | // Permission is hereby granted, free of charge, to any person obtaining a copy |
// of this software and associated documentation files (the "Software"), to | // of this software and associated documentation files (the "Software"), to |
|
|
// | // |
//============================================================================== | //============================================================================== |
// | // |
// Author: Mike Brasher (mbrasher@bmc.com) |
|
// |
|
// Modified By: Amit K Arora, IBM (amita@in.ibm.com) |
|
// |
|
//%///////////////////////////////////////////////////////////////////////////// | //%///////////////////////////////////////////////////////////////////////////// |
| |
#ifndef Pegasus_Dir_h | #ifndef Pegasus_Dir_h |
|
|
#include <Pegasus/Common/Linkage.h> | #include <Pegasus/Common/Linkage.h> |
#include <Pegasus/Common/AutoPtr.h> | #include <Pegasus/Common/AutoPtr.h> |
| |
PEGASUS_NAMESPACE_BEGIN |
#if defined(PEGASUS_OS_SOLARIS) |
|
# include <sys/param.h> |
|
#endif |
| |
#if defined(PEGASUS_OS_TYPE_WINDOWS) | #if defined(PEGASUS_OS_TYPE_WINDOWS) |
#include <io.h> | #include <io.h> |
|
#else // if defined(PEGASUS_OS_TYPE_UNIX) || defined (PEGASUS_OS_VMS) |
|
# include <dirent.h> |
|
#endif |
|
|
|
PEGASUS_NAMESPACE_BEGIN |
|
|
|
#if defined(PEGASUS_OS_TYPE_WINDOWS) |
|
|
typedef struct | typedef struct |
{ | { |
|
# if _MSC_VER < 1300 |
long file; | long file; |
|
# else |
|
intptr_t file; |
|
# endif |
struct _finddata_t findData; | struct _finddata_t findData; |
} DirRep; | } DirRep; |
#elif defined(PEGASUS_OS_TYPE_UNIX) || defined (PEGASUS_OS_VMS) |
|
#if defined(PEGASUS_OS_SOLARIS) |
|
#include <sys/param.h> |
|
#endif /* if defined(PEGASUS_OS_SOLARIS) */ |
|
| |
#include <dirent.h> |
#else // if defined(PEGASUS_OS_TYPE_UNIX) || defined (PEGASUS_OS_VMS) |
|
|
#ifndef PEGASUS_OS_VMS |
|
#define PEGASUS_HAS_READDIR_R |
|
#endif /* ifndef PEGASUS_OS_VMS */ |
|
| |
struct DirRep | struct DirRep |
{ | { |
DIR* dir; | DIR* dir; |
#ifdef PEGASUS_OS_OS400 |
|
struct dirent_lg* entry; |
|
#else /* ifdef PEGASUS_OS_OS400 */ |
|
struct dirent* entry; | struct dirent* entry; |
#endif /* ifdef PEGASUS_OS_OS400 */ |
|
#ifdef PEGASUS_HAS_READDIR_R |
|
#ifdef PEGASUS_OS_OS400 |
|
struct dirent_lg buffer; |
|
#else /* ifdef PEGASUS_OS_OS400 */ |
|
#ifdef PEGASUS_OS_SOLARIS | #ifdef PEGASUS_OS_SOLARIS |
private: | private: |
char buf[sizeof(dirent) + MAXNAMELEN]; | char buf[sizeof(dirent) + MAXNAMELEN]; |
|
|
#else /* ifdef PEGASUS_OS_SOLARIS */ | #else /* ifdef PEGASUS_OS_SOLARIS */ |
struct dirent buffer; | struct dirent buffer; |
#endif /* ifdef PEGASUS_OS_SOLARIS */ | #endif /* ifdef PEGASUS_OS_SOLARIS */ |
#endif /* ifdef PEGASUS_OS_OS400 */ |
|
#endif /* ifdef PEGASUS_HAS_READDIR_R */ |
|
}; | }; |
#endif /* elif defined(PEGASUS_OS_TYPE_UNIX) || defined (PEGASUS_OS_VMS) */ |
#endif |
| |
/** The Dir class provides a platform independent way of iterating the | /** The Dir class provides a platform independent way of iterating the |
files in a directory. | files in a directory. |
|
|
/** Return true if there are more file names to iterator. */ | /** Return true if there are more file names to iterator. */ |
Boolean more() const { return _more; } | Boolean more() const { return _more; } |
| |
#if defined(PEGASUS_PLATFORM_DARWIN_PPC_GNU) |
|
/** Returns the file inode number. */ |
|
const Uint32 getInode() const; |
|
#endif |
|
| |
/** Returns the current file name. */ | /** Returns the current file name. */ |
const char* getName() const; | const char* getName() const; |