Utilities
Modules | |
Containers | |
Classes | |
class | csAnsiParser |
Helper to parse a string for ANSI codes. More... | |
class | csBitmaskToString |
Small helper to get a "pretty" string for a combination of bit masks. More... | |
struct | csCtoW |
Helper class to convert char* (UTF-8 encoded )to wchar_t* strings for use as function parameters. More... | |
struct | csEndianSwap4 |
struct | csEndianSwap8 |
class | csFmtDefaultReader< T > |
Standard format string source for csPrintfFormatter. More... | |
class | csFmtDefaultWriter< T > |
Standard formatted string destination for csPrintfFormatter. More... | |
struct | csOptionDescription |
Configuration option description. More... | |
class | csPrintfFormatter< Twriter, Treader > |
Templated class for printf()-style string formatting. More... | |
class | csUnicodeTransform |
Contains functions to convert between several UTF encodings. More... | |
struct | csVariant |
Variant, means that type of contained data is set at runtime. More... | |
struct | csWtoC |
Helper class to convert wchar_t* to char* (UTF-8 encoded) strings for use as function parameters. More... | |
struct | iCommandLineParser |
A utility class that makes it easier to parse the command line. More... | |
struct | iCommandLineParser |
A utility class that makes it easier to parse the command line. More... | |
struct | iConfigFile |
Configuration file interface. More... | |
struct | iConfigFile |
Configuration file interface. More... | |
struct | iConfigIterator |
Iterator which allows sequential access to configuration information contained in an iConfigFile object. More... | |
struct | iConfigIterator |
Iterator which allows sequential access to configuration information contained in an iConfigFile object. More... | |
struct | iConfigManager |
The configuration manager is used to make a number of iConfigFile object appear like a single object. More... | |
struct | iConfigManager |
The configuration manager is used to make a number of iConfigFile object appear like a single object. More... | |
struct | iDataBuffer |
The iDataBuffer interface can be used to exchange buffers with abstract data between plugins. More... | |
struct | iDataBuffer |
The iDataBuffer interface can be used to exchange buffers with abstract data between plugins. More... | |
struct | iObject |
This interface is an SCF interface for encapsulating csObject. More... | |
struct | iObjectIterator |
This is an iterator for child objects of a csObject. More... | |
struct | iObjectIterator |
This is an iterator for child objects of a csObject. More... | |
struct | iObjectNameChangeListener |
A callback that you can implement to get notified of name changes in an iObject. More... | |
struct | iPluginConfig |
Interface to a configurator object. More... | |
struct | iString |
This is a SCF-compatible interface for csString. More... | |
struct | iString |
This is a SCF-compatible interface for csString. More... | |
struct | iStringArray |
This is an SCF-compatible interface for csStringArray. More... | |
struct | iStringArray |
This is an SCF-compatible interface for csStringArray. More... | |
struct | iStringSet |
The string set is a collection of unique strings. More... | |
struct | iStringSet |
The string set is a collection of unique strings. More... | |
Defines | |
#define | CS_BITMASKTOSTR_MASK_TABLE_BEGIN(tableName) static const csBitmaskToString::MaskNames tableName[] = { |
Helper macro to begin a bitmask-to-name table suitable for csBitmaskToString::GetStr();. | |
#define | CS_BITMASKTOSTR_MASK_TABLE_DEFINE(def) {def, #def}, |
Helper macro to add an entry to a bitmask-to-name table that is a #define. | |
#define | CS_BITMASKTOSTR_MASK_TABLE_END |
Helper macro to enf a bitmask-to-name table. | |
#define | CS_GET_CHILD_OBJECT(object, Interface) |
You can use this macro to get a child object from a csObject. | |
#define | CS_GET_FIRST_NAMED_CHILD_OBJECT(object, Interface, name) |
This is the same as CS_GET_CHILD_OBJECT, but stops at the first object with the given name, even if it does not implement the requested interface. | |
#define | CS_GET_NAMED_CHILD_OBJECT(object, Interface, name) |
You can use this macro to get a child object with the given name and interface from a csObject. | |
#define | CS_UC_MAX_MAPPED 3 |
A complex mapping (uppercase, lowercase, fold) for a Unicode code point expands to at maximum this number of code points. | |
#define | CS_UC_MAX_UTF16_ENCODED 2 |
An Unicode code point as UTF16 is at maximum encoded to this number of code units. | |
#define | CS_UC_MAX_UTF32_ENCODED 1 |
An Unicode code point as UTF32 is at maximum encoded to this number of code units. | |
#define | CS_UC_MAX_UTF8_ENCODED 4 |
An Unicode code point as UTF8 is at maximum encoded to this number of code units. | |
#define | csQroundSure(x) (int ((x) + ((x < 0) ? -0.5 : +0.5))) |
Typedefs | |
typedef unsigned long | csStringID |
An identifier for a string. | |
typedef uint16 | utf16_char |
A single char in a UTF16 encoded string. | |
typedef uint32 | utf32_char |
A single char in a UTF32 encoded string. | |
typedef uint8 | utf8_char |
A single char in a UTF8 encoded string. | |
Enumerations | |
enum | { csUcMapSimple = (1 << 0) } |
Flags influencing the behaviour of MapToUpper, MapToLower and MapToFold. More... | |
enum | csDocumentNodeType { CS_NODE_DOCUMENT = 1, CS_NODE_ELEMENT, CS_NODE_COMMENT, CS_NODE_UNKNOWN, CS_NODE_TEXT, CS_NODE_DECLARATION } |
Possible node types for iDocumentNode. More... | |
enum | csVariantType { CSVAR_LONG, CSVAR_BOOL, CSVAR_CMD, CSVAR_FLOAT, CSVAR_STRING } |
Types that can be contained within a variant. More... | |
Functions | |
int | cs_asprintf (char **, const char *,...) |
Portable implementation of asprintf(). | |
int | cs_snprintf (char *buf, size_t bufSize, const char *format,...) |
Portable implementation of snprintf(). | |
int | cs_vasprintf (char **, const char *, va_list) |
Portable implementation of vasprintf(). | |
int | cs_vsnprintf (char *, size_t, const char *, va_list) |
Portable implementation of vsnprintf(). | |
static float | csBigEndianFloat (float f) |
Convert a big-endian floating-point number to machine format. | |
static uint32 | csBigEndianLong (uint32 l) |
Convert a long from big-endian to machine format. | |
static uint64 | csBigEndianLongLong (uint64 l) |
Convert a longlong from big-endian to machine format. | |
static uint16 | csBigEndianShort (uint16 s) |
Convert a short from big-endian to machine format. | |
static int64 | csDoubleToLongLong (double d) |
Convert a double to a cross-platform 64-bit format (no endianess adjustments!). | |
char * | csExpandName (const char *iName) |
Expand a filename if it contains shortcuts. | |
int | csFindNearestPowerOf2 (int n) |
Finds the smallest number that is a power of two and is larger or equal to n. | |
void | csFindReplace (char *dest, const char *src, const char *search, const char *replace, int max) |
Given src and dest , which are already allocated, copy source to dest . | |
static int32 | csFloatToLong (float f) |
Convert a float to a cross-platform 32-bit format (no endianess adjustments!). | |
bool | csGlobMatches (const char *fName, const char *fMask) |
Perform shell-like filename globbing (pattern matching). | |
bool | csIsPowerOf2 (int n) |
Returns true if n is a power of two. | |
static float | csLittleEndianFloat (float f) |
Convert a little-endian floating-point number to machine format. | |
static uint32 | csLittleEndianLong (uint32 l) |
Convert a long from little-endian to machine format. | |
static uint64 | csLittleEndianLongLong (uint64 l) |
Convert a longlong from little-endian to machine format. | |
static uint16 | csLittleEndianShort (uint16 s) |
Convert a short from little-endian to machine format. | |
static int | csLog2 (int n) |
Find the log2 of 32bit argument. | |
static double | csLongLongToDouble (int64 i) |
Convert a 64-bit cross-platform double to native format (no endianess adjustments!). | |
static float | csLongToFloat (int32 l) |
Convert a 32-bit cross-platform float to native format (no endianess adjustments!). | |
void | csReplaceAll (char *dest, const char *src, const char *search, const char *replace, int max) |
Given src and dest , which are already allocated, copy source to dest . | |
void | csSplitPath (const char *iPathName, char *oPath, size_t iPathSize, char *oName, size_t iNameSize) |
Split a pathname into separate path and name. | |
int | csStrCaseCmp (char const *str1, char const *str2) |
Perform case-insensitive string comparison. | |
int | csStrNCaseCmp (char const *str1, char const *str2, size_t n) |
Perform case-insensitive string comparison of the first n characters of str1 and str2 . | |
char * | csStrNew (const wchar_t *s) |
Allocate a new char [] and copy an UTF-8 version of the string into the newly allocated storage. | |
char * | csStrNew (const char *s) |
Allocate a new char [] and copy the string into the newly allocated storage. | |
wchar_t * | csStrNewW (const char *s) |
Allocate a new widechar [] and copy the string converted from UTF-8 into the newly allocated storage. | |
wchar_t * | csStrNewW (const wchar_t *s) |
Allocate a new widechar [] and the string into the newly allocated storage. | |
Variables | |
csStringID const | csInvalidStringID = (csStringID) ~0 |
An invalid csStringID. |
Notes about string formatting in CrystalSpace
printf()-style formatting in CrystalSpace is usually backed by csPrintfFormatter<>, thus you can generally expect consistent behaviour for string formatting, across all platforms supported by CS.The format specifiers supported by csPrintfFormatter<> are basically the same as supported by glibc. Some notable aspects are summed up here.
- For
size_t
,intmax_t
,ptrdiff_t
andlonglong
arguments, the 'z
', 'j
', 't
' and 'll
' modifiers are supported. - char* strings ("<tt>%s</tt>") are expected to be UTF-8 encoded - likewise, char* formatting results will usually be encoded in UTF-8.
- To format explicitly sized types (like
uint32
) the PRIX99 macros should be used, e.g.:
Define Documentation
|
Helper macro to begin a bitmask-to-name table suitable for csBitmaskToString::GetStr();.
Definition at line 84 of file bitmasktostr.h. |
|
Helper macro to add an entry to a bitmask-to-name table that is a #define.
Definition at line 90 of file bitmasktostr.h. |
|
Value: {0, 0} \ }
Definition at line 93 of file bitmasktostr.h. |
|
Value: scfQueryInterfaceSafe<Interface>((object)->GetChild( \ scfInterfaceTraits<Interface>::GetID(), \ scfInterfaceTraits<Interface>::GetVersion())) The returned object will be IncRef'ed. This version requires a correctly set-up interface ID variable. |
|
Value: scfQueryInterfaceSafe<Interface>((object)->GetChild( \ scfInterfaceTraits<Interface>::GetID(), \ scfInterfaceTraits<Interface>::GetVersion(), \ name, true))
|
|
Value: scfQueryInterfaceSafe<Interface>((object)->GetChild( \ scfInterfaceTraits<Interface>::GetID(), \ scfInterfaceTraits<Interface>::GetVersion(), \ name)) The returned object will be IncRef'ed. |
|
A complex mapping (uppercase, lowercase, fold) for a Unicode code point expands to at maximum this number of code points.
Definition at line 50 of file csuctransform.h. |
|
An Unicode code point as UTF16 is at maximum encoded to this number of code units.
Definition at line 40 of file csuctransform.h. |
|
An Unicode code point as UTF32 is at maximum encoded to this number of code units.
Definition at line 45 of file csuctransform.h. |
|
An Unicode code point as UTF8 is at maximum encoded to this number of code units.
Definition at line 35 of file csuctransform.h. |
Typedef Documentation
|
An identifier for a string. This identifier is equivalent to the contents of a string: If two strings have the same content, they have get the same identifier. If they have different content, they get different identifiers. |
|
A single char in a UTF16 encoded string.
Definition at line 42 of file csunicode.h. |
|
A single char in a UTF32 encoded string.
Definition at line 44 of file csunicode.h. |
|
A single char in a UTF8 encoded string.
Definition at line 40 of file csunicode.h. |
Enumeration Type Documentation
|
Flags influencing the behaviour of MapToUpper, MapToLower and MapToFold.
Definition at line 55 of file csuctransform.h. |
|
Possible node types for iDocumentNode.
Definition at line 40 of file document.h. |
|
Types that can be contained within a variant.
Definition at line 29 of file pluginconfig.h. |
Function Documentation
|
Portable implementation of asprintf().
|
|
Portable implementation of snprintf().
|
|
Portable implementation of vasprintf().
|
|
Portable implementation of vsnprintf().
|
|
Convert a big-endian floating-point number to machine format.
Definition at line 79 of file csendian.h. References csEndianSwap4::b1, csEndianSwap4::b2, csEndianSwap4::b3, and csEndianSwap4::b4. |
|
Convert a long from big-endian to machine format.
Definition at line 71 of file csendian.h. Referenced by csGetBigEndianLong(), and csSetBigEndianLong(). |
|
Convert a longlong from big-endian to machine format.
Definition at line 53 of file csendian.h. References csEndianSwap8::b1, csEndianSwap8::b2, csEndianSwap8::b3, csEndianSwap8::b4, csEndianSwap8::b5, csEndianSwap8::b6, csEndianSwap8::b7, and csEndianSwap8::b8. |
|
Convert a short from big-endian to machine format.
Definition at line 75 of file csendian.h. Referenced by csGetBigEndianShort(), and csSetBigEndianShort(). |
|
Convert a double to a cross-platform 64-bit format (no endianess adjustments!).
Definition at line 184 of file csendian.h. |
|
Expand a filename if it contains shortcuts. Currently the following macros are recognised and expanded: '.', '~', '..', 'drive:' (on DOS/Win32/OS2)The returned filename is always absolute, i.e. it always starts from root. Return a string allocated with csStrNew(). |
|
Finds the smallest number that is a power of two and is larger or equal to n.
|
|
Given
But, do not copy
Definition at line 209 of file util.h. References csReplaceAll(). |
|
Convert a float to a cross-platform 32-bit format (no endianess adjustments!).
Definition at line 155 of file csendian.h. References csQroundSure. Referenced by csSetBigEndianFloat32(), and csSetLittleEndianFloat32(). |
|
Perform shell-like filename globbing (pattern matching).
The special token
|
|
Returns true if n is a power of two.
|
|
Convert a little-endian floating-point number to machine format.
Definition at line 124 of file csendian.h. References csEndianSwap4::b1, csEndianSwap4::b2, csEndianSwap4::b3, and csEndianSwap4::b4. Referenced by csConvertEndian(). |
|
Convert a long from little-endian to machine format.
Definition at line 116 of file csendian.h. Referenced by csConvertEndian(), csGetLittleEndianLong(), and csSetLittleEndianLong(). |
|
Convert a longlong from little-endian to machine format.
Definition at line 99 of file csendian.h. References csEndianSwap8::b1, csEndianSwap8::b2, csEndianSwap8::b3, csEndianSwap8::b4, csEndianSwap8::b5, csEndianSwap8::b6, csEndianSwap8::b7, and csEndianSwap8::b8. Referenced by csConvertEndian(). |
|
Convert a short from little-endian to machine format.
Definition at line 120 of file csendian.h. Referenced by csConvertEndian(), csGetLittleEndianShort(), and csSetLittleEndianShort(). |
|
Find the log2 of 32bit argument.
Definition at line 176 of file util.h. Referenced by csPrintfFormatter< Twriter, Treader >::Format(). |
|
Convert a 64-bit cross-platform double to native format (no endianess adjustments!).
Definition at line 196 of file csendian.h. |
|
Convert a 32-bit cross-platform float to native format (no endianess adjustments!).
Definition at line 166 of file csendian.h. Referenced by csGetBigEndianFloat32(), and csGetLittleEndianFloat32(). |
|
Given
But, do not copy Referenced by csFindReplace(). |
|
Split a pathname into separate path and name.
|
|
Perform case-insensitive string comparison.
Returns a negative number if Referenced by csStringArray::CaseInsensitiveCompare(), csStringBase::CompareNoCase(), csStringArray::FindCaseInsensitive(), CrystalSpace::DocumentHelper::NodeAttributeCompare::operator()(), and CrystalSpace::DocumentHelper::NodeNameCompare::operator()(). |
|
Perform case-insensitive string comparison of the first
Returns a negative number if the n-character prefix of Referenced by csStringBase::CompareNoCase(), csReporterHelper::ReportV(), and csStringBase::StartsWith(). |
|
Allocate a new char [] and copy an UTF-8 version of the string into the newly allocated storage.
|
|
Allocate a new char [] and copy the string into the newly allocated storage. This is a handy method for copying strings, in fact it is the C++ analogue of the strdup() function from string.h (strdup() is not present on some platforms). To free the pointer the caller should call delete[]. Referenced by csStringArrayElementHandler::Construct(), csPluginLoadRec::csPluginLoadRec(), csStrKey::csStrKey(), csWtoC::csWtoC(), csStringFast< LEN >::Detach(), DirectDetectionDevice::DirectDetectionDevice(), csStrKey::operator=(), csImageBase::SetName(), and csVariant::SetString(). |
|
Allocate a new widechar [] and copy the string converted from UTF-8 into the newly allocated storage.
|
|
Allocate a new widechar [] and the string into the newly allocated storage.
Referenced by csCtoW::csCtoW(). |
Variable Documentation
|
An invalid csStringID.
Definition at line 38 of file strset.h. Referenced by csStringHash::Contains(), csGetShaderVariableFromStack(), and csSimpleRenderMesh::csSimpleRenderMesh(). |
Generated for Crystal Space by doxygen 1.4.4