Classes | Enumerator
clanCore I/O Data

## Classes
class | clan::Directory
| Directory utility class. More...
class | clan::DirectoryScanner
| Directory scanning class. More...
class | clan::Endian
| Endianess management class. More...
class | clan::File
| File I/O device. More...
class | clan::FileHelp
| File operation helpers. More...
class | clan::FileSystem
| Virtual File System (VFS). More...
class | clan::FileSystemProvider
| Virtual File System (VFS) file source. More...
class | clan::IODevice
| I/O Device interface. More...
class | clan::IODeviceProvider
| I/O device provider interface. More...
class | clan::MemoryDevice
| Memory I/O device. More...
class | clan::PathHelp
| Path helper functions. More...
class | clan::ZipArchive
| Zip archive. More...
class | clan::ZipFileEntry
| File entry in zip file. More...
class | clan::ZipReader
| Zip file reader. More...
class | clan::ZipWriter
| Zip file writer. More...
class | clan::ZLibCompression
| Deflate compressor. More...

## Operations
static void | clan::Endian::swap (void *data, int type_size, int total_times=1)
| Swaps larger amounts of data between little and big endian. More...
static void | clan::Endian::swap_if_big (void *data, int type_size, int total_times=1)
static void | clan::Endian::swap_if_little (void *data, int type_size, int total_times=1)

## Attributes
static bool | clan::Endian::is_system_big ()
| Returns true if big endian system. More...
static bool | clan::Endian::is_system_64bit ()
| Returns true if 64 bit system. More...

## Operations
static bool | clan::Directory::create (const std::string &dir_name, bool recursive=false)
| Create directory. More...
static bool | clan::Directory::remove (const std::string &dir_name, bool delete_files=false, bool delete_sub_directories=false)
| Remove directory. More...
static bool | clan::Directory::rename (const std::string &old_name, const std::string &new_name)
| Rename directory. More...
static bool | clan::Directory::set_current (const std::string &dir_name)
| Change current directory. More...
static std::string | clan::Directory::get_current ()
| Get current directory. More...
static std::string | clan::Directory::get_appdata (const std::string &company_name, const std::string &application_name, const std::string &version, bool create_dirs_if_missing=true)
| Returns the current user's roaming application data directory. More...
static std::string | clan::Directory::get_local_appdata (const std::string &company_name, const std::string &application_name, const std::string &version, bool create_dirs_if_missing=true)
| Returns the current user's local (nonroaming) application data directory. More...
static std::string | clan::Directory::get_resourcedata (const std::string &application_name, const std::string &data_dir_name="Resources")
| Returns the application resource data directory. More...

## Construction
| clan::DirectoryScanner::DirectoryScanner ()
| Constructs directory scanner for iterating over a directory. More...
| clan::DirectoryScanner::~DirectoryScanner ()
| Destructor. More...

## Attributes
std::string | clan::DirectoryScanner::get_directory_path ()
| Gets the directory being scanned. More...
std::string | clan::DirectoryScanner::get_name ()
| Gets the name of the current file. More...
int | clan::DirectoryScanner::get_size ()
| Gets the size of the current file. More...
std::string | clan::DirectoryScanner::get_pathname ()
| Gets the pathname of the current file. More...
bool | clan::DirectoryScanner::is_directory ()
| Returns true if the current file is a directory. More...
bool | clan::DirectoryScanner::is_hidden ()
| Returns true if the file is hidden. More...
bool | clan::DirectoryScanner::is_readable ()
| Returns true if the file is readable by the current user. More...
bool | clan::DirectoryScanner::is_writable ()
| Returns true if the file is writable by the current user. More...

## Operations
bool | clan::DirectoryScanner::scan (const std::string &pathname)
| Selects the directory to scan through. More...
bool | clan::DirectoryScanner::scan (const std::string &pathname, const std::string &pattern)
| Selects the directory to scan through. More...
bool | clan::DirectoryScanner::next ()
| Find next file in directory scan. More...

## Static helper functions
static std::string | clan::File::read_text (const std::string &filename)
| Loads an UTF-8 text file into a string. More...
static DataBuffer | clan::File::read_bytes (const std::string &filename)
| Loads an file into a byte buffer. More...
static void | clan::File::write_text (const std::string &filename, const std::string &text, bool write_bom=false)
| Saves an UTF-8 text string to file. More...
static void | clan::File::write_bytes (const std::string &filename, const DataBuffer &bytes)
| Saves a byte buffer to file. More...

## Enumerations
enum | clan::File::AccessFlags { clan::File::access_read = 1, clan::File::access_write = 2, clan::File::access_read_write = access_read | access_write }
| Access flags. More...
enum | clan::File::ShareFlags { clan::File::share_read = 1, clan::File::share_write = 2, clan::File::share_delete = 4, clan::File::share_all = share_read + share_write + share_delete }
| File sharing flags. More...
enum | clan::File::OpenMode { clan::File::open_always, clan::File::open_existing, clan::File::open_existing_truncate, clan::File::create_always, clan::File::create_new }
| File opening modes. More...
enum | clan::File::Flags { clan::File::flag_write_through = 1, clan::File::flag_no_buffering = 2, clan::File::flag_random_access = 4, clan::File::flag_sequential_scan = 8 }
| Optimization Flags. More...

## Construction
| clan::File::File ()
| Constructs a file object. More...
| clan::File::File (const std::string &filename)
| Constructs a file object read only. More...
| clan::File::File (const std::string &filename, OpenMode mode, unsigned int access, unsigned int share=share_all, unsigned int flags=0)
| Constructs a file object. More...
| clan::File::~File ()

## Operations
bool | clan::File::open (const std::string &filename)
| Opens a file read only. More...
bool | clan::File::open (const std::string &filename, OpenMode mode, unsigned int access, unsigned int share=share_all, unsigned int flags=0)
| Opens a file. More...
void | clan::File::close ()
| Close file. More...

## Operations
static void | clan::FileHelp::copy_file (const std::string &from, const std::string &to, bool copy_always)
| Copy a file. More...
static void | clan::FileHelp::delete_file (const std::string &filename)
| Delete a file. More...
static bool | clan::FileHelp::file_exists (const std::string &filename)
| Check if a file exists. More...

## Construction
| clan::FileSystem::FileSystem ()
| Constructs a file system. More...
| clan::FileSystem::FileSystem (FileSystemProvider *provider)
| Constructs a FileSystem. More...
| clan::FileSystem::FileSystem (const std::string &path, bool is_zip_file=false)
| Constructs a FileSystem. More...
| clan::FileSystem::~FileSystem ()

## Attributes
bool | clan::FileSystem::is_null () const
| Returns true if the file system is null. More...
bool | clan::FileSystem::is_mount (const std::string &mount_point)
| Returns true if a path is a mount point. More...
DirectoryListing | clan::FileSystem::get_directory_listing (const std::string &path_rel)
| Return directory listing for path. More...
bool | clan::FileSystem::has_file (const std::string &filename)
| Return true if the root of the filesystem contains the specified file. More...
bool | clan::FileSystem::has_directory (const std::string &directory)
| Return true if the root of the filesystem contains the specified directory. More...
FileSystemProvider * | clan::FileSystem::get_provider ()
| Returns the file source for this file system. More...
std::string | clan::FileSystem::get_path () const
| Returns a path to the file source for this file system. More...
std::string | clan::FileSystem::get_identifier () const
| Get the identifier of this file source. More...

## Operations
IODevice | clan::FileSystem::open_file (const std::string &filename, File::OpenMode mode=File::open_existing, unsigned int access=File::access_read, unsigned int share=File::share_all, unsigned int flags=0) const
| Opens a file. More...
void | clan::FileSystem::mount (const std::string &mount_point, FileSystem fs)
| Mounts a file system at mount point. More...
void | clan::FileSystem::mount (const std::string &mount_point, const std::string &path, bool is_zip_file)
| Mounts a file system at mount point. More...
void | clan::FileSystem::unmount (const std::string &mount_point)
| Unmount a file system. More...

