File Class Reference

An abstract representation of file and directory path names. More...

## Public Member Functions

| File ()
| Construct a new instance. More...
| File (const char *path)
| Construct a new instance. More...
| File (const std::string &path)
| Construct a new instance. More...
| File (const wchar_t *path)
| Construct a new instance. More...
| File (const std::wstring &path)
| Construct a new instance. More...
| File (const UniChar *path)
| Construct a new instance. More...
| File (const std::basic_string< UniChar > &path)
| Construct a new instance. More...
| File (const CFStringRef &path)
| Construct a new instance. More...
| File (const File &src)
| Copy constructor. More...
File & | operator= (const File &src)
| Assignment operator. More...
| ~File ()
| Destructor. More...
bool | exists (log4cxx::helpers::Pool &p) const
| Determines if file exists. More...
size_t | length (log4cxx::helpers::Pool &p) const
| Determines length of file. More...
log4cxx_time_t | lastModified (log4cxx::helpers::Pool &p) const
| Determines last modification date. More...
LogString | getName () const
| Get final portion of file path. More...
LogString | getPath () const
| Get file path. More...
File & | setPath (const LogString &)
| Set file path. More...
log4cxx_status_t | open (apr_file_t **file, int flags, int perm, log4cxx::helpers::Pool &p) const
| Open file. More...
std::vector< LogString > | list (log4cxx::helpers::Pool &p) const
| List files if current file is a directory. More...
bool | deleteFile (log4cxx::helpers::Pool &p) const
| Delete file. More...
bool | renameTo (const File &dest, log4cxx::helpers::Pool &p) const
| Rename file. More...
LogString | getParent (log4cxx::helpers::Pool &p) const
| Get path of parent directory. More...
bool | mkdirs (log4cxx::helpers::Pool &p) const
| Make directories recursively. More...

## Detailed Description

An abstract representation of file and directory path names.

## Constructor & Destructor Documentation

## File() [1/9]

File | ( |  | ) |

Construct a new instance.

## File() [2/9]

File | ( | const char * | path | ) |

Construct a new instance.

Use setPath to specify path using a LogString.

Parameters

  path | file path in local encoding.

## File() [3/9]

File | ( | const std::string & | path | ) |

Construct a new instance.

Use setPath to specify path using a LogString.

Parameters

  path | file path in current encoding.

## File() [4/9]

File | ( | const wchar_t * | path | ) |

Construct a new instance.

Use setPath to specify path using a LogString.

Parameters

  path | file path.

## File() [5/9]

File | ( | const std::wstring & | path | ) |

Construct a new instance.

Use setPath to specify path using a LogString.

Parameters

  path | file path.

## File() [6/9]

File | ( | const UniChar * | path | ) |

Construct a new instance.

Use setPath to specify path using a LogString.

Parameters

  path | file path.

## File() [7/9]

File | ( | const std::basic_string< UniChar > & | path | ) |

Construct a new instance.

Use setPath to specify path using a LogString.

Parameters

  path | file path.

## File() [8/9]

File | ( | const CFStringRef & | path | ) |

Construct a new instance.

Use setPath to specify path using a LogString.

Parameters

  path | file path.

## File() [9/9]

File | ( | const File & | src | ) |

Copy constructor.

## ~File()

~File | ( |  | ) |

Destructor.

## Member Function Documentation

## deleteFile()

bool deleteFile | ( | log4cxx::helpers::Pool & | p | ) | const

Delete file.

Parameters

  p | pool.

Returns
  true if file successfully deleted.

## exists()

bool exists | ( | log4cxx::helpers::Pool & | p | ) | const

Determines if file exists.

Parameters

  p | pool.

Returns
  true if file exists.

## getName()

LogString getName | ( |  | ) | const

Get final portion of file path.

Returns
  file name.

## getParent()

LogString getParent | ( | log4cxx::helpers::Pool & | p | ) | const

Get path of parent directory.

Parameters

  p | pool.

Returns
  path of parent directory.

## getPath()

LogString getPath | ( |  | ) | const

Get file path.

Returns
  file path.

## lastModified()

log4cxx_time_t lastModified | ( | log4cxx::helpers::Pool & | p | ) | const

Determines last modification date.

Parameters

  p | pool.

Returns
  length of file.

## length()

size_t length | ( | log4cxx::helpers::Pool & | p | ) | const

Determines length of file.

May not be accurate if file is current open.

Parameters

  p | pool.

Returns
  length of file.

## list()

std::vector<LogString> list | ( | log4cxx::helpers::Pool & | p | ) | const

List files if current file is a directory.

Parameters

  p | pool.

Returns
  list of files in this directory, operation of non-directory returns empty list.

## mkdirs()

bool mkdirs | ( | log4cxx::helpers::Pool & | p | ) | const

Make directories recursively.

Parameters

  p | pool.

Returns
  true if all requested directories existed or have been created.

## open()

log4cxx_status_t open | ( | apr_file_t ** | file,
|  | int | flags,
|  | int | perm,
|  | log4cxx::helpers::Pool & | p
| ) |  | const

Open file.

See apr_file_open for details.

Parameters

  file | APR file handle.
  flags | flags.
  perm | permissions.
  p | pool.

Returns
  APR_SUCCESS if successful.

## operator=()

File& operator= | ( | const File & | src | ) |

Assignment operator.

## renameTo()

bool renameTo | ( | const File & | dest,
|  | log4cxx::helpers::Pool & | p
| ) |  | const

Rename file.

Parameters

  dest | new path for file.
  p | pool.

Returns
  true if file successfully renamed.

## setPath()

File& setPath | ( | const LogString & |  | ) |

Set file path.

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

- file.h