Main Page Modules Class Hierarchy Data Structures File List Data Fields Globals Related Pages

# Oscl_FileFind Class Reference
[OSCL IO]

`#include <oscl_file_find.h>`

## Public Types
enum | error_type { E_OK = 0, E_INVALID_STATE, E_INVALID_ARG, E_PATH_TOO_LONG, E_PATH_NOT_FOUND, E_NO_MATCH, E_BUFFER_TOO_SMALL, E_NOT_IMPLEMENTED, E_MEMORY_ERROR, E_OTHER }
enum | element_type { FILE_TYPE = 0, DIR_TYPE, INVALID_TYPE }
## Public Methods
OSCL_IMPORT_REF const char * | FindFirst (const char *directory, const char *pattern, char *buf, uint32 buflen)
OSCL_IMPORT_REF const oscl_wchar * | FindFirst (const oscl_wchar *directory, const oscl_wchar *pattern, oscl_wchar *buf, uint32 buflen)
OSCL_IMPORT_REF char * | FindNext (char *buf, uint32 buflen)
OSCL_IMPORT_REF oscl_wchar * | FindNext (oscl_wchar *buf, uint32 buflen)
OSCL_IMPORT_REF void | Close ()
OSCL_IMPORT_REF element_type | GetElementType ()
OSCL_IMPORT_REF error_type | GetLastError ()
OSCL_IMPORT_REF | Oscl_FileFind ()
OSCL_IMPORT_REF | ~Oscl_FileFind ()

## Detailed Description

Oscl_FileFind class defines the generic way of finding filesystem elements that match a pattern within a directory

## Member Enumeration Documentation

enum Oscl_FileFind::element_type

  | Enumeration values:
  FILE_TYPE |
  DIR_TYPE |
  INVALID_TYPE |

enum Oscl_FileFind::error_type

  | Enumeration values:
  E_OK |
  E_INVALID_STATE |
  E_INVALID_ARG |
  E_PATH_TOO_LONG |
  E_PATH_NOT_FOUND |
  E_NO_MATCH |
  E_BUFFER_TOO_SMALL |
  E_NOT_IMPLEMENTED |
  E_MEMORY_ERROR |
  E_OTHER |

## Constructor & Destructor Documentation

OSCL_IMPORT_REF Oscl_FileFind::Oscl_FileFind | ( |  | ) |

| constructor. Returns: none

OSCL_IMPORT_REF Oscl_FileFind::~Oscl_FileFind | ( |  | ) |

| destructor. will deallocate open handles if necessary Returns: none

## Member Function Documentation

OSCL_IMPORT_REF void Oscl_FileFind::Close | ( |  | ) |

| closes the handle to directory. Returns: none

OSCL_IMPORT_REF const oscl_wchar* Oscl_FileFind::FindFirst | ( | const oscl_wchar * | directory,
|  | const oscl_wchar * | pattern,
|  | oscl_wchar * | buf,
|  | uint32 | buflen
| ) |

  | Opens a directory for reading. Parameters:
  directory | directory to search (utf16).
  pattern | wildcard pattern filter (utf16). passing NULL, results in a universal match.
  buf | buffer for returned pathname (utf16).
  buflen | size in wide characters of buf. If buf is not large enough to hold the returned string, NULL is returned, and GetLastError is set to E_BUFFER_TOO_SMALL.
Returns: returns a pointer to buffer supplied, which contains the pathname of the first found element, or NULL otherwise. On a NULL return value, GetLastError() returns a more detailed error.

OSCL_IMPORT_REF const char* Oscl_FileFind::FindFirst | ( | const char * | directory,
|  | const char * | pattern,
|  | char * | buf,
|  | uint32 | buflen
| ) |

  | Finds first element matching the pattern. Parameters:
  directory | directory to search (utf8).
  pattern | wildcard pattern filter (utf8). passing NULL, results in a universal match.
  buf | buffer for returned pathname (utf8).
  buflen | size in wide characters of buf. If buf is not large enough to hold the returned string, NULL is returned, and GetLastError is set to E_BUFFER_TOO_SMALL.
Returns: returns a pointer to buffer supplied, which contains the pathname of the first found element, or NULL otherwise.On a NULL return value, GetLastError() returns a more detailed error.

OSCL_IMPORT_REF oscl_wchar* Oscl_FileFind::FindNext | ( | oscl_wchar * | buf,
|  | uint32 | buflen
| ) |

  | Reads the next element in a directory. Note: the pointer returned by this function is not persistent and should be stored. Its scope is limited to the lifetime of the class. Parameters:
  buf | buffer to hold directory name(utf16)
  buflen | size in wide characters of buf. If buf is not large enough to hold the returned string, NULL is returned, and GetLastError is set to E_BUFFER_TOO_SMALL.
Returns: returns a pointer to buffer supplied, which contains the pathname of the next found element, or NULL otherwise. On a NULL return value, GetLastError() returns a more detailed error.

OSCL_IMPORT_REF char* Oscl_FileFind::FindNext | ( | char * | buf,
|  | uint32 | buflen
| ) |

  | Reads the next element in the directory. Note: the pointer returned by this function is not persistent and should be stored. Its scope is limited to the lifetime of the class. Parameters:
  buf | buffer to hold directory name(utf8)
  buflen | size in wide characters of buf. If buf is not large enough to hold the returned string, NULL is returned, and GetLastError is set to E_BUFFER_TOO_SMALL.
Returns: returns a pointer to buffer supplied, which contains the pathname of the next found element, or NULL otherwise. On a NULL return value, GetLastError() returns a more detailed error.

OSCL_IMPORT_REF element_type Oscl_FileFind::GetElementType | ( |  | ) |

| Returns the element type for the last element returned Returns: see enumeration above for more info.

OSCL_IMPORT_REF error_type Oscl_FileFind::GetLastError | ( |  | ) |

| Returns the error code for the last operation. Returns: see enumeration above for more info.

The documentation for this class was generated from the following file:

- oscl_file_find.h