## Construction
virtual | clan::FileSystemProvider::~FileSystemProvider ()

## Operations
virtual IODevice | clan::FileSystemProvider::open_file (const std::string &filename, File::OpenMode mode=File::open_existing, unsigned int access=File::access_read|File::access_write, unsigned int share=File::share_all, unsigned int flags=0)=0
| Open file from this source. More...
virtual bool | clan::FileSystemProvider::initialize_directory_listing (const std::string &path)=0
| Initiate directory listing. More...
virtual bool | clan::FileSystemProvider::next_file (DirectoryListingEntry &entry)=0
| Update directory listing item. More...
virtual std::string | clan::FileSystemProvider::get_path () const =0
| Return the path of this file source. More...
virtual std::string | clan::FileSystemProvider::get_identifier () const =0
| Get the identifier of this file source. More...

## Enumerations
enum | clan::IODevice::SeekMode { clan::IODevice::seek_set, clan::IODevice::seek_cur, clan::IODevice::seek_end }
| Seeking modes. More...

## Construction
| clan::IODevice::IODevice ()
| Constructs a null instance. More...
| clan::IODevice::IODevice (IODeviceProvider *provider)
| Constructs a IODevice. More...
| clan::IODevice::~IODevice ()

## Attributes
bool | clan::IODevice::is_null () const
| Returns true if this object is invalid. More...
void | clan::IODevice::throw_if_null () const
| Throw an exception if this object is invalid. More...
int | clan::IODevice::get_size () const
| Returns the size of data stream. More...
int | clan::IODevice::get_position () const
| Returns the position in the data stream. More...
bool | clan::IODevice::is_little_endian () const
| Returns true if the input source is in little endian mode. More...
const IODeviceProvider * | clan::IODevice::get_provider () const
| Returns the provider for this object. More...
IODeviceProvider * | clan::IODevice::get_provider ()
| Returns the provider for this object. More...

## Operations
int | clan::IODevice::send (const void *data, int len, bool send_all=true)
| Send data to device. More...
int | clan::IODevice::receive (void *data, int len, bool receive_all=true)
| Receive data from device. More...
int | clan::IODevice::peek (void *data, int len)
| Peek data from device (data is left in the buffer). More...
bool | clan::IODevice::seek (int position, SeekMode mode=seek_set)
| Seek in data stream. More...
int | clan::IODevice::read (void *data, int len, bool receive_all=true)
| Alias for receive(data, len, receive_all) More...
int | clan::IODevice::write (const void *data, int len, bool send_all=true)
| Alias for send(data, len, send_all) More...
void | clan::IODevice::set_system_mode ()
| Changes input data endianess to the local systems mode. More...
void | clan::IODevice::set_big_endian_mode ()
| Changes input data endianess to big endian mode. (Default is little endian) More...
void | clan::IODevice::set_little_endian_mode ()
| Changes input data endianess to little endian mode. This is the default setting. More...
void | clan::IODevice::write_int64 (int64_t data)
| Writes a signed 64 bit integer to output source. More...
void | clan::IODevice::write_uint64 (uint64_t data)
| Writes an unsigned 64 bit integer to output source. More...
void | clan::IODevice::write_int32 (int32_t data)
| Writes a signed 32 bit integer to output source. More...
void | clan::IODevice::write_uint32 (uint32_t data)
| Writes an unsigned 32 bit integer to output source. More...
void | clan::IODevice::write_int16 (int16_t data)
| Writes a signed 16 bit integer to output source. More...
void | clan::IODevice::write_uint16 (uint16_t data)
| Writes an unsigned 16 bit integer to output source. More...
void | clan::IODevice::write_int8 (int8_t data)
| Writes a signed 8 bit integer to output source. More...
void | clan::IODevice::write_uint8 (uint8_t data)
| Writes an unsigned 8 bit integer to output source. More...
void | clan::IODevice::write_float (float data)
| Writes a float to output source. More...
void | clan::IODevice::write_string_a (const std::string &str)
| Writes a string to the output source. More...
void | clan::IODevice::write_string_nul (const std::string &str)
| Writes a nul terminated string to the output source. More...
void | clan::IODevice::write_string_text (const std::string &str)
| Writes a text string to the output source. More...
int64_t | clan::IODevice::read_int64 ()
| Reads a signed 64 bit integer from input source. More...
uint64_t | clan::IODevice::read_uint64 ()
| Reads an unsigned 64 bit integer from input source. More...
int32_t | clan::IODevice::read_int32 ()
| Reads a signed 32 bit integer from input source. More...
uint32_t | clan::IODevice::read_uint32 ()
| Reads an unsigned 32 bit integer from input source. More...
int16_t | clan::IODevice::read_int16 ()
| Reads a signed 16 bit integer from input source. More...
uint16_t | clan::IODevice::read_uint16 ()
| Reads an unsigned 16 bit integer from input source. More...
int8_t | clan::IODevice::read_int8 ()
| Reads a signed 8 bit integer from input source. More...
uint8_t | clan::IODevice::read_uint8 ()
| Reads an unsigned 8 bit integer from input source. More...
float | clan::IODevice::read_float ()
| Reads a float from input source. More...
std::string | clan::IODevice::read_string_a ()
| Reads a string from the input source. More...
std::string | clan::IODevice::read_string_nul ()
| Reads a nul terminated string from the input source. More...
std::string | clan::IODevice::read_string_text (const char *skip_initial_chars, const char *read_until_chars, bool allow_eof=true)
| Reads a string from the input source where the source is a text file. More...
IODevice | clan::IODevice::duplicate ()
| Create a new IODevice referencing the same resource. More...

## Implementation
std::shared_ptr< IODevice_Impl > | clan::IODevice::impl

## Construction
virtual | clan::IODeviceProvider::~IODeviceProvider ()

## Attributes
virtual int | clan::IODeviceProvider::get_size () const
| Returns the size of data stream. More...
virtual int | clan::IODeviceProvider::get_position () const
| Returns the position in the data stream. More...

## Operations
virtual int | clan::IODeviceProvider::send (const void *data, int len, bool send_all=true)=0
| Send data to device. More...
virtual int | clan::IODeviceProvider::receive (void *data, int len, bool receive_all=true)=0
| Receive data from device. More...
virtual int | clan::IODeviceProvider::peek (void *data, int len)=0
| Peek data from device. More...
virtual IODeviceProvider * | clan::IODeviceProvider::duplicate ()=0
| Returns a new provider to the same resource. More...
virtual bool | clan::IODeviceProvider::seek (int, IODevice::SeekMode)
| Seek in data stream. More...

## Construction
| clan::MemoryDevice::MemoryDevice ()
| Constructs a memory I/O device. More...
| clan::MemoryDevice::MemoryDevice (DataBuffer &data)
| Constructs a IODevice Memory. More...

## Attributes
const DataBuffer & | clan::MemoryDevice::get_data () const
| Retrieves the data buffer for the memory device. More...
DataBuffer & | clan::MemoryDevice::get_data ()
| Get Data. More...

