dir.h revision a4d7fc6f54717c342281099fe14f5666be9b7921
/* $Id$ */
/** @file
* innotek Portable Runtime - Internal Header for RTDir.
*/
/*
* Copyright (C) 2006-2007 innotek GmbH
*
* This file is part of VirtualBox Open Source Edition (OSE), as
* available from http://www.virtualbox.org. This file is free software;
* General Public License as published by the Free Software Foundation,
* in version 2 as it comes in the "COPYING" file of the VirtualBox OSE
* distribution. VirtualBox OSE is distributed in the hope that it will
* be useful, but WITHOUT ANY WARRANTY of any kind.
*
* If you received this file as part of a commercial VirtualBox
* distribution, then only the terms of your commercial VirtualBox
* license agreement apply instead of the previous paragraph.
*/
#ifndef __internal_dir_h__
#define __internal_dir_h__
/**
* Filter a the filename in the against a filter.
*
* @returns true if the name matches the filter.
* @returns false if the name doesn't match filter.
* @param pDir The directory handle.
* @param pszName The path to match to the filter.
*/
/** Pointer to a filter function. */
typedef FNRTDIRFILTER *PFNRTDIRFILTER;
/**
* Open directory.
*/
typedef struct RTDIR
{
/** Magic value, RTDIR_MAGIC. */
/** The type of filter that's to be applied to the directory listing. */
/** The filter function. */
/** The filter Code Point string.
* This is allocated in the same block as this structure. */
/** The number of Code Points in the filter string. */
/** The filter string.
* This is allocated in the same block as this structure, thus the const. */
const char *pszFilter;
/** The length of the filter string. */
unsigned cchFilter;
/** Normalized path to the directory including a trailing slash.
* We keep this around so we can query more information if required (posix).
* This is allocated in the same block as this structure, thus the const. */
const char *pszPath;
/** The length of the path. */
unsigned cchPath;
/** Set to indicate that the Data member contains unread data. */
bool fDataUnread;
#ifndef RT_DONT_CONVERT_FILENAMES
/** Pointer to the converted filename.
* This can be NULL. */
char *pszName;
/** The length of the converted filename. */
unsigned cchName;
#endif
#ifdef RT_OS_WINDOWS
/** Handle to the opened directory search. */
/** Find data buffer.
* fDataUnread indicates valid data. */
# ifdef RT_DONT_CONVERT_FILENAMES
# else
# endif
#else /* 'POSIX': */
/** What opendir() returned. */
/** Find data buffer.
* fDataUnread indicates valid data. */
#endif
} RTDIR;
/**
* Validates a directory handle.
* @returns true if valid.
* @returns false if valid after having bitched about it first.
*/
{
return true;
}
/**
* Initialize the OS specific part of the handle and open the directory.
* Called by rtDirOpenCommon().
*
* @returns IPRT status code.
* @param pDir The directory to open. The pszPath member contains the
* path to the directory.
* @param pszPathBuf Pointer to a RTPATH_MAX sized buffer containing pszPath.
* Find-first style systems can use this to setup the
* wildcard expression.
*/
#endif