vytools.hpp

VyTools is a C and C++ library which makes often used tasks easier.
The vytools.hpp is for the C++ part. It defines the namespace vyt. All other declarations are in that namespace.
It contains basic types, some utility functions, base classes for non-create, non-assign, referent-counted or copy-on-write classes, exception, a basic stream and a char- and wide string.

Contents

Ptr Typeless pointer
Uint Unsigned 32-bit integer
Int Signed 32-bit integer
Zint Unsigned 64-bit integer
Float 32-bit floating point value
Char 8-bit character
Wide Unicode character
Tools Utility functions
NoCreate No-create class
NoAssign No-assignment class
RefData: Reference counted data
RefCount Reference counted class
Cow: copy-on-write refcounted object
const multi-byte encoding
stream read or write to string
StreamData: stored data of a stream
Stream: stream read or write class
File file manipulator class

Details

Ptr
Typeless pointer interchangeable with VytPtr
Uint
Unsigned 32-bit integer interchangeable with VytU
Int
Signed 32-bit integer interchangeable with VytI
Zint
Unsigned 64-bit integer interchangeable with VytZ
Float
32-bit floating point value interchangeable with VytF
Char
8-bit character
Wide
Unicode character
struct Tools
Utility functions
static void noIdx()
Throws exception for index out of bounds
static void notImpl( const char * meth )
Throws exception if a method is not implemented
meth The method name
static Ptr realloc( Ptr old, Uint size )
Memory reallocation \throws Exc if allocation fails
old Previous memory address or NULL
size New memory size
return Pointer to allocated memory or NULL if size is 0
static void debug(WString fmt, ... )
Write formatted string to stderr
fmt Format string as in printf
... Arguments as in printf
static Stream stdIn()
Standard input
return Stream handle
static Stream stdOut()
Standard output
return Stream handle
static Stream stdErr()
Standard error
return Stream handle
class NoCreate
No-create class (e.g singleton)
NoCreate()
Hidden default constructor
class NoAssign
No-assignment class
NoAssign( const NoAssign & )
Hidden copy constructor
NoAssign & operator = (const NoAssign & other);
Hidden assignment
struct RefData: public NoAssign
Reference counted data Base class to be used with RefCount
ref Number of references to this data
RefData()
Default constructor
virtual ~RefData()
Virtual destructor
class RefCount
Reference counted class
rd Reference to the real data stored in a RefData
RefCount()
Default constructor
RefCount( const RefCount & )
Copy constructor
RefCount & operator=( const RefCount & );
Assignment Increases the reference
virtual void ref( RefData * newRd )
change reference to newRd
newRd The new referenced data. Can be NULL
~RefCount()
Destructor Decreases the reference
class Cow: public RefCount
copy-on-write refcounted object
const multi-byte encoding
Uint stream( Stream s )
read or write to string
struct StreamData: public RefData
stored data of a stream
class Stream: public RefCount
stream read or write class
Stream( StreamData & data )
Construct with handle and operation
data The stream data
Uint op( Ptr data, Uint n )
read or write
class File
file manipulator class