## Operations
enum | clan::PathHelp::PathType { clan::PathHelp::path_type_file, clan::PathHelp::path_type_virtual }
| Path types. More...
static std::string | clan::PathHelp::make_absolute (const std::string &base_path, const std::string &relative_path, PathType path_type=path_type_file)
| Convert a relative path to an absolute path. More...
static std::string | clan::PathHelp::make_relative (const std::string &base_path, const std::string &absolute_path, PathType path_type=path_type_file)
| Converts an absolute path into a path relative to a base path. More...
static bool | clan::PathHelp::is_absolute (const std::string &path, PathType path_type=path_type_file)
| Check if a path is absolute. More...
static bool | clan::PathHelp::is_relative (const std::string &path, PathType path_type=path_type_file)
| Check if a path is relative. More...
static std::string | clan::PathHelp::normalize (const std::string &path, PathType path_type=path_type_file)
| Normalize a path. More...
static std::string | clan::PathHelp::add_trailing_slash (const std::string &path, PathType path_type=path_type_file)
| Add trailing slash or backslash to path. More...
static std::string | clan::PathHelp::remove_trailing_slash (const std::string &path)
| Remove trailing slash or backslash from path. More...
*static std::string | clan::PathHelp::get_location (const std::string &fullname, PathType path_type=path_type_file)
| Returns the drive (C:) or share name ( \ \ computer \ share) More...
static std::string | clan::PathHelp::get_basepath (const std::string &fullname, PathType path_type=path_type_file)
| Returns the path excluding the location and filename. More...
static std::vector< std::string > | clan::PathHelp::split_basepath (const std::string &fullname, PathType path_type=path_type_file)
| Splits the path, excluding the location, into parts. More...
static std::string | clan::PathHelp::get_fullpath (const std::string &fullname, PathType path_type=path_type_file)
| Returns the path including the location. More...
static std::string | clan::PathHelp::get_filename (const std::string &fullname, PathType path_type=path_type_file)
| Returns the filename part of a fullname. More...
static std::string | clan::PathHelp::get_basename (const std::string &fullname, PathType path_type=path_type_file)
| Returns the basename part of a fullname. More...
static std::string | clan::PathHelp::get_extension (const std::string &fullname, PathType path_type=path_type_file)
| Returns the extension part of a fullname. More...
static std::string | clan::PathHelp::get_fullname (const std::string &fullpath, const std::string &filename, PathType path_type=path_type_file)
| Create a fullname from parts. More...
static std::string | clan::PathHelp::get_fullname (const std::string &fullpath, const std::string &filename, const std::string &extension, PathType path_type=path_type_file)
| Create a fullname from parts. More...
static std::string | clan::PathHelp::get_fullname (const std::string &location, const std::string &basepath, const std::string &filename, const std::string &extension, PathType path_type=path_type_file)
| Create a fullname from parts. More...
static std::string | clan::PathHelp::combine (const std::string &part1, const std::string &part2, PathType path_type=path_type_file)
| Concatenates two strings into one adding a trailing slash to first string if missing. More...

## Construction
| clan::ZipArchive::ZipArchive ()
| Constructs or loads a ZIP archive. More...
| clan::ZipArchive::ZipArchive (IODevice &input)
| Constructs a ZipArchive. More...
| clan::ZipArchive::ZipArchive (const std::string &filename)
| Constructs a ZipArchive. More...
| clan::ZipArchive::ZipArchive (const ZipArchive &copy)
| Constructs a ZipArchive. More...
| clan::ZipArchive::~ZipArchive ()

## Attributes
std::vector< ZipFileEntry > | clan::ZipArchive::get_file_list ()
| List of file entries in archive. More...
std::vector< ZipFileEntry > | clan::ZipArchive::get_file_list (const std::string &path)

## Operations
IODevice | clan::ZipArchive::open_file (const std::string &filename)
| Opens a file in the archive. More...
std::string | clan::ZipArchive::get_pathname (const std::string &filename)
| Get full path to source: More...
IODevice | clan::ZipArchive::create_file (const std::string &filename, bool compress=true)
| Creates a new file entry. More...
void | clan::ZipArchive::add_file (const std::string &input_filename, const std::string &filename_in_archive)
| Adds a file to zip archive. More...
void | clan::ZipArchive::save ()
| Saves zip archive. More...
void | clan::ZipArchive::save (const std::string &filename)
| Save. More...
void | clan::ZipArchive::save (IODevice iodev)
| Save. More...
void | clan::ZipArchive::load (IODevice &input)
| Loads the zip archive from a input device (done automatically at construction). More...

## Construction
| clan::ZipFileEntry::ZipFileEntry ()
| clan::ZipFileEntry::ZipFileEntry (const ZipFileEntry &copy)
| Constructs a ZipFileEntry. More...
| clan::ZipFileEntry::~ZipFileEntry ()

## Attributes
std::string | clan::ZipFileEntry::get_archive_filename () const
| Returns the filename of file entry. More...
std::string | clan::ZipFileEntry::get_input_filename () const
| Returns the filename of file entry. More...
int64_t | clan::ZipFileEntry::get_uncompressed_size ()
| Returns the uncompressed size of file entry. More...
int64_t | clan::ZipFileEntry::get_compressed_size ()
| Returns the compressed size of file entry. More...
bool | clan::ZipFileEntry::is_directory () const
| Is Directory. More...

## Operations
ZipFileEntry & | clan::ZipFileEntry::operator= (const ZipFileEntry &copy)
| Copy assignment operator. More...
void | clan::ZipFileEntry::set_input_filename (const std::string &filename)
| Sets the filename of the file to be added to the archive. More...
void | clan::ZipFileEntry::set_archive_filename (const std::string &filename)
| Sets the filename of the file inside the archive. More...
void | clan::ZipFileEntry::set_directory (bool is_directory)
| Set directory. More...

## Implementation
class | clan::ZipFileEntry::ZipArchive
class | clan::ZipFileEntry::ZipIODevice_FileEntry

## Construction
| clan::ZipReader::ZipReader (IODevice &input)
| Constructs a ZipReader. More...

## Operations
bool | clan::ZipReader::read_local_file_header (bool allow_data_descriptor=false)
| Begins reading a file entry in the zip file. More...
std::string | clan::ZipReader::get_filename ()
| Returns the file name that was stored in the local file header. More...
bool | clan::ZipReader::has_data_descriptor () const
| Returns true if the file entry is followed by a data descriptor. More...
int64_t | clan::ZipReader::get_compressed_size () const
| Returns the compressed size of the file entry. More...
int64_t | clan::ZipReader::get_uncompressed_size () const
| Returns the uncompressed size of the file entry. More...
void | clan::ZipReader::set_data_descriptor_data (int64_t compressed_size, int64_t uncompressed_size, uint32_t crc32)
| Informs the zip reader what the data descriptor contains. More...
int64_t | clan::ZipReader::read_file_data (void *data, int64_t size, bool read_all=true)
| Reads some file data from the zip file. More...

## Construction
| clan::ZipWriter::ZipWriter (IODevice &output, bool storeFilenamesAsUTF8=false)
| Constructs a ZipWriter. More...

## Operations
void | clan::ZipWriter::begin_file (const std::string &filename, bool compress)
| Begins file entry in the zip file. More...
void | clan::ZipWriter::write_file_data (const void *data, int64_t size)
| Writes some file data to the zip file. More...
void | clan::ZipWriter::end_file ()
| Ends the file entry. More...
void | clan::ZipWriter::write_toc ()
| Writes the table of contents part of the zip file. More...

## Operations
enum | clan::ZLibCompression::CompressionMode { clan::ZLibCompression::default_strategy, clan::ZLibCompression::filtered, clan::ZLibCompression::huffman_only, clan::ZLibCompression::rle, clan::ZLibCompression::fixed }
static DataBuffer | clan::ZLibCompression::compress (const DataBuffer &data, bool raw=true, int compression_level=6, CompressionMode mode=default_strategy)
static DataBuffer | clan::ZLibCompression::decompress (const DataBuffer &data, bool raw=true)

## Detailed Description

## Enumeration Type Documentation

enum clan::File::AccessFlags

Access flags.

File access types available.

Enumerator
access_read | Generic read access.
access_write | Generic write access.
access_read_write | Generic read write access.

enum clan::ZLibCompression::CompressionMode

Enumerator
default_strategy |
filtered |
huffman_only |
rle |
fixed |

enum clan::File::Flags

Optimization Flags.

