version 1.16, 2004/10/06 15:25:07
|
version 1.33.6.1, 2007/09/12 07:18:43
|
|
|
//%2003//////////////////////////////////////////////////////////////////////// |
//%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. |
// Copyright (c) 2003 BMC Software; Hewlett-Packard Development Company, L. P.; | // Copyright (c) 2003 BMC Software; Hewlett-Packard Development Company, L. P.; |
// IBM Corp.; EMC Corporation, The Open Group. | // IBM Corp.; EMC Corporation, The Open Group. |
|
// Copyright (c) 2004 BMC Software; Hewlett-Packard Development Company, L.P.; |
|
// IBM Corp.; EMC Corporation; VERITAS Software Corporation; The Open Group. |
|
// Copyright (c) 2005 Hewlett-Packard Development Company, L.P.; IBM Corp.; |
|
// 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) |
|
#ifdef PEGASUS_OS_SOLARIS |
|
#include <sys/param.h> |
|
#endif |
|
#include <dirent.h> |
|
| |
// ATTN: If a platform is found that does not have the readdir_r interface, |
#else // if defined(PEGASUS_OS_TYPE_UNIX) || defined (PEGASUS_OS_VMS) |
// this next line should be conditionally compiled out for that platform. |
|
// Otherwise, the old readdir code can be removed. |
|
#define PEGASUS_HAS_READDIR_R |
|
| |
typedef struct DirRep |
struct DirRep |
{ | { |
DIR* dir; | DIR* dir; |
#ifdef PEGASUS_OS_OS400 |
|
struct dirent_lg* entry; |
|
#else |
|
struct dirent* entry; | struct dirent* entry; |
#endif |
|
#ifdef PEGASUS_HAS_READDIR_R |
# if defined(PEGASUS_OS_SOLARIS) |
#ifdef PEGASUS_OS_OS400 |
|
struct dirent_lg buffer; |
|
#else |
|
#ifdef PEGASUS_OS_SOLARIS |
|
private: | private: |
char buf[sizeof(dirent) + MAXNAMELEN]; | char buf[sizeof(dirent) + MAXNAMELEN]; |
public: | public: |
|
|
inline DirRep() | inline DirRep() |
: buffer(*reinterpret_cast<struct dirent *>(buf)) | : buffer(*reinterpret_cast<struct dirent *>(buf)) |
{ } | { } |
#else |
# else /* ifdef PEGASUS_OS_SOLARIS */ |
|
union |
|
{ |
struct dirent buffer; | struct dirent buffer; |
#endif |
char filler[4096]; |
#endif |
}; |
#endif |
# endif /* ifdef PEGASUS_OS_SOLARIS */ |
}; | }; |
#endif | #endif |
| |
|
|
/** 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; } |
| |
|
|
/** Returns the current file name. */ | /** Returns the current file name. */ |
const char* getName() const; | const char* getName() const; |
| |