Classes | Functions
System module

Base module of cpp3ds, defining various utilities. More...

Classes

class  cpp3ds::Clock
 Utility class that measures the elapsed time. More...
 
class  cpp3ds::FileInputStream
 Implementation of input stream based on a file. More...
 
class  cpp3ds::FileSystem
 
class  cpp3ds::I18n
 
class  cpp3ds::InputStream
 Abstract class for custom file input streams. More...
 
class  cpp3ds::LinearAllocator< T >
 This allocator class is useful for when you want to use a STL container (e.g. More...
 
class  cpp3ds::Lock
 Automatic wrapper for locking and unlocking mutexes. More...
 
class  cpp3ds::MemoryInputStream
 Implementation of input stream based on a memory chunk. More...
 
class  cpp3ds::Mutex
 Blocks concurrent access to shared resources from multiple threads. More...
 
class  cpp3ds::NonCopyable
 Utility class that makes any derived class non-copyable. More...
 
class  cpp3ds::String
 Utility string class that automatically handles conversions between types and encodings. More...
 
class  cpp3ds::Thread
 Utility class to manipulate threads. More...
 
class  cpp3ds::ThreadLocal
 Defines variables with thread-local storage. More...
 
class  cpp3ds::ThreadLocalPtr< T >
 Pointer to a thread-local variable. More...
 
class  cpp3ds::Time
 Represents a time value. More...
 
class  cpp3ds::Utf< N >
 Utility class providing generic functions for UTF conversions. More...
 
class  cpp3ds::Vector2< T >
 Utility template class for manipulating 2-dimensional vectors. More...
 
class  cpp3ds::Vector3< T >
 Utility template class for manipulating 3-dimensional vectors. More...
 

Functions

void cpp3ds::sleep (Time duration)
 Make the current thread sleep for a given duration. More...
 
std::ostream & cpp3ds::err ()
 Standard stream used by SFML to output warnings and errors. More...
 

Detailed Description

Base module of cpp3ds, defining various utilities.

It provides vector classes, unicode strings and conversion functions, threads and mutexes, timing classes.

Function Documentation

cpp3ds::err ( )

Standard stream used by SFML to output warnings and errors.

By default, cpp3ds::err() outputs to the same location as std::cerr, (-> the stderr descriptor) which is the console if there's one available.

It is a standard std::ostream instance, so it supports all the insertion operations defined by the STL (operator <<, manipulators, etc.).

cpp3ds::err() can be redirected to write to another output, independently of std::cerr, by using the rdbuf() function provided by the std::ostream class.

Example:

// Redirect to a file
std::ofstream file("sfml-log.txt");
std::streambuf* previous = cpp3ds::err().rdbuf(file.rdbuf());
// Redirect to nothing
cpp3ds::err().rdbuf(NULL);
// Restore the original output
cpp3ds::err().rdbuf(previous);
Returns
Reference to std::ostream representing the SFML error stream
void cpp3ds::sleep ( Time  duration)

Make the current thread sleep for a given duration.

cpp3ds::sleep is the best way to block a program or one of its threads, as it doesn't consume any CPU power.

Parameters
durationTime to sleep