Enumerator
flag_write_through |
flag_no_buffering |
flag_random_access |
flag_sequential_scan |

enum clan::File::OpenMode

File opening modes.

Enumerator
open_always | Open file or create it if it does not exist.
open_existing | Open existing file. Fails if it does not exist.
open_existing_truncate | Open existing file and truncate it.
create_always | Create file, even if it already exists.
create_new | Create a new file. Fails if it already exists.

enum clan::PathHelp::PathType

Path types.

Enumerator
path_type_file | Native file system path. (On windows, '/' are turned into '\'. On linux, '\' are turned into '/')
path_type_virtual | Path using slashes ('/').

enum clan::IODevice::SeekMode

Seeking modes.

Enumerator
seek_set | Set to a specific value from the start.
seek_cur | Set relative to the current position.
seek_end | Set to a specific value from the end (use negative position)

enum clan::File::ShareFlags

File sharing flags.

Enumerator
share_read | Allow others to open the file for reading.
share_write | Allow others to open the file for writing.
share_delete | Allow others to delete the file.
share_all | All other sharing flags combined.

## Function Documentation

clan::DirectoryScanner::DirectoryScanner | ( |  | ) |

Constructs directory scanner for iterating over a directory.

clan::File::File | ( |  | ) |

Constructs a file object.

clan::File::File | ( | const std::string & | filename | ) |

Constructs a file object read only.

PathHelp::normalize(filename, PathHelp::path_type_file) is called

clan::File::File | ( | const std::string & | filename,
|  | OpenMode | mode,
|  | unsigned int | access,
|  | unsigned int | share = `share_all`,
|  | unsigned int | flags = `0`
| ) |  |

Constructs a file object.

PathHelp::normalize(filename, PathHelp::path_type_file) is called

clan::FileSystem::FileSystem | ( |  | ) |

Constructs a file system.

clan::FileSystem::FileSystem | ( | FileSystemProvider * | provider | ) |

Constructs a FileSystem.

Parameters

  provider | = Virtual File Source

clan::FileSystem::FileSystem | ( | const std::string & | path,
|  | bool | is_zip_file = `false`
| ) |  |

Constructs a FileSystem.

Parameters

  path | = String
  is_zip_file | = bool

clan::IODevice::IODevice | ( |  | ) |

Constructs a null instance.

clan::IODevice::IODevice | ( | IODeviceProvider * | provider | ) |

Constructs a IODevice.

Parameters

  provider | = IODevice Provider

clan::MemoryDevice::MemoryDevice | ( |  | ) |

Constructs a memory I/O device.

clan::MemoryDevice::MemoryDevice | ( | DataBuffer & | data | ) |

Constructs a IODevice Memory.

Parameters

  data | = Data Buffer

clan::ZipArchive::ZipArchive | ( |  | ) |

Constructs or loads a ZIP archive.

Parameters

  filename | .zip archive to load.

clan::ZipArchive::ZipArchive | ( | IODevice & | input | ) |

Constructs a ZipArchive.

Parameters

  input | = IODevice

clan::ZipArchive::ZipArchive | ( | const std::string & | filename | ) |

Constructs a ZipArchive.

Parameters

  filename | = String Ref

clan::ZipArchive::ZipArchive | ( | const ZipArchive & | copy | ) |

Constructs a ZipArchive.

Parameters

  copy | = Zip Archive

clan::ZipFileEntry::ZipFileEntry | ( |  | ) |

clan::ZipFileEntry::ZipFileEntry | ( | const ZipFileEntry & | copy | ) |

Constructs a ZipFileEntry.

Parameters

  copy | = Zip File Entry

clan::ZipReader::ZipReader | ( | IODevice & | input | ) |

Constructs a ZipReader.

Parameters

  input | = IODevice

clan::ZipWriter::ZipWriter | ( | IODevice & | output,
|  | bool | storeFilenamesAsUTF8 = `false`
| ) |  |

Constructs a ZipWriter.

Parameters

  output | = IODevice
  storeFilenamesAsUTF8 | = bool

clan::DirectoryScanner::~DirectoryScanner | ( |  | ) |

Destructor.

clan::File::~File | ( |  | ) |

clan::FileSystem::~FileSystem | ( |  | ) |

virtual clan::FileSystemProvider::~FileSystemProvider | ( |  | ) |
| inline virtual

clan::IODevice::~IODevice | ( |  | ) |

virtual clan::IODeviceProvider::~IODeviceProvider | ( |  | ) |
| inline virtual

clan::ZipArchive::~ZipArchive | ( |  | ) |

clan::ZipFileEntry::~ZipFileEntry | ( |  | ) |

void clan::ZipArchive::add_file | ( | const std::string & | input_filename,
|  | const std::string & | filename_in_archive
| ) |  |

Adds a file to zip archive.

File is not added to zip file until it save() is called.

Parameters

  filename | Filename of file.

static std::string clan::PathHelp::add_trailing_slash | ( | const std::string & | path,
|  | PathType | path_type = `path_type_file`
| ) |  |
| static

Add trailing slash or backslash to path.

This function checks if a path already has a trailing slash/backslash and adds it if its missing.

Parameters

  path | The path to use
  path_type | The path type (of path)

Returns
  The converted path

void clan::ZipWriter::begin_file | ( | const std::string & | filename,
|  | bool | compress
| ) |  |

Begins file entry in the zip file.

void clan::File::close | ( |  | ) |

Close file.

static std::string clan::PathHelp::combine | ( | const std::string & | part1,
|  | const std::string & | part2,
|  | PathType | path_type = `path_type_file`
| ) |  |
| static

Concatenates two strings into one adding a trailing slash to first string if missing.

Parameters

  part1 | First part of path
  part2 | Second part of path
  path_type | The path type (of path)

static DataBuffer clan::ZLibCompression::compress | ( | const DataBuffer & | data,
|  | bool | raw = `true`,
|  | int | compression_level = `6`,
|  | CompressionMode | mode = `default_strategy`
| ) |  |
| static

static void clan::FileHelp::copy_file | ( | const std::string & | from,
|  | const std::string & | to,
|  | bool | copy_always
| ) |  |
| static

Copy a file.

Parameters

  from | Where to copy from
  to | Where to copy to
  copy_always | true = Copy, even if destination already exists. false = Do not copy if destination exists (throw a Exception)

static bool clan::Directory::create | ( | const std::string & | dir_name,
|  | bool | recursive = `false`
| ) |  |
| static

Create directory.

Parameters

  dir_name | = Directory name for create.
  recursive | = If true, function will create all directories in the path, otherwise only the last directory

Returns
  true on success or false on error.

IODevice clan::ZipArchive::create_file | ( | const std::string & | filename,
|  | bool | compress = `true`
| ) |  |

Creates a new file entry.

static DataBuffer clan::ZLibCompression::decompress | ( | const DataBuffer & | data,
|  | bool | raw = `true`
| ) |  |
| static

static void clan::FileHelp::delete_file | ( | const std::string & | filename | ) |
| static

Delete a file.

Parameters

  filename | File to delete

virtual IODeviceProvider* clan::IODeviceProvider::duplicate | ( |  | ) |
| pure virtual

Returns a new provider to the same resource.

IODevice clan::IODevice::duplicate | ( |  | ) |

Create a new IODevice referencing the same resource.

void clan::ZipWriter::end_file | ( |  | ) |

Ends the file entry.

static bool clan::FileHelp::file_exists | ( | const std::string & | filename | ) |
| static

Check if a file exists.

Parameters

  filename | File to check for existance

static std::string clan::Directory::get_appdata | ( | const std::string & | company_name,
|  | const std::string & | application_name,
|  | const std::string & | version,
|  | bool | create_dirs_if_missing = `true`
| ) |  |
| static

Returns the current user's roaming application data directory.

In Windows, this functions returns special folder directory CSIDL_APPDATA appended with the "company_name\application_name\version" string. A typical path would be "C:\Documents and Settings\username\Application Data\company_name\application_name\version\".
In OS X, this function returns the directory "~/Library/company_name/application_name/version/".
In Linux, this function returns the directory "~/.company_name/application_name/version/".

Parameters

  company_name | = Company name.
  application_name | = Application name.
  version | = Application version.
  create_dirs_if_missing | = If true, function will create all missing directories in the path.

Returns
  the current user's roaming application data directory.

std::string clan::ZipFileEntry::get_archive_filename | ( |  | ) | const

Returns the filename of file entry.

static std::string clan::PathHelp::get_basename | ( | const std::string & | fullname,
|  | PathType | path_type = `path_type_file`
| ) |  |
| static

Returns the basename part of a fullname.

param: fullname = The full path to use param: path_type = The path type

Returns
  The filename (excluding the extension)

static std::string clan::PathHelp::get_basepath | ( | const std::string & | fullname,
|  | PathType | path_type = `path_type_file`
| ) |  |
| static

Returns the path excluding the location and filename.

Parameters

  fullname | The full path name to use
  path_type | The path type

Returns
  The base path

If (path_type == path_type_virtual) or not using windows, then this function returns the path (excluding filename)

int64_t clan::ZipFileEntry::get_compressed_size | ( |  | ) |

Returns the compressed size of file entry.

int64_t clan::ZipReader::get_compressed_size | ( |  | ) | const

Returns the compressed size of the file entry.

static std::string clan::Directory::get_current | ( |  | ) |
| static

Get current directory.

Returns
  the current directory path.

const DataBuffer& clan::MemoryDevice::get_data | ( |  | ) | const

Retrieves the data buffer for the memory device.

DataBuffer& clan::MemoryDevice::get_data | ( |  | ) |

Get Data.

Returns
  data

DirectoryListing clan::FileSystem::get_directory_listing | ( | const std::string & | path_rel | ) |

Return directory listing for path.

std::string clan::DirectoryScanner::get_directory_path | ( |  | ) |

Gets the directory being scanned.

Returns
  Directory being scanned. (including the trailing slash)

static std::string clan::PathHelp::get_extension | ( | const std::string & | fullname,
|  | PathType | path_type = `path_type_file`
| ) |  |
| static

Returns the extension part of a fullname.

If no extension was found, an empty string is returned.

param: fullname = The full path to use param: path_type = The path type

Returns
  The extension

std::vector<ZipFileEntry> clan::ZipArchive::get_file_list | ( |  | ) |

List of file entries in archive.

std::vector<ZipFileEntry> clan::ZipArchive::get_file_list | ( | const std::string & | path | ) |

std::string clan::ZipReader::get_filename | ( |  | ) |

Returns the file name that was stored in the local file header.

static std::string clan::PathHelp::get_filename | ( | const std::string & | fullname,
|  | PathType | path_type = `path_type_file`
| ) |  |
| static

Returns the filename part of a fullname.

param: fullname = The full path to use param: path_type = The path type

Returns
  The filename

static std::string clan::PathHelp::get_fullname | ( | const std::string & | fullpath,
|  | const std::string & | filename,
|  | PathType | path_type = `path_type_file`
| ) |  |
| static

Create a fullname from parts.

param: fullpath = The full path to use param: filename = The filename to use param: path_type = The path type

Returns
  The full name

static std::string clan::PathHelp::get_fullname | ( | const std::string & | fullpath,
|  | const std::string & | filename,
|  | const std::string & | extension,
|  | PathType | path_type = `path_type_file`
| ) |  |
| static

Create a fullname from parts.

param: fullpath = The full path to use param: filename = The filename to use param: extension = The filename extension to use param: path_type = The path type

Returns
  The full name

static std::string clan::PathHelp::get_fullname | ( | const std::string & | location,
|  | const std::string & | basepath,
|  | const std::string & | filename,
|  | const std::string & | extension,
|  | PathType | path_type = `path_type_file`
| ) |  |
| static

Create a fullname from parts.

param: location = The location to use param: fullpath = The full path to use param: filename = The filename to use param: extension = The filename extension to use param: path_type = The path type

Returns
  The full name

static std::string clan::PathHelp::get_fullpath | ( | const std::string & | fullname,
|  | PathType | path_type = `path_type_file`
| ) |  |
| static

Returns the path including the location.

param: fullname = The full path to use (including filename) param: path_type = The path type

Returns
  The full path including the location (excluding filename)

virtual std::string clan::FileSystemProvider::get_identifier | ( |  | ) | const
| pure virtual

Get the identifier of this file source.

The exact format of this identifier depends on the implementation of the underlying filesystem and mounts

Returns
  the identifier

std::string clan::FileSystem::get_identifier | ( |  | ) | const

Get the identifier of this file source.

The exact format of this identifier depends on the implementation of the underlying filesystem and mounts

Returns
  the identifier

std::string clan::ZipFileEntry::get_input_filename | ( |  | ) | const

Returns the filename of file entry.

static std::string clan::Directory::get_local_appdata | ( | const std::string & | company_name,
|  | const std::string & | application_name,
|  | const std::string & | version,
|  | bool | create_dirs_if_missing = `true`
| ) |  |
| static

Returns the current user's local (nonroaming) application data directory.

In Windows, this functions returns special folder directory CSIDL_LOCAL_APPDATA appended with the "company_name\application_name\version" string. A typical path would be "C:\Documents and Settings\username\Local Settings\Application Data\company_name\application_name\version\".
In OS X, this function returns the directory "~/Library/company_name/application_name/version/".
In Linux, this function returns the directory "~/.company_name/application_name/version/".

Parameters

  company_name | = Company name.
  application_name | = Application name.
  version | = Application version.
  create_dirs_if_missing | = If true, function will create all missing directories in the path.

Returns
  the current user's local (nonroaming) application data directory.

* static std::string clan::PathHelp::get_location | ( | const std::string & | fullname,
|  | PathType | path_type = `path_type_file`
| ) |  |
| static

Returns the drive (C:) or share name ( \ \ computer \ share)

If (path_type == path_type_virtual) or not using windows, then this function always returns an empty string.

Parameters

  fullname | The full path name to use
  path_type | The path type

Returns
  The drive or share name

std::string clan::DirectoryScanner::get_name | ( |  | ) |

Gets the name of the current file.

Returns
  The name of the current found file.

virtual std::string clan::FileSystemProvider::get_path | ( |  | ) | const
| pure virtual

Return the path of this file source.

std::string clan::FileSystem::get_path | ( |  | ) | const

Returns a path to the file source for this file system.

std::string clan::DirectoryScanner::get_pathname | ( |  | ) |

Gets the pathname of the current file.

Returns
  The name of the current found file, including the directory path.

std::string clan::ZipArchive::get_pathname | ( | const std::string & | filename | ) |

Get full path to source:

virtual int clan::IODeviceProvider::get_position | ( |  | ) | const
| inline virtual

Returns the position in the data stream.

Returns -1 if the position is unknown.

int clan::IODevice::get_position | ( |  | ) | const

Returns the position in the data stream.

Returns -1 if the position is unknown.

Returns
  The size (-1 if position is unknown)

FileSystemProvider* clan::FileSystem::get_provider | ( |  | ) |

Returns the file source for this file system.

const IODeviceProvider* clan::IODevice::get_provider | ( |  | ) | const

Returns the provider for this object.

IODeviceProvider* clan::IODevice::get_provider | ( |  | ) |

Returns the provider for this object.

static std::string clan::Directory::get_resourcedata | ( | const std::string & | application_name,
|  | const std::string & | data_dir_name = `"Resources"`
| ) |  |
| static

Returns the application resource data directory.

In Windows, this function returns a data_dir_name subdirectory located at the executable. If the executable path is "C:\Program Files\My Application\MyApp.exe", then it will return the path "C:\Program Files\My Application\data_dir_name\".
In OS X, this function returns a "Resources" subdirectory inside the application bundle. For example, if the application executable path is "/Applications/MyApplication.app/Contents/MacOS/MyApplication", then it will return "/Applications/MyApplication.app/Contents/Resources/". If the executable is not in an application bundle, it will use the same behavior as in Windows; that is, it will return a data_dir_name subdirectory next to the executable.
In Linux, this function will return the directory "../share/application_name/" relative to the executable, so if it is located in "/usr/bin" it will return "/usr/share/application_name/"

Parameters

  application_name | = Application name.
  data_dir_name | = Data directory name.

Returns
  the application resource data directory.

virtual int clan::IODeviceProvider::get_size | ( |  | ) | const
| inline virtual

Returns the size of data stream.

Returns -1 if the size is unknown.

int clan::DirectoryScanner::get_size | ( |  | ) |

Gets the size of the current file.

Returns
  The size of the current found file.

int clan::IODevice::get_size | ( |  | ) | const

Returns the size of data stream.

Returns -1 if the size is unknown.

Returns
  The size (-1 if size is unknown)

int64_t clan::ZipFileEntry::get_uncompressed_size | ( |  | ) |

Returns the uncompressed size of file entry.

int64_t clan::ZipReader::get_uncompressed_size | ( |  | ) | const

Returns the uncompressed size of the file entry.

bool clan::ZipReader::has_data_descriptor | ( |  | ) | const

Returns true if the file entry is followed by a data descriptor.

bool clan::FileSystem::has_directory | ( | const std::string & | directory | ) |

Return true if the root of the filesystem contains the specified directory.

bool clan::FileSystem::has_file | ( | const std::string & | filename | ) |

Return true if the root of the filesystem contains the specified file.

virtual bool clan::FileSystemProvider::initialize_directory_listing | ( | const std::string & | path | ) |
| pure virtual

Initiate directory listing.

static bool clan::PathHelp::is_absolute | ( | const std::string & | path,
|  | PathType | path_type = `path_type_file`
| ) |  |
| static

Check if a path is absolute.

Parameters

  path | The path to check
  path_type | The path type (of path)

Returns
  true if path is absolute

bool clan::ZipFileEntry::is_directory | ( |  | ) | const

Is Directory.

Returns
  true = directory

bool clan::DirectoryScanner::is_directory | ( |  | ) |

Returns true if the current file is a directory.

Returns
  True if filename is a directory.

bool clan::DirectoryScanner::is_hidden | ( |  | ) |

Returns true if the file is hidden.

Returns
  True if filename is hidden.

bool clan::IODevice::is_little_endian | ( |  | ) | const

Returns true if the input source is in little endian mode.

Returns
  true if little endian

bool clan::FileSystem::is_mount | ( | const std::string & | mount_point | ) |

Returns true if a path is a mount point.

bool clan::FileSystem::is_null | ( |  | ) | const
| inline

Returns true if the file system is null.

bool clan::IODevice::is_null | ( |  | ) | const
| inline

Returns true if this object is invalid.

References clan::IODevice::impl.

bool clan::DirectoryScanner::is_readable | ( |  | ) |

Returns true if the file is readable by the current user.

Returns
  True if the file is readable.

static bool clan::PathHelp::is_relative | ( | const std::string & | path,
|  | PathType | path_type = `path_type_file`
| ) |  |
| static

Check if a path is relative.

Parameters

  path | The path to check
  path_type | The path type (of path)

Returns
  true if path is relative

static bool clan::Endian::is_system_64bit | ( |  | ) |
| static

Returns true if 64 bit system.

Returns
  True if 64 bit, false otherwise.

static bool clan::Endian::is_system_big | ( |  | ) |
| static

Returns true if big endian system.

Returns
  True if big endian system, false otherwise.

Referenced by clan::Endian::swap_if_big(), and clan::Endian::swap_if_little().

bool clan::DirectoryScanner::is_writable | ( |  | ) |

Returns true if the file is writable by the current user.

Returns
  True if the file is writable.

void clan::ZipArchive::load | ( | IODevice & | input | ) |

Loads the zip archive from a input device (done automatically at construction).

static std::string clan::PathHelp::make_absolute | ( | const std::string & | base_path,
|  | const std::string & | relative_path,
|  | PathType | path_type = `path_type_file`
| ) |  |
| static

Convert a relative path to an absolute path.

Parameters

  base_path | The base path (Does not require a trailing slash)
  relative_path | The relative path
  path_type | The path type

Returns
  The converted path

This function behaves differently depending on OS and path_type. In Windows, if the relative_path begins with a drive letter, and the driver letter differs from the base path, the path is converted to an absolute path using the current directory for that drive. Likewise, if the specified base path does not include a drive or its path is not absolute, the current drive and directory is added. The function converts all slashes to backslashes.

If the OS is unix based, there is no location (drive or share name) and the function also converts all backslashes to slashes.

If the type is path_type_virtual, the base path is required to be absolute. If it does not start in a slash, the function prefixes a slash to the path. The current drive or directory is never taken into account and all backslashes are converted to slashes.

This function calls normalise() on base_path and relative_path.

Example #1:

std::string str = PathHelp::make_absolute("ABD/DEF/", "GFX/Filename.txt", PathHelp::path_type_file);
On Linux: str = "/home/user/ABD/DEF/GFX/Filename.txt"
On Windows: str = "c:\user\ABD\DEF\GFX\Filename.txt"

Example #2:

std::string str = PathHelp::make_absolute("/ABD/DEF/", "../Filename.txt", PathHelp::path_type_file);
On Linux: str = "/ABD/Filename.txt"
On Windows: str = "c:\ABD\Filename.txt"

Example #3:

std::string str = PathHelp::make_absolute("/ABD/DEF/", "../Filename.txt", PathHelp::path_type_virtual);
On Linux: str = "/ABD/Filename.txt"
On Windows: str = "/ABD/Filename.txt"

static std::string clan::PathHelp::make_relative | ( | const std::string & | base_path,
|  | const std::string & | absolute_path,
|  | PathType | path_type = `path_type_file`
| ) |  |
| static

Converts an absolute path into a path relative to a base path.

Parameters

  base_path | The base path (Does not require a trailing slash)
  absolute_path | The absolute path
  path_type | The path type

Returns
  The converted path

This function is the inverse of FileHelp::make_absolute. Please see the detailed information for make_absolute for more information about behavior.

This function calls normalise() on the base_path and absolute_path-

Example #1 (Windows):

std::string str = PathHelp::make_relative("ABD/DEF/", "c:\user\ABD\Filename.txt", PathHelp::path_type_file);
On Windows: str = "..\Filename.txt"

void clan::FileSystem::mount | ( | const std::string & | mount_point,
|  | FileSystem | fs
| ) |  |

Mounts a file system at mount point.

This is only available if FileSystem was set Filenames starting with "mount_point" at the start will be replaced by the filesystem specified by "fs" (ie the the base_path is ignored) For example: FileSystem new_vfs(new MyFileSource("Hello")); vfs.mount("ABC", new_vfs); param: mount_point = Mount alias name to use param: fs = Filesystem to use

void clan::FileSystem::mount | ( | const std::string & | mount_point,
|  | const std::string & | path,
|  | bool | is_zip_file
| ) |  |

Mounts a file system at mount point.

Filenames starting with "mount_point" at the start will be replaced by the path specified by "path" (ie the the base_path is ignored) param: mount_point = Mount alias name to use param: path = Path which "mount_point" should point to param: is_zip_file = false, create as a FileSystemProvider_File, else create as a FileSystemProvider_Zip

bool clan::DirectoryScanner::next | ( |  | ) |

Find next file in directory scan.

Returns
  false if no more files was found.

virtual bool clan::FileSystemProvider::next_file | ( | DirectoryListingEntry & | entry | ) |
| pure virtual

Update directory listing item.

static std::string clan::PathHelp::normalize | ( | const std::string & | path,
|  | PathType | path_type = `path_type_file`
| ) |  |
| static

Normalize a path.

Parameters

  path | The path to use
  path_type | The path type (of the normalized path)

Returns
  The converted path

Converts all slashes and backslashes into their right type. Simplifies or removes all . and .., converting the path into its most readable form.

bool clan::File::open | ( | const std::string & | filename | ) |

Opens a file read only.

PathHelp::normalize(filename, PathHelp::path_type_file) is called

bool clan::File::open | ( | const std::string & | filename,
|  | OpenMode | mode,
|  | unsigned int | access,
|  | unsigned int | share = `share_all`,
|  | unsigned int | flags = `0`
| ) |  |

Opens a file.

PathHelp::normalize(filename, PathHelp::path_type_file) is called

virtual IODevice clan::FileSystemProvider::open_file | ( | const std::string & | filename,
|  | File::OpenMode | mode = `File::open_existing`,
|  | unsigned int | access = `File::access_read|File::access_write`,
|  | unsigned int | share = `File::share_all`,
|  | unsigned int | flags = `0`
| ) |  |
| pure virtual

Open file from this source.

param: filename = The filename to use param: mode = File::OpenMode modes param: access = File::AccessFlags flags param: share = File::ShareFlags flags param: flags = File::Flags flags

Returns
  The IODevice

IODevice clan::ZipArchive::open_file | ( | const std::string & | filename | ) |

Opens a file in the archive.

IODevice clan::FileSystem::open_file | ( | const std::string & | filename,
|  | File::OpenMode | mode = `File::open_existing`,
|  | unsigned int | access = `File::access_read`,
|  | unsigned int | share = `File::share_all`,
|  | unsigned int | flags = `0`
| ) |  | const

Opens a file.

param: mode = File::OpenMode modes param: access = File::AccessFlags flags param: share = File::ShareFlags flags param: flags = File::Flags flags

Returns
  The IODevice

ZipFileEntry& clan::ZipFileEntry::operator= | ( | const ZipFileEntry & | copy | ) |

Copy assignment operator.

virtual int clan::IODeviceProvider::peek | ( | void * | data,
|  | int | len
| ) |  |
| pure virtual

Peek data from device.

int clan::IODevice::peek | ( | void * | data,
|  | int | len
| ) |  |

Peek data from device (data is left in the buffer).

Parameters

  data | Data to receive
  len | Maximum length of data to receive

Returns
  size of data received.

int clan::IODevice::read | ( | void * | data,
|  | int | len,
|  | bool | receive_all = `true`
| ) |  |

Alias for receive(data, len, receive_all)

Parameters

  data | Data to receive
  len | Length to receive
  receive_all | true to receive all the data. false = receive part of the data, if it would block

Returns
  size of data received

static DataBuffer clan::File::read_bytes | ( | const std::string & | filename | ) |
| static

Loads an file into a byte buffer.

int64_t clan::ZipReader::read_file_data | ( | void * | data,
|  | int64_t | size,
|  | bool | read_all = `true`
| ) |  |

Reads some file data from the zip file.

float clan::IODevice::read_float | ( |  | ) |

Reads a float from input source.

Warning, this is not portable

Returns
  The float read.

int16_t clan::IODevice::read_int16 | ( |  | ) |

Reads a signed 16 bit integer from input source.

Returns
  The integer read.

int32_t clan::IODevice::read_int32 | ( |  | ) |

Reads a signed 32 bit integer from input source.

Returns
  The integer read.

int64_t clan::IODevice::read_int64 | ( |  | ) |

Reads a signed 64 bit integer from input source.

Returns
  The integer read.

int8_t clan::IODevice::read_int8 | ( |  | ) |

Reads a signed 8 bit integer from input source.

Returns
  The integer read.

bool clan::ZipReader::read_local_file_header | ( | bool | allow_data_descriptor = `false` | ) |

Begins reading a file entry in the zip file.

If allow_data_descriptor is set to false, an exception will be thrown if the file entry sizes and crc32 values are written in a data descriptor instead of the local file header.

Returns false if there are no more file entries.

std::string clan::IODevice::read_string_a | ( |  | ) |

Reads a string from the input source.

The binary format expected in the input source is first an uint32 telling the length of the string, and then the string itself.

Returns
  The string read.

std::string clan::IODevice::read_string_nul | ( |  | ) |

Reads a nul terminated string from the input source.

The binary format expected in the input source is a nul terminated string. (The NUL termintor is read, so that the file position is set after the NUL)

Returns
  The string read.

std::string clan::IODevice::read_string_text | ( | const char * | skip_initial_chars,
|  | const char * | read_until_chars,
|  | bool | allow_eof = `true`
| ) |  |

Reads a string from the input source where the source is a text file.

After reading the input source up to "read_until_chars", the file position is set to the first character that was not read. If the file contains NUL characters, then the input is read up to the NUL character, and the file position is set AFTER the NUL)

