Nazara Engine  0.4
A fast, complete, cross-platform API designed for game development
Nz::Directory Class Reference

Core class that represents a directory. More...

Public Member Functions

 Directory ()
 Constructs a Directory object by default.
 
 Directory (const String &dirPath)
 Constructs a Directory object with a path. More...
 
 Directory (const Directory &)=delete
 
 Directory (Directory &&) noexcept=default
 
 ~Directory ()
 Destructs the object and calls Close. More...
 
void Close ()
 Closes the directory.
 
bool Exists () const
 Checks whether the directory exists. More...
 
String GetPath () const
 Gets the path of the directory. More...
 
String GetPattern () const
 Gets the pattern for the path of the directory. More...
 
String GetResultName () const
 Gets the result name of the directory. More...
 
String GetResultPath () const
 Gets the result path of the directory. More...
 
UInt64 GetResultSize () const
 Gets the resulting size of the directory. More...
 
bool IsOpen () const
 Checks whether the directory is open. More...
 
bool IsResultDirectory () const
 Checks whether the directory is result. More...
 
bool NextResult (bool skipDots=true)
 Sets the next result in the directory. More...
 
bool Open ()
 Opens the directory. More...
 
void SetPath (const String &dirPath)
 Sets the path of the directory. More...
 
void SetPattern (const String &pattern)
 Sets the pattern of the directory. More...
 
Directoryoperator= (const Directory &)=delete
 
Directoryoperator= (Directory &&) noexcept=delete
 

Static Public Member Functions

static bool Copy (const String &sourcePath, const String &destPath)
 Copies the first directory to a new directory path. More...
 
static bool Create (const String &dirPath, bool recursive=false)
 Creates a directory from a path. More...
 
static bool Exists (const String &dirPath)
 Checks whether the directory exists. More...
 
static String GetCurrent ()
 Gets the current path of this directory. More...
 
static const char * GetCurrentFileRelativeToEngine (const char *currentFile)
 Gets this current file relative to the engine. More...
 
static bool Remove (const String &dirPath, bool emptyDirectory=false)
 Removes the directory. More...
 
static bool SetCurrent (const String &dirPath)
 Sets the current directory. More...
 

Detailed Description

Core class that represents a directory.

Constructor & Destructor Documentation

◆ Directory()

Nz::Directory::Directory ( const String dirPath)

Constructs a Directory object with a path.

Parameters
dirPathPath to the directory

◆ ~Directory()

Nz::Directory::~Directory ( )

Destructs the object and calls Close.

See also
Close

Member Function Documentation

◆ Copy()

bool Nz::Directory::Copy ( const String sourcePath,
const String destPath 
)
static

Copies the first directory to a new directory path.

Returns
true if copy is successful
Parameters
sourcePathPath of the original directory
targetPathPath of the copied directory
Remarks
Produces a NazaraError if could not create destination directory
Produces a NazaraError if could not open origin directory
Produces a NazaraError if could not copy a file

◆ Create()

bool Nz::Directory::Create ( const String dirPath,
bool  recursive = false 
)
static

Creates a directory from a path.

Returns
true if creation is successful
Parameters
dirPathPath of the directory
recursiveCreates subdirectories

◆ Exists() [1/2]

bool Nz::Directory::Exists ( ) const

Checks whether the directory exists.

Returns
true if directory exists

◆ Exists() [2/2]

bool Nz::Directory::Exists ( const String dirPath)
static

Checks whether the directory exists.

Returns
true if directory exists
Parameters
dirPathPath of the directory

◆ GetCurrent()

String Nz::Directory::GetCurrent ( )
static

Gets the current path of this directory.

Returns
Current path

◆ GetCurrentFileRelativeToEngine()

const char * Nz::Directory::GetCurrentFileRelativeToEngine ( const char *  currentFile)
static

Gets this current file relative to the engine.

Returns
Path to this file

FIXME: Is this method in the right place ?

◆ GetPath()

String Nz::Directory::GetPath ( ) const

Gets the path of the directory.

Returns
Path of the directory

◆ GetPattern()

String Nz::Directory::GetPattern ( ) const

Gets the pattern for the path of the directory.

Returns
Pattern for the path of the directory

◆ GetResultName()

String Nz::Directory::GetResultName ( ) const

Gets the result name of the directory.

Returns
Resulting name
Remarks
Produces a NazaraError if directory is not open with NAZARA_CORE_SAFE defined

◆ GetResultPath()

String Nz::Directory::GetResultPath ( ) const

Gets the result path of the directory.

Returns
Resulting path
Remarks
Produces a NazaraError if directory is not open with NAZARA_CORE_SAFE defined

◆ GetResultSize()

UInt64 Nz::Directory::GetResultSize ( ) const

Gets the resulting size of the directory.

Returns
Size of the directory
Remarks
Produces a NazaraError if directory is not open with NAZARA_CORE_SAFE defined

◆ IsOpen()

bool Nz::Directory::IsOpen ( ) const

Checks whether the directory is open.

Returns
true if open

◆ IsResultDirectory()

bool Nz::Directory::IsResultDirectory ( ) const

Checks whether the directory is result.

Returns
true if result
Remarks
Produces a NazaraError if directory is not open with NAZARA_CORE_SAFE defined

◆ NextResult()

bool Nz::Directory::NextResult ( bool  skipDots = true)

Sets the next result in the directory.

Returns
true if directory has a next result
Parameters
skipDotsSkips the dots in the path
Remarks
Produces a NazaraError if directory is not open with NAZARA_CORE_SAFE defined

◆ Open()

bool Nz::Directory::Open ( )

Opens the directory.

Returns
true if opening is successful

◆ Remove()

bool Nz::Directory::Remove ( const String dirPath,
bool  emptyDirectory = false 
)
static

Removes the directory.

Returns
true if remove is successful
Parameters
dirPathPath of the directory
emptyDirectoryRemove recursively

◆ SetCurrent()

bool Nz::Directory::SetCurrent ( const String dirPath)
static

Sets the current directory.

Returns
true if directory path exists
Parameters
dirPathPath of the directory

◆ SetPath()

void Nz::Directory::SetPath ( const String dirPath)

Sets the path of the directory.

Parameters
dirPathPath of the directory

◆ SetPattern()

void Nz::Directory::SetPattern ( const String pattern)

Sets the pattern of the directory.

Parameters
dirPathPattern of the directory

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