Bond 0.9
C++ Bond Runtime Library API Documentation
Loading...
Searching...
No Matches
I/O

These interfaces and their default implementations are used by Bond for performing I/O operations without making assumptions about what underlying I/O library is used. More...

Classes

class  Bond::InputStream
 An abstract interface for performing both unformatted and formatted input operations. More...
class  Bond::InputStreamAdaptor
 A wrapper around an InputStream that adds formatted input operations used within the Bond Standard Library. More...
class  Bond::MemoryInputStream
 A concrete implementation of InputStream that performs input operations from an in-memory buffer. More...
class  Bond::MemoryOutputStream
 A concrete implementation of OutputStream that performs output operations to an in-memory buffer. More...
class  Bond::MemoryStreamFactory
 A concrete implementation of StreamFactory that instantiates MemoryInputStreams for a fixed collection of DataViews. More...
class  Bond::OutputStream
 An abstract interface for performing both unformatted and formatted output operations. More...
class  Bond::OutputStreamAdaptor
 A wrapper around an OutputStream that adds formatted output operations used within the Bond Standard Library. More...
class  Bond::StdioFileHandle
 A handle to a stdio FILE* to ensure that the file is properly disposed using RAII. More...
class  Bond::StdioInputStream
 A concrete implementation of InputStream that performs input operations from a stdio FILE*. More...
class  Bond::StdioOutputStream
 A concrete implementation of OutputStream that performs output operations to a stdio FILE*. More...
class  Bond::StdioStreamFactory
 A concrete implementation of StreamFactory that creates instances of StdioInputStream and StdioOutputStream. More...
class  Bond::Stream
 A base interface for performing IO operations. More...
class  Bond::StreamFactory
 An abstract interface for creating file streams without being coupled to any particular concrete type of stream. More...

Typedefs

typedef Allocator::ObjectHandle< InputStream > Bond::InputStreamHandle
 An owning pointer to a dynamically allocated InputStream.
typedef Allocator::ObjectHandle< OutputStream > Bond::OutputStreamHandle
 An owning pointer to a dynamically allocated OutputStream.

Functions

BOND_API bool Bond::IsAbsolutePath (const StringView &path)
 Returns whether a path is absolute, that is whether it starts with a '/' or '\' separator, or with a drive letter prefix such as "C:".
BOND_API StringView Bond::GetDirectory (const StringView &path)
 Returns the directory part of a path, up to and including its last '/' or '\' separator, or an empty StringView if the path has no separator.
BOND_API void Bond::NormalizePath (const StringView &directory, const StringView &path, Vector< char > &result)
 Lexically normalizes the path formed by joining a directory and a path.

Detailed Description

These interfaces and their default implementations are used by Bond for performing I/O operations without making assumptions about what underlying I/O library is used.

Typedef Documentation

◆ InputStreamHandle

An owning pointer to a dynamically allocated InputStream.

◆ OutputStreamHandle

An owning pointer to a dynamically allocated OutputStream.

Function Documentation

◆ GetDirectory()

BOND_API StringView Bond::GetDirectory ( const StringView & path)

Returns the directory part of a path, up to and including its last '/' or '\' separator, or an empty StringView if the path has no separator.

Parameters
pathThe path whose directory is returned.

◆ IsAbsolutePath()

BOND_API bool Bond::IsAbsolutePath ( const StringView & path)

Returns whether a path is absolute, that is whether it starts with a '/' or '\' separator, or with a drive letter prefix such as "C:".

Parameters
pathThe path to be tested.

◆ NormalizePath()

BOND_API void Bond::NormalizePath ( const StringView & directory,
const StringView & path,
Vector< char > & result )

Lexically normalizes the path formed by joining a directory and a path.

The result uses '/' separators, contains no "." segments or repeated separators, and has "segment/.." pairs collapsed. Leading ".." segments are kept on relative paths and dropped at the root of absolute paths. A drive letter prefix, a root separator and a UNC "//" prefix are preserved. An empty result is written as ".". No file system calls are made, so the names need not refer to files, and symbolic links are not resolved.

Parameters
directoryA directory to prepend to path, with an implied separator between them. It may be empty.
pathThe path to be normalized.
resultReceives the null terminated normalized path. Its previous contents are discarded. No memory is allocated other than by result.