Parameters

  skip_initial_chars | Ignore any of these characters at the start of the string. NULL = Do not ignore any characters
  read_until_chars | Read from the input until any of these characters are found. NULL = Read until the end of the file
  allow_eof | Allow EOF

Returns
  The string read.

static std::string clan::File::read_text | ( | const std::string & | filename | ) |
| static

Loads an UTF-8 text file into a string.

uint16_t clan::IODevice::read_uint16 | ( |  | ) |

Reads an unsigned 16 bit integer from input source.

Returns
  The integer read.

uint32_t clan::IODevice::read_uint32 | ( |  | ) |

Reads an unsigned 32 bit integer from input source.

Returns
  The integer read.

uint64_t clan::IODevice::read_uint64 | ( |  | ) |

Reads an unsigned 64 bit integer from input source.

Returns
  The integer read.

uint8_t clan::IODevice::read_uint8 | ( |  | ) |

Reads an unsigned 8 bit integer from input source.

Returns
  The integer read.

virtual int clan::IODeviceProvider::receive | ( | void * | data,
|  | int | len,
|  | bool | receive_all = `true`
| ) |  |
| pure virtual

Receive data from device.

int clan::IODevice::receive | ( | void * | data,
|  | int | len,
|  | bool | receive_all = `true`
| ) |  |

