Nebula
Loading...
Searching...
No Matches
IO::IoServer Class Reference

#include <ioserver.h>

Detailed Description

The central server object of the IO subsystem offers the following services:

associate stream classes with URI schemes create the right stream object for a given URI transparant (ZIP) archive support path assign management global filesystem manipulation and query methods

Inherits Core::RefCounted.

Public Types

using FileMapFunc = void(const Util::String& file, const Util::String& folder)

Public Member Functions

 IoServer ()
 constructor
virtual ~IoServer ()
 destructor
bool MountArchive (const URI &uri)
 mount a file archive (without archive file extension!)
bool MountEmbeddedArchive (const URI &uri)
 mount an embedded file archive
void UnmountArchive (const URI &uri)
 unmount a file archive (without archive file extension!)
bool IsArchiveMounted (const URI &uri) const
 return true if a archive is mounted (without archive file extension!)
void SetArchiveFileSystemEnabled (bool b)
 enable/disable transparent archive filesystem layering (default is yes)
bool IsArchiveFileSystemEnabled () const
 return true if transparent archive filesystem is enabled
void MountStandardArchives ()
 mount standard archives (e.g. home:export.zip and home:export_$(platform).zip)
void UnmountStandardArchives ()
 unmount standard archives
Ptr< StreamCreateStream (const URI &uri) const
 create a stream object for the given uri
bool CreateDirectory (const URI &uri) const
 create all missing directories in the path
bool EnsureDirectoriesForFile (const URI &uri) const
 create all missing directories
bool DeleteDirectory (const URI &path) const
 delete an empty directory
bool DirectoryExists (const URI &path) const
 return true if directory exists
bool CopyFile (const URI &from, const URI &to) const
 copy a file
bool DeleteFile (const URI &path) const
 delete a file
bool FileExists (const URI &path) const
 return true if file exists
bool IsLocked (const URI &path) const
 return if file is locked
void SetReadOnly (const URI &path, bool b) const
 set the readonly status of a file
bool IsReadOnly (const URI &path) const
 return read only status of a file
unsigned int ComputeFileCrc (const URI &path) const
 get the CRC checksum of a file
void SetFileWriteTime (const URI &path, FileTime fileTime)
 set the write-time of a file
FileTime GetFileWriteTime (const URI &path) const
 return the last write-time of a file
Util::Array< Util::StringListFiles (const URI &dir, const Util::String &pattern, bool asFullPath=false) const
 list all files matching a pattern in a directory
Util::Array< Util::StringListDirectories (const URI &dir, const Util::String &pattern, bool asFullPath=false, bool prioritizeArchive=true) const
 list all subdirectories matching a pattern in a directory
void IterateFolders (const URI &dir, const Util::String &pattern, FileMapFunc iter)
 iterate through all files in hierarchy and call provided function
URI CreateTemporaryFilename (const URI &path) const
 create a temporary file name
Public Member Functions inherited from Core::RefCounted
 RefCounted ()
 constructor
int GetRefCount () const
 get the current refcount
void AddRef ()
 increment refcount by one
void Release ()
 decrement refcount and destroy object if refcount is zero
bool IsInstanceOf (const Rtti &rtti) const
 return true if this object is instance of given class
bool IsInstanceOf (const Util::String &className) const
 return true if this object is instance of given class by string
bool IsInstanceOf (const Util::FourCC &classFourCC) const
 return true if this object is instance of given class by fourcc
bool IsA (const Rtti &rtti) const
 return true if this object is instance of given class, or a derived class
bool IsA (const Util::String &rttiName) const
 return true if this object is instance of given class, or a derived class, by string
bool IsA (const Util::FourCC &rttiFourCC) const
 return true if this object is instance of given class, or a derived class, by fourcc
const Util::StringGetClassName () const
 get the class name
Util::FourCC GetClassFourCC () const
 get the class FourCC code

Static Public Member Functions

