My Project
 All Classes Functions Variables Pages
Public Member Functions | List of all members
File Class Reference

A logical representation of a file. More...

#include <File.h>

Public Member Functions

 File (std::string name, uint8_t type=DT_UNKNOWN)
 Construct a file. More...
 
std::string getContent (bool base64Encode=false)
 Retrieve the content of the file. More...
 
std::string getContent (uint32_t offset, uint32_t size)
 Retrieve the content of the file. More...
 
std::string getName ()
 Get the name of the file. More...
 
std::string getPath ()
 
uint8_t getType ()
 Get the type of the file. The type of a file can be DT_REGULAR, DT_DIRECTORY or DT_UNKNOWN. More...
 
bool isDirectory ()
 Determine if the type of the file is a directory. More...
 
uint32_t length ()
 Get the length of the file in bytes. More...
 

Detailed Description

A logical representation of a file.

Constructor & Destructor Documentation

File::File ( std::string  path,
uint8_t  type = DT_UNKNOWN 
)

Construct a file.

Parameters
[in]nameThe name of the file.
[in]typeThe type of the file (DT_REGULAR, DT_DIRECTORY or DT_UNKNOWN).

Member Function Documentation

std::string File::getContent ( bool  base64Encode = false)

Retrieve the content of the file.

Parameters
[in]base64EncodeShould we base64 encode the content?
Returns
The content of the file.
std::string File::getContent ( uint32_t  offset,
uint32_t  readSize 
)

Retrieve the content of the file.

Parameters
[in]offsetThe file offset to read from.
[in]readSizeThe number of bytes to read.
Returns
The content of the file.
std::string File::getName ( )

Get the name of the file.

Returns
The name of the file.
uint8_t File::getType ( )

Get the type of the file. The type of a file can be DT_REGULAR, DT_DIRECTORY or DT_UNKNOWN.

Returns
The type of the file.
bool File::isDirectory ( )

Determine if the type of the file is a directory.

Returns
True if the file is a directory.
uint32_t File::length ( )

Get the length of the file in bytes.

Returns
The length of the file in bytes.

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