Receive data from device.

Parameters

  data | Data to receive
  len | Length to receive
  receive_all | true to receive all the data. false = receive part of the data, if it would block

Returns
  size of data received

static bool clan::Directory::remove | ( | const std::string & | dir_name,
|  | bool | delete_files = `false`,
|  | bool | delete_sub_directories = `false`
| ) |  |
| static

Remove directory.

Parameters

  dir_name | = Directory name for delete.
  delete_files | = If true, function will delete files.
  delete_sub_directories | = If true, function will delete subdirectories too.

Returns
  true on success or false on error.

static std::string clan::PathHelp::remove_trailing_slash | ( | const std::string & | path | ) |
| static

Remove trailing slash or backslash from path.

This function checks if a path has a trailing slash/backslash and removes it if needed.

Parameters

  path | The path to use

Returns
  The converted path

static bool clan::Directory::rename | ( | const std::string & | old_name,
|  | const std::string & | new_name
| ) |  |
| static

Rename directory.

Parameters

  old_name | = Old name of the directory to be renamed.
  new_name | = New directory name.

Returns
  true on success or false on error.

void clan::ZipArchive::save | ( |  | ) |

Saves zip archive.

Parameters

  filename | Filename of zip archive. Must not be used to save to the same as loaded from.

If no filename parameter was passed, it will modify the zip archive loaded at construction time. It does this by creating a temporary file, saving the new archive, deletes the old one and renames the temp file to the original archive filename.

