version 1.7, 2001/07/10 06:43:25
|
version 1.23, 2005/02/13 22:32:06
|
|
|
//%///////////////////////////////////////////////////////////////////////////// |
//%2005//////////////////////////////////////////////////////////////////////// |
// | // |
// Copyright (c) 2000, 2001 The Open group, BMC Software, Tivoli Systems, IBM |
// Copyright (c) 2000, 2001, 2002 BMC Software; Hewlett-Packard Development |
|
// Company, L.P.; IBM Corp.; The Open Group; Tivoli Systems. |
|
// Copyright (c) 2003 BMC Software; Hewlett-Packard Development Company, L.P.; |
|
// 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. |
// | // |
// 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) | // Author: Mike Brasher (mbrasher@bmc.com) |
// | // |
// Modified By: |
// Modified By: Amit K Arora, IBM (amita@in.ibm.com) |
// | // |
//%///////////////////////////////////////////////////////////////////////////// | //%///////////////////////////////////////////////////////////////////////////// |
| |
|
|
| |
#include <Pegasus/Common/Config.h> | #include <Pegasus/Common/Config.h> |
#include <Pegasus/Common/String.h> | #include <Pegasus/Common/String.h> |
#include <Pegasus/Common/Exception.h> |
#include <Pegasus/Common/InternalException.h> |
|
#include <Pegasus/Common/Linkage.h> |
|
#include <Pegasus/Common/AutoPtr.h> |
| |
PEGASUS_NAMESPACE_BEGIN | PEGASUS_NAMESPACE_BEGIN |
| |
struct DirRep; |
#if defined(PEGASUS_OS_TYPE_WINDOWS) |
|
#include <io.h> |
|
typedef struct |
|
{ |
|
long file; |
|
struct _finddata_t findData; |
|
} 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> |
|
|
|
#ifndef PEGASUS_OS_VMS |
|
#define PEGASUS_HAS_READDIR_R |
|
#endif /* ifndef PEGASUS_OS_VMS */ |
|
|
|
struct DirRep |
|
{ |
|
DIR* dir; |
|
#ifdef PEGASUS_OS_OS400 |
|
struct dirent_lg* entry; |
|
#else /* ifdef PEGASUS_OS_OS400 */ |
|
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 |
|
private: |
|
char buf[sizeof(dirent) + MAXNAMELEN]; |
|
public: |
|
struct dirent &buffer; |
|
inline DirRep() |
|
: buffer(*reinterpret_cast<struct dirent *>(buf)) |
|
{ } |
|
#else /* ifdef PEGASUS_OS_SOLARIS */ |
|
struct dirent buffer; |
|
#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) */ |
| |
/** 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; |
| |
|
|
| |
Boolean _more; | Boolean _more; |
Boolean _isValid; | Boolean _isValid; |
DirRep* _rep; |
String _path; |
|
DirRep _dirRep; |
}; | }; |
| |
PEGASUS_NAMESPACE_END | PEGASUS_NAMESPACE_END |