static bool ReadFile (const URI &path, Util::String &contents)
 read contents of file and return as string
static Util::String NativePath (const Util::String &path)
 return native path
Static Public Member Functions inherited from Core::RefCounted
static void DumpRefCountingLeaks ()
 dump refcounting leaks, call at end of application (NEBULA_DEBUG builds only!)

Private Member Functions

 __DeclareClass (IoServer)
 __DeclareSingleton (IoServer)
Util::Array< Util::StringAddPathPrefixToArray (const Util::String &prefix, const Util::Array< Util::String > &filenames) const
 helper function to add path prefix to file or dir names in array

Private Attributes

bool archiveFileSystemEnabled
Ptr< ArchiveFileSystemarchiveFileSystem
Ptr< Http::HttpClientRegistryhttpClientRegistry
Ptr< AssignRegistryassignRegistry
Ptr< SchemeRegistryschemeRegistry
Ptr< FileWatcherwatcher
Ptr< StreamCachestreamCache

Static Private Attributes

static Threading::CriticalSection archiveCriticalSection
static bool StandardArchivesMounted = false
static Threading::CriticalSection assignCriticalSection
static Threading::CriticalSection schemeCriticalSection
static Threading::CriticalSection watcherCriticalSection

Additional Inherited Members

Protected Member Functions inherited from Core::RefCounted
virtual ~RefCounted ()
 destructor (called when refcount reaches zero)

Member Typedef Documentation

◆ FileMapFunc

using IO::IoServer::FileMapFunc = void(const Util::String& file, const Util::String& folder)

Constructor & Destructor Documentation

◆ IoServer()

IO::IoServer::IoServer ( )

constructor

◆ ~IoServer()

IO::IoServer::~IoServer ( )
virtual

destructor

Member Function Documentation

◆ __DeclareClass()

IO::IoServer::__DeclareClass ( IoServer )
private

◆ __DeclareSingleton()

IO::IoServer::__DeclareSingleton ( IoServer )
private

◆ AddPathPrefixToArray()

Array< String > IO::IoServer::AddPathPrefixToArray ( const Util::String & prefix,
const Util::Array< Util::String > & filenames ) const
private

helper function to add path prefix to file or dir names in array

◆ ComputeFileCrc()

unsigned int IO::IoServer::ComputeFileCrc ( const URI & path) const

get the CRC checksum of a file

This method computes the CRC checksum for a file.

◆ CopyFile()

bool IO::IoServer::CopyFile ( const URI & from,
const URI & to ) const

copy a file

This copies a file to another file.

◆ CreateDirectory()

bool IO::IoServer::CreateDirectory ( const URI & uri) const

create all missing directories in the path

This method creates all missing directories in a path.

◆ CreateStream()

Ptr< Stream > IO::IoServer::CreateStream ( const URI & uri) const

create a stream object for the given uri

◆ CreateTemporaryFilename()

IO::URI IO::IoServer::CreateTemporaryFilename ( const URI & path) const

create a temporary file name

◆ DeleteDirectory()

bool IO::IoServer::DeleteDirectory ( const URI & path) const

delete an empty directory

◆ DeleteFile()

bool IO::IoServer::DeleteFile ( const URI & path) const

delete a file

◆ DirectoryExists()

bool IO::IoServer::DirectoryExists ( const URI & path) const

return true if directory exists

◆ EnsureDirectoriesForFile()

bool IO::IoServer::EnsureDirectoriesForFile ( const URI & uri) const

create all missing directories

◆ FileExists()

bool IO::IoServer::FileExists ( const URI & path) const

return true if file exists

◆ GetFileWriteTime()

FileTime IO::IoServer::GetFileWriteTime ( const URI & path) const

return the last write-time of a file

◆ IsArchiveFileSystemEnabled()

bool IO::IoServer::IsArchiveFileSystemEnabled ( ) const
inline

return true if transparent archive filesystem is enabled