If the archive was created instead of loaded, a filename must be specify a filename. Likewise, if saving to same archive as loaded from, a filename must not be specified. Doing so will cause the save operation to fail.

void clan::ZipArchive::save | ( | const std::string & | filename | ) |

Save.

Parameters

  filename | = the filename to save to

void clan::ZipArchive::save | ( | IODevice | iodev | ) |

Save.

Parameters

  iodev | = The file to save to

bool clan::DirectoryScanner::scan | ( | const std::string & | pathname | ) |

Selects the directory to scan through.

Selects the directory to scan through

Parameters

  pathname | Path to the directory to scan (without trailing slash)

Returns
  true if the directory can be accessed.

bool clan::DirectoryScanner::scan | ( | const std::string & | pathname,
|  | const std::string & | pattern
| ) |  |

Selects the directory to scan through.

Selects the directory to scan through and use a matching pattern on the files.

WIN32: The pattern is normal DOS pattern matching ("*.*", ?) Unix: The pattern is normal pattern matching (*, ?)

Parameters

  pathname | Path to the directory to scan (without trailing slash)
  pattern | Pattern to match files against.

Returns
  true if the directory can be accessed.

virtual bool clan::IODeviceProvider::seek | ( | int | ,
|  | IODevice::SeekMode |
| ) |  |
| inline virtual

Seek in data stream.

bool clan::IODevice::seek | ( | int | position,
|  | SeekMode | mode = `seek_set`
| ) |  |

Seek in data stream.

Parameters

  position | Position to use (usage depends on the seek mode)
  mode | Seek mode

Returns
  false = Failed

virtual int clan::IODeviceProvider::send | ( | const void * | data,
|  | int | len,
|  | bool | send_all = `true`
| ) |  |
| pure virtual

Send data to device.

int clan::IODevice::send | ( | const void * | data,
|  | int | len,
|  | bool | send_all = `true`
| ) |  |

Send data to device.

If the device databuffer is too small, it will be extended (ie grow memory block size or file size)

Parameters

  data | Data to send
  len | Length to send
  send_all | true to send all the data. false = send part of the data, if it would block

Returns
  size of data sent

void clan::ZipFileEntry::set_archive_filename | ( | const std::string & | filename | ) |

Sets the filename of the file inside the archive.

void clan::IODevice::set_big_endian_mode | ( |  | ) |

Changes input data endianess to big endian mode. (Default is little endian)

static bool clan::Directory::set_current | ( | const std::string & | dir_name | ) |
| static

Change current directory.

Parameters

  dir_name | = Directory name to change to.

Returns
  true on success or false on error.

void clan::ZipReader::set_data_descriptor_data | ( | int64_t | compressed_size,
|  | int64_t | uncompressed_size,
|  | uint32_t | crc32
| ) |  |

Informs the zip reader what the data descriptor contains.

void clan::ZipFileEntry::set_directory | ( | bool | is_directory | ) |

Set directory.

Parameters

  is_directory | = bool

void clan::ZipFileEntry::set_input_filename | ( | const std::string & | filename | ) |

Sets the filename of the file to be added to the archive.

void clan::IODevice::set_little_endian_mode | ( |  | ) |

Changes input data endianess to little endian mode. This is the default setting.

void clan::IODevice::set_system_mode | ( |  | ) |

Changes input data endianess to the local systems mode.

static std::vector<std::string> clan::PathHelp::split_basepath | ( | const std::string & | fullname,
|  | PathType | path_type = `path_type_file`
| ) |  |
| static

Splits the path, excluding the location, into parts.

param: fullname = The full path name to use param: path_type = The path type

Returns
  The split path

static void clan::Endian::swap | ( | void * | data,
|  | int | type_size,
|  | int | total_times = `1`
| ) |  |
| static

Swaps larger amounts of data between little and big endian.

Parameters

  data | Data to be swapped.
  type_size | Size of datatype to be swapped. (Must be an even number)
  total_times | Number of 'type_size' size data chunks to be swapped.

Referenced by clan::Endian::swap_if_big(), and clan::Endian::swap_if_little().

static void clan::Endian::swap_if_big | ( | void * | data,
|  | int | type_size,
|  | int | total_times = `1`
| ) |  |
| inline static

References clan::Endian::is_system_big(), and clan::Endian::swap().

static void clan::Endian::swap_if_little | ( | void * | data,
|  | int | type_size,
|  | int | total_times = `1`
| ) |  |
| inline static

References clan::Endian::is_system_big(), and clan::Endian::swap().

void clan::IODevice::throw_if_null | ( |  | ) | const

Throw an exception if this object is invalid.

void clan::FileSystem::unmount | ( | const std::string & | mount_point | ) |

Unmount a file system.

param: mount_point = The mount point to unmount

int clan::IODevice::write | ( | const void * | data,
|  | int | len,
|  | bool | send_all = `true`
| ) |  |

Alias for send(data, len, send_all)

Parameters

  data | Data to send
  len | Length to send
  send_all | true to send all the data. false = send part of the data, if it would block

Returns
  size of data sent

static void clan::File::write_bytes | ( | const std::string & | filename,
|  | const DataBuffer & | bytes
| ) |  |
| static

Saves a byte buffer to file.

void clan::ZipWriter::write_file_data | ( | const void * | data,
|  | int64_t | size
| ) |  |

Writes some file data to the zip file.

void clan::IODevice::write_float | ( | float | data | ) |

Writes a float to output source.

Parameters

  data | = Float to write

Warning, this is not portable.

void clan::IODevice::write_int16 | ( | int16_t | data | ) |

Writes a signed 16 bit integer to output source.

Parameters

  data | Integer to write

void clan::IODevice::write_int32 | ( | int32_t | data | ) |

Writes a signed 32 bit integer to output source.

Parameters

  data | Integer to write

void clan::IODevice::write_int64 | ( | int64_t | data | ) |

Writes a signed 64 bit integer to output source.

Parameters

  data | Integer to write

void clan::IODevice::write_int8 | ( | int8_t | data | ) |

Writes a signed 8 bit integer to output source.

Parameters

  data | Integer to write

void clan::IODevice::write_string_a | ( | const std::string & | str | ) |

Writes a string to the output source.

Parameters

  str | String to write

The binary format written to the output source is first an uint32 telling the length of the string, and then the string itself.

void clan::IODevice::write_string_nul | ( | const std::string & | str | ) |

Writes a nul terminated string to the output source.

Parameters

  str | String to write

The binary format written to the output source is the string content followed by the NUL character.

void clan::IODevice::write_string_text | ( | const std::string & | str | ) |

Writes a text string to the output source.

Parameters

  str | String to write

The binary format written to the output source is the string content appended with a native newline. On Windows the newline is CR+LF sequence and on other platforms it is only LF character. This function is intended for use with text files.

static void clan::File::write_text | ( | const std::string & | filename,
|  | const std::string & | text,
|  | bool | write_bom = `false`
| ) |  |
| static

Saves an UTF-8 text string to file.

void clan::ZipWriter::write_toc | ( |  | ) |

Writes the table of contents part of the zip file.

void clan::IODevice::write_uint16 | ( | uint16_t | data | ) |

Writes an unsigned 16 bit integer to output source.

Parameters

  data | Integer to write

void clan::IODevice::write_uint32 | ( | uint32_t | data | ) |

Writes an unsigned 32 bit integer to output source.

Parameters

  data | Integer to write

void clan::IODevice::write_uint64 | ( | uint64_t | data | ) |

Writes an unsigned 64 bit integer to output source.

Parameters

  data | Integer to write

void clan::IODevice::write_uint8 | ( | uint8_t | data | ) |

Writes an unsigned 8 bit integer to output source.

Parameters

  data | Integer to write

## Variable Documentation

std::shared_ptr<IODevice_Impl> clan::IODevice::impl
| protected

Referenced by clan::IODevice::is_null().

## Friends

friend class ZipArchive
| friend

friend class ZipIODevice_FileEntry
| friend