NOTE: on platforms which provide transparent archive access through the OS (like on PS3) this method will always return false.

This saves some unecessary overhead in the Nebula IoServer.

◆ IsArchiveMounted()

bool IO::IoServer::IsArchiveMounted ( const URI & uri) const

return true if a archive is mounted (without archive file extension!)

◆ IsLocked()

bool IO::IoServer::IsLocked ( const URI & path) const

return if file is locked

◆ IsReadOnly()

bool IO::IoServer::IsReadOnly ( const URI & path) const

return read only status of a file

◆ IterateFolders()

void IO::IoServer::IterateFolders ( const URI & dir,
const Util::String & pattern,
FileMapFunc iter )

iterate through all files in hierarchy and call provided function

◆ ListDirectories()

Array< String > IO::IoServer::ListDirectories ( const URI & dir,
const Util::String & pattern,
bool asFullPath = false,
bool prioritizeArchive = true ) const

list all subdirectories matching a pattern in a directory

◆ ListFiles()

Array< String > IO::IoServer::ListFiles ( const URI & dir,
const Util::String & pattern,
bool asFullPath = false ) const

list all files matching a pattern in a directory

◆ MountArchive()

bool IO::IoServer::MountArchive ( const URI & uri)

mount a file archive (without archive file extension!)

◆ MountEmbeddedArchive()

bool IO::IoServer::MountEmbeddedArchive ( const URI & uri)

mount an embedded file archive

◆ MountStandardArchives()

void IO::IoServer::MountStandardArchives ( )

mount standard archives (e.g. home:export.zip and home:export_$(platform).zip)

◆ NativePath()

Util::String IO::IoServer::NativePath ( const Util::String & path)
static

return native path

◆ ReadFile()

bool IO::IoServer::ReadFile ( const URI & path,
Util::String & contents )
static

read contents of file and return as string

◆ SetArchiveFileSystemEnabled()

void IO::IoServer::SetArchiveFileSystemEnabled ( bool b)
inline

enable/disable transparent archive filesystem layering (default is yes)

◆ SetFileWriteTime()

void IO::IoServer::SetFileWriteTime ( const URI & path,
FileTime fileTime )

set the write-time of a file

◆ SetReadOnly()

void IO::IoServer::SetReadOnly ( const URI & path,
bool b ) const

set the readonly status of a file

◆ UnmountArchive()

void IO::IoServer::UnmountArchive ( const URI & uri)

unmount a file archive (without archive file extension!)

◆ UnmountStandardArchives()

void IO::IoServer::UnmountStandardArchives ( )

unmount standard archives

Member Data Documentation

◆ archiveCriticalSection

Threading::CriticalSection IO::IoServer::archiveCriticalSection
staticprivate

◆ archiveFileSystem

Ptr<ArchiveFileSystem> IO::IoServer::archiveFileSystem
private

◆ archiveFileSystemEnabled

bool IO::IoServer::archiveFileSystemEnabled
private

◆ assignCriticalSection

Threading::CriticalSection IO::IoServer::assignCriticalSection
staticprivate

◆ assignRegistry

Ptr<AssignRegistry> IO::IoServer::assignRegistry
private

◆ httpClientRegistry

Ptr<Http::HttpClientRegistry> IO::IoServer::httpClientRegistry
private

◆ schemeCriticalSection

Threading::CriticalSection IO::IoServer::schemeCriticalSection
staticprivate

◆ schemeRegistry

Ptr<SchemeRegistry> IO::IoServer::schemeRegistry
private

◆ StandardArchivesMounted

bool IO::IoServer::StandardArchivesMounted = false
staticprivate

◆ streamCache

Ptr<StreamCache> IO::IoServer::streamCache
private

◆ watcher

Ptr<FileWatcher> IO::IoServer::watcher
private

◆ watcherCriticalSection

Threading::CriticalSection IO::IoServer::watcherCriticalSection
staticprivate

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