CrystalSpace

Public API Reference

Main Page   Modules   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Related Pages  

Utilities


Compounds

struct  iCommandLineParser
 A utility class that makes it easier to parse the command line. More...

struct  iConfig
 Interface to a configurator object. More...

struct  iConfigFile
 Configuration file interface. 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  csCtoW
 Helper class to convert (UTF-8)widechar* to char* strings for use as function parameters. More...

struct  iDataBuffer
 The iDataBuffer interface can be used to exchange buffers with abstract data between plugins. More...

struct  iDataObject
 This is an iObject that contains a type-less data buffer. More...

struct  iDebugHelper
 Some object that wants to implement unit testing, debugging and/or benchmarking can implement this interface. More...

struct  iDocument
 Representation of a document containing a hierarchical structure of nodes. More...

struct  iDocumentAttribute
 An attribute for an iDocumentNode. More...

struct  iDocumentAttributeIterator
 An iterator over iDocumentNode attributes. More...

struct  iDocumentNode
 Representation of a node in a document. More...

struct  iDocumentNodeIterator
 An iterator over iDocumentNode. More...

struct  iDocumentSystem
 An iDocument factory. 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  csOptionDescription
 Configuration option description. More...

struct  csPluginPath
 This structure contains information about a plugin path. More...

class  csPluginPaths
 Class to manage a list of plugin paths. More...

struct  iReporter
 This is the interface for the error/message reporter plugin. More...

class  csReporterHelper
 Helper class for csReport(). More...

struct  iReporterIterator
 An iterator to iterate over all messages in the reporter. More...

struct  iReporterListener
 Implement this interface if you're interested in hearing about new messages on the reporter. More...

struct  iString
 This is a SCF-compatible interface for csString. More...

struct  iStringArray
 This is an SCF-compatible interface for csStringArray. More...

struct  iStringSet
 The string set is a list of strings, all with different content. 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 widechar* to char*(UTF-8) strings for use as function parameters. More...


Token list helper macros

The macros here provide an easy way to automatically build a token list useful for e.g.

parsers. The list of tokens have to be declared in an external file, surrounded by 'CS_TOKEN_LIST_TOKEN()'. The name of the file (full path!) has to be put in a macro named CS_TOKEN_ITEM_FILE. Optionally, the name of the function to init the token table can be set via CS_INIT_TOKEN_TABLE_NAME, default is 'init_token_table'. Note that the user defines CS_TOKEN_ITEM_FILE and CS_INIT_TOKEN_TABLE_NAME won't be undefined by this file; hence, if you want to build multiple token lists, you have to redefine those macros and include tokenlist.h again.

Example (from a real-world use): fire.tok:

 CS_TOKEN_LIST_TOKEN(PALETTE)
 // ... 

fire.h:

 class csFireLoader
 {
  csStringHash tokens;
 #define CS_TOKEN_ITEM_FILE "proctex/standard/fire.tok"
 #include "cstool/tokenlist.h"
 // ...
 };

fire.cpp:



#define CS_TOKEN_LIST_TOKEN(X)   XMLTOKEN_ ## X,
 A token list entry.

#define CS_INIT_TOKEN_TABLE_NAME_DEFAULT
#define CS_INIT_TOKEN_TABLE_NAME   init_token_table
enum  
void CS_INIT_TOKEN_TABLE_NAME (csStringHash &t)

Special character codes

#define CS_UC_CHAR_REPLACER   0xFFFD
 Replacer char.

#define CS_UC_INVALID   0xFFFF
 Invalid char.

#define CS_UC_IS_SURROGATE(C)   ((C & 0xFFFFF800) == 0x0000D800)
 Check whether a code is in the "high" or "low surrogate" range.

#define CS_UC_IS_HIGH_SURROGATE(C)   ((C & 0xFFFFFC00) == 0x0000DC00)
 Check whether a code is in the "high surrogate" range.

#define CS_UC_IS_LOW_SURROGATE(C)   ((C & 0xFFFFFC00) == 0x0000D800)
 Check whether a code is in the "low surrogate" range.

#define CS_UC_IS_INVALID(C)   ((C == CS_UC_INVALID) || (C == 0))
 Test whether a character code is invalid.

#define CS_UC_CHAR_HIGH_SURROGATE_FIRST   0xD800
 First char in the "high surrogate" range.

#define CS_UC_CHAR_HIGH_SURROGATE_LAST   0xDBFF
 Last char in the "high surrogate" range.

#define CS_UC_CHAR_LOW_SURROGATE_FIRST   0xDC00
 First char in the "low surrogate" range.

#define CS_UC_CHAR_LOW_SURROGATE_LAST   0xDFFF
 Last char in the "low surrogate" range.


iDebugHelper implementation support flags

#define CS_DBGHELP_UNITTEST   1
 supports UnitTest().

#define CS_DBGHELP_BENCHMARK   2
 supports Benchmark().

#define CS_DBGHELP_TXTDUMP   4
 supports non graphical Dump().

#define CS_DBGHELP_GFXDUMP   8
 supports graphical Dump().

#define CS_DBGHELP_STATETEST   16
 supports StateTest().


Document changeabilty

#define CS_CHANGEABLE_NEVER   0
 The document can not be changed, CreateRoot() is not supported.

#define CS_CHANGEABLE_NEWROOT   1
 The document only allows changes with a newly created root.

#define CS_CHANGEABLE_YES   2
 The document can be changed.


iReporter severity levels

#define CS_REPORTER_SEVERITY_BUG   0
 BUG severity level.

#define CS_REPORTER_SEVERITY_ERROR   1
 ERROR severity level.

#define CS_REPORTER_SEVERITY_WARNING   2
 WARNING severity level.

#define CS_REPORTER_SEVERITY_NOTIFY   3
 NOTIFY severity level.

#define CS_REPORTER_SEVERITY_DEBUG   4
 DEBUG severity level.


Specific sized types.

The following types should be used whenever you need a variable of a specific size (in bits).

If these types are already defined by system headers for a particular platform, then define CS_BUILTIN_SIZED_TYPES to avoid duplicate type definition here.

typedef unsigned char uint8
 unsigned 8-bit integer (0..255)

typedef char int8
 signed 8-bit integer (-128..127)

typedef unsigned short uint16
 unsigned 16-bit integer (0..65 535)

typedef short int16
 signed 16-bit integer (-32 768..32 767)

typedef unsigned int uint32
 unsigned 32-bit integer (0..4 294 967 295)

typedef int int32
 signed 32-bit integer (-2 147 483 648..2 147 483 647)


Shortcuts for normal C types

typedef unsigned int uint
 Default unsigned int.


Low-level shared library support

csLibraryHandle csLoadLibrary (char const *iName)
 Load a shared library and return a library handle, which is used later to query and unload the library.

void * csGetLibrarySymbol (csLibraryHandle Handle, char const *iName)
 Return a pointer to a symbol within given shared library.

bool csUnloadLibrary (csLibraryHandle Handle)
 Unload a shared library given its handle.

void csPrintLibraryError (char const *iModule)
 Print out the latest dynamic loader error.

void csSetLoadLibraryVerbose (bool)
 Control whether dynamic library loading messages are verbose or terse.

bool csGetLoadLibraryVerbose ()
 Query if failed dynamic library loads generate verbose messages.

csRef< iStringArraycsScanPluginDir (const char *dir, csRef< iStringArray > &plugins, bool recursive=true)
 Scan a given directory for plugins and return a list of the plugin native file names and their respective metadata.

csRef< iStringArraycsScanPluginDirs (csPluginPaths *dirs, csRef< iStringArray > &plugins)
 Scan some given directories for plugins.

csRef< iStringcsGetPluginMetadata (const char *fullPath, csRef< iDocument > &metadata)
 Retrive a plugin's metadata.


Helpers for dealing with endianness

uint64 big_endian_longlong (uint64 l)
 Convert a longlong from big-endian to machine format.

uint32 big_endian_long (uint32 l)
 Convert a long from big-endian to machine format.

uint16 big_endian_short (uint16 s)
 Convert a short from big-endian to machine format.

float big_endian_float (float f)
 Convert a big-endian floating-point number to machine format.

uint64 little_endian_longlong (uint64 l)
 Convert a longlong from little-endian to machine format.

uint32 little_endian_long (uint32 l)
 Convert a long from little-endian to machine format.

uint16 little_endian_short (uint16 s)
 Convert a short from little-endian to machine format.

float little_endian_float (float f)
 Convert a little-endian floating-point number to machine format.

int32 float2long (float f)
 Convert a float to a cross-platform 32-bit format (no endianess adjustments!).

float long2float (int32 l)
 Convert a 32-bit cross-platform float to native format (no endianess adjustments!).

int64 double2longlong (double d)
 Convert a double to a cross-platform 64-bit format (no endianess adjustments!).

double longlong2double (int64 i)
 Convert a 64-bit cross-platform double to native format (no endianess adjustments!).

short float2short (float f)
 Convert a float to a cross-platform 16-bit format (no endianess adjustments!).

float short2float (short s)
 Convert a 16-bit cross-platform float to native format (no endianess adjustments!).

uint64 convert_endian (uint64 l)
 Swap the bytes in a uint64 value.

int64 convert_endian (int64 l)
 Swap the bytes in a int64 value.

uint32 convert_endian (uint32 l)
 Swap the bytes in a uint32 value.

int32 convert_endian (int32 l)
 Swap the bytes in a int32 value.

int16 convert_endian (int16 s)
 Swap the bytes in a int16 value.

uint16 convert_endian (uint16 s)
 Swap the bytes in a uint16 value.

float convert_endian (float f)
 Swap the bytes in a float value.

uint16 get_le_short (void *buff)
 Read a little-endian short from address.

uint32 get_le_long (void *buff)
 Read a little-endian long from address.

float get_le_float32 (void *buff)
 Read a little-endian 32-bit float from address.

float get_le_float16 (void *buff)
 Read a little-endian 16-bit float from address.

void set_le_short (void *buff, uint16 s)
 Set a little-endian short on a address.

void set_le_long (void *buff, uint32 l)
 Set a little-endian long on a address.

void set_le_float32 (void *buff, float f)
 Set a little-endian 32-bit float on a address.

void set_le_float16 (void *buff, float f)
 Set a little-endian 16-bit float on a address.


System functions

bool csDefaultRunLoop (iObjectRegistry *)
 Implements a default run-loop for stand-alone applications.

bool csPlatformStartup (iObjectRegistry *)
 Platform-specific startup.

bool csPlatformShutdown (iObjectRegistry *)
 Platform-specific shutdown.

int csPrintf (const char *str,...)
 CS version of printf.

int csPrintfV (const char *str, va_list arg)
 CS version of vprintf.

int csFPutErr (const char *str)
 CS version of fputs (<str>, stderr).

csTicks csGetTicks ()
 Get the current tick count.

void csSleep (int)
 This function will freeze your application for given number of 1/1000 seconds.

csString csGetUsername ()
 Get the username of the account running the program.

csPtr< iConfigFilecsGetPlatformConfig (const char *key)
 Get a platform-specific config object.


Helpers to deal with native paths

csRef< iStringArraycsFindSystemRoots ()
 Get the list of root directories.

csString csGetConfigPath ()
 Get the installation path.

csPluginPathscsGetPluginPaths (const char *argv0)
 Get a list of directories where plugins are installed.

char * csExpandPath (const char *path)
 Expand a native path relative to the current directory.

csString csGetAppPath (const char *argv0)
 Return the absolute path of the executable.

csString csGetAppDir (const char *argv0)
 Return the directory in which the application executable resides.

csString csGetResourceDir (const char *argv0)
 Return the directory in which the application's resources reside.

bool csPathsIdentical (const char *path1, const char *path2)
 Check whether two native paths actually point to the same location.


Defines

#define CS_UC_MAX_UTF8_ENCODED   6
 An Unicode character encoded as UTF8 is at max encoded to this length.

#define CS_UC_MAX_UTF16_ENCODED   2
 An Unicode character encoded as UTF16 is at max encoded to this length.

#define CS_UC_MAX_UTF32_ENCODED   1
 An Unicode character encoded as UTF32 is at max encoded to this length.

#define CS_GET_CHILD_OBJECT(object, Interface)
 You can use this macro to get a child object from a csObject.

#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_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 csReport   csReporterHelper::Report
 Helper macro to use a reporter easily.

#define csReportV   csReporterHelper::ReportV
 Helper macro to use a reporter easily.


Typedefs

typedef uint32 CS_ID
 Used for uniquely generated id numbers XXX: remove this sometime.

typedef unsigned int csTicks
 Time in milli (1/1000) seconds XXX: should be moved to sysfunc.h.

typedef uint8 utf8_char
 A single char in a UTF8 encoded 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.


Enumerations

enum  csVariantType {
  CSVAR_LONG, CSVAR_BOOL, CSVAR_CMD, CSVAR_FLOAT,
  CSVAR_STRING
}
 Types that can be contained within a variant. 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...


Functions

char * csStrNew (const char *s)
 Allocate a new char [] and copy the string into the newly allocated storage.

char * csStrNew (const wchar_t *s)
 Allocate a new char [] and copy an UTF-8 version of the string into the newly allocated storage.

wchar_t * csStrNewW (const wchar_t *s)
 Allocate a new widechar [] and 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.

char * csExpandName (const char *iName)
 Expand a filename if it contains shortcuts.

void csSplitPath (const char *iPathName, char *oPath, size_t iPathSize, char *oName, size_t iNameSize)
 Split a pathname into separate path and name.

bool csGlobMatches (const char *fName, const char *fMask)
 This is a really simple function that does very nice "filename against filemask" comparisons.

int csFindNearestPowerOf2 (int n)
 Finds the smallest number that is a power of two and is larger or equal to n.

bool csIsPowerOf2 (int n)
 returns true if n is a power of two

int csLog2 (int n)
 Find the log2 of argument.

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.

void ReportError (const char *msgId, const char *description,...)
 Report error.

void ReportWarning (const char *msgId, const char *description,...)
 Report warning.

void ReportNotify (const char *msgId, const char *description,...)
 Report notification.

void ReportBug (const char *msgId, const char *description,...)
 Report bug.

void ReportDebug (const char *msgId, const char *description,...)
 Report debug.

void ReportV (iObjectRegistry *reg, int severity, char const *msgId, char const *description, va_list args)
 Helper function to use a reporter easily.

void Report (iObjectRegistry *reg, int severity, char const *msgId, char const *description,...)
 Helper function to use a reporter easily.


Define Documentation

#define CS_CHANGEABLE_NEVER   0
 

The document can not be changed, CreateRoot() is not supported.

Definition at line 61 of file document.h.

#define CS_CHANGEABLE_NEWROOT   1
 

The document only allows changes with a newly created root.

Definition at line 63 of file document.h.

#define CS_CHANGEABLE_YES   2
 

The document can be changed.

Definition at line 65 of file document.h.

#define CS_DBGHELP_BENCHMARK   2
 

supports Benchmark().

Definition at line 43 of file dbghelp.h.

#define CS_DBGHELP_GFXDUMP   8
 

supports graphical Dump().

Definition at line 51 of file dbghelp.h.

#define CS_DBGHELP_STATETEST   16
 

supports StateTest().

Definition at line 55 of file dbghelp.h.

#define CS_DBGHELP_TXTDUMP   4
 

supports non graphical Dump().

Definition at line 47 of file dbghelp.h.

#define CS_DBGHELP_UNITTEST   1
 

supports UnitTest().

Definition at line 39 of file dbghelp.h.

Referenced by csUtilDebugHelper::GetSupportedTests(), and csGeomDebugHelper::GetSupportedTests().

#define CS_GET_CHILD_OBJECT object,
Interface   
 

Value:

csPtr<Interface> ((Interface*)(object)->GetChild(               \
  scfInterface<Interface>::GetID(), scfInterface<Interface>::GetVersion()))
You can use this macro to get a child object from a csObject.

The returned object will be IncRef'ed. This version requires a correctly set-up interface ID variable.

Definition at line 36 of file object.h.

Referenced by csDataObject::GetData().

#define CS_GET_FIRST_NAMED_CHILD_OBJECT object,
Interface,
name   
 

Value:

csPtr<Interface> ((Interface*)(object)->GetChild(                       \
  scfInterface<Interface>::GetID(), scfInterface<Interface>::GetVersion(), \
  name, true))
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.

Definition at line 53 of file object.h.

#define CS_GET_NAMED_CHILD_OBJECT object,
Interface,
name   
 

Value:

csPtr<Interface> ((Interface*)(object)->GetChild(                       \
  scfInterface<Interface>::GetID(), scfInterface<Interface>::GetVersion(), \
  name))
You can use this macro to get a child object with the given name and interface from a csObject.

The returned object will be IncRef'ed.

Definition at line 44 of file object.h.

#define CS_REPORTER_SEVERITY_BUG   0
 

BUG severity level.

This is the worst thing that can happen. It means that some code detected a bug in Crystal Space.

Definition at line 42 of file reporter.h.

Referenced by iReporter::ReportBug(), and csReporterHelper::ReportV().

#define CS_REPORTER_SEVERITY_DEBUG   4
 

DEBUG severity level.

This is for debugging and it will usually generate an entry in some log.

Definition at line 68 of file reporter.h.

Referenced by iReporter::ReportDebug(), and csReporterHelper::ReportV().

#define CS_REPORTER_SEVERITY_ERROR   1
 

ERROR severity level.

There was an error of some kind. Usually this is an error while reading data.

Definition at line 49 of file reporter.h.

Referenced by csApplicationFramework::DisplayError(), iReporter::ReportError(), and csReporterHelper::ReportV().

#define CS_REPORTER_SEVERITY_NOTIFY   3
 

NOTIFY severity level.

Just a notification message.

Definition at line 61 of file reporter.h.

Referenced by csApplicationFramework::DisplayInfo(), iReporter::ReportNotify(), and csReporterHelper::ReportV().

#define CS_REPORTER_SEVERITY_WARNING   2
 

WARNING severity level.

There was some condition which is non fatal but is suspicious.

Definition at line 55 of file reporter.h.

Referenced by csReporterHelper::ReportV(), and iReporter::ReportWarning().

#define CS_TOKEN_LIST_TOKEN      XMLTOKEN_ ## X,
 

A token list entry.

Definition at line 95 of file tokenlist.h.

#define CS_UC_CHAR_HIGH_SURROGATE_FIRST   0xD800
 

First char in the "high surrogate" range.

Definition at line 69 of file csunicode.h.

Referenced by csUnicodeTransform::EncodeUTF16().

#define CS_UC_CHAR_HIGH_SURROGATE_LAST   0xDBFF
 

Last char in the "high surrogate" range.

Definition at line 71 of file csunicode.h.

#define CS_UC_CHAR_LOW_SURROGATE_FIRST   0xDC00
 

First char in the "low surrogate" range.

Definition at line 73 of file csunicode.h.

Referenced by csUnicodeTransform::EncodeUTF16().

#define CS_UC_CHAR_LOW_SURROGATE_LAST   0xDFFF
 

Last char in the "low surrogate" range.

Definition at line 75 of file csunicode.h.

#define CS_UC_CHAR_REPLACER   0xFFFD
 

Replacer char.

Definition at line 54 of file csunicode.h.

#define CS_UC_INVALID   0xFFFF
 

Invalid char.

Definition at line 56 of file csunicode.h.

#define CS_UC_IS_HIGH_SURROGATE      ((C & 0xFFFFFC00) == 0x0000DC00)
 

Check whether a code is in the "high surrogate" range.

Definition at line 61 of file csunicode.h.

Referenced by csUnicodeTransform::UTF16Decode(), csUnicodeTransform::UTF16Rewind(), and csUnicodeTransform::UTF16Skip().

#define CS_UC_IS_INVALID      ((C == CS_UC_INVALID) || (C == 0))
 

Test whether a character code is invalid.

Definition at line 66 of file csunicode.h.

Referenced by csUnicodeTransform::EncodeUTF16(), csUnicodeTransform::EncodeUTF32(), csUnicodeTransform::EncodeUTF8(), csUnicodeTransform::UTF16Decode(), csUnicodeTransform::UTF32Decode(), and csUnicodeTransform::UTF8Decode().

#define CS_UC_IS_LOW_SURROGATE      ((C & 0xFFFFFC00) == 0x0000D800)
 

Check whether a code is in the "low surrogate" range.

Definition at line 63 of file csunicode.h.

Referenced by csUnicodeTransform::UTF16Decode().

#define CS_UC_IS_SURROGATE      ((C & 0xFFFFF800) == 0x0000D800)
 

Check whether a code is in the "high" or "low surrogate" range.

Definition at line 59 of file csunicode.h.

Referenced by csUnicodeTransform::EncodeUTF16(), csUnicodeTransform::EncodeUTF32(), csUnicodeTransform::EncodeUTF8(), csUnicodeTransform::UTF16Decode(), csUnicodeTransform::UTF16Rewind(), and csUnicodeTransform::UTF8Decode().

#define CS_UC_MAX_UTF16_ENCODED   2
 

An Unicode character encoded as UTF16 is at max encoded to this length.

Definition at line 34 of file csuctransform.h.

#define CS_UC_MAX_UTF32_ENCODED   1
 

An Unicode character encoded as UTF32 is at max encoded to this length.

Definition at line 36 of file csuctransform.h.

#define CS_UC_MAX_UTF8_ENCODED   6
 

An Unicode character encoded as UTF8 is at max encoded to this length.

Definition at line 32 of file csuctransform.h.

#define csReport   csReporterHelper::Report
 

Helper macro to use a reporter easily.

Definition at line 344 of file reporter.h.

Referenced by csApplicationFramework::DisplayError(), and csApplicationFramework::DisplayInfo().

#define csReportV   csReporterHelper::ReportV
 

Helper macro to use a reporter easily.

Definition at line 348 of file reporter.h.


Typedef Documentation

typedef uint32 CS_ID
 

Used for uniquely generated id numbers XXX: remove this sometime.

Definition at line 115 of file cstypes.h.

typedef unsigned int csTicks
 

Time in milli (1/1000) seconds XXX: should be moved to sysfunc.h.

Definition at line 118 of file cstypes.h.

Referenced by csAnimationTemplate::AddFrame(), csSimplePixmap::Advance(), csUtilDebugHelper::Benchmark(), csGeomDebugHelper::Benchmark(), csVirtualClock::GetCurrentTicks(), csVirtualClock::GetElapsedTicks(), csAnimationTemplate::GetLength(), csMeshObject::PositionChild(), and csVirtualClock::Resume().

typedef short int16
 

signed 16-bit integer (-32 768..32 767)

Definition at line 65 of file cstypes.h.

Referenced by convert_endian().

typedef int int32
 

signed 32-bit integer (-2 147 483 648..2 147 483 647)

Definition at line 69 of file cstypes.h.

typedef char int8
 

signed 8-bit integer (-128..127)

Definition at line 61 of file cstypes.h.

typedef unsigned int uint
 

Default unsigned int.

Definition at line 123 of file cstypes.h.

typedef unsigned short uint16
 

unsigned 16-bit integer (0..65 535)

Definition at line 63 of file cstypes.h.

Referenced by big_endian_short(), convert_endian(), get_le_float16(), get_le_short(), little_endian_short(), and set_le_short().

typedef unsigned int uint32
 

unsigned 32-bit integer (0..4 294 967 295)

Definition at line 67 of file cstypes.h.

typedef unsigned char uint8
 

unsigned 8-bit integer (0..255)

Definition at line 59 of file cstypes.h.

typedef uint16 utf16_char
 

A single char in a UTF16 encoded string.

Definition at line 47 of file csunicode.h.

Referenced by csUnicodeTransform::EncodeUTF16(), csUnicodeTransform::UTF16Decode(), csUnicodeTransform::UTF16Rewind(), csUnicodeTransform::UTF16Skip(), csUnicodeTransform::UTF16to32(), csUnicodeTransform::UTF16to8(), csUnicodeTransform::UTF16toWC(), csUnicodeTransform::UTF32to16(), csUnicodeTransform::UTF32toWC(), csUnicodeTransform::UTF8to16(), csUnicodeTransform::UTF8toWC(), csUnicodeTransform::WCtoUTF16(), csUnicodeTransform::WCtoUTF32(), and csUnicodeTransform::WCtoUTF8().

typedef uint32 utf32_char
 

A single char in a UTF32 encoded string.

Definition at line 49 of file csunicode.h.

Referenced by csUnicodeTransform::EncodeUTF16(), csUnicodeTransform::EncodeUTF32(), csUnicodeTransform::EncodeUTF8(), csUnicodeTransform::UTF16Decode(), csUnicodeTransform::UTF16to32(), csUnicodeTransform::UTF32Decode(), csUnicodeTransform::UTF32Rewind(), csUnicodeTransform::UTF32Skip(), csUnicodeTransform::UTF32to16(), csUnicodeTransform::UTF32to8(), csUnicodeTransform::UTF32toWC(), csUnicodeTransform::UTF8Decode(), csUnicodeTransform::UTF8to32(), and csUnicodeTransform::WCtoUTF32().

typedef uint8 utf8_char
 

A single char in a UTF8 encoded string.

Definition at line 45 of file csunicode.h.

Referenced by csUnicodeTransform::EncodeUTF8(), csUnicodeTransform::UTF16to8(), csUnicodeTransform::UTF32to16(), csUnicodeTransform::UTF32to8(), csUnicodeTransform::UTF8Decode(), csUnicodeTransform::UTF8Rewind(), csUnicodeTransform::UTF8Skip(), csUnicodeTransform::UTF8to16(), csUnicodeTransform::UTF8to32(), csUnicodeTransform::UTF8toWC(), and csUnicodeTransform::WCtoUTF8().


Enumeration Type Documentation

enum csDocumentNodeType
 

Possible node types for iDocumentNode.

Enumeration values:
CS_NODE_DOCUMENT  Document.
CS_NODE_ELEMENT  Element.
CS_NODE_COMMENT  Comment.
CS_NODE_UNKNOWN  Unknown type.
CS_NODE_TEXT  Text.
CS_NODE_DECLARATION  Declaration.

Definition at line 41 of file document.h.

enum csVariantType
 

Types that can be contained within a variant.

Enumeration values:
CSVAR_LONG  long
CSVAR_BOOL  bool
CSVAR_CMD  a command
CSVAR_FLOAT  float
CSVAR_STRING  string

Definition at line 30 of file config.h.


Function Documentation

float big_endian_float float    f [inline, static]
 

Convert a big-endian floating-point number to machine format.

Definition at line 81 of file csendian.h.

uint32 big_endian_long uint32    l [inline, static]
 

Convert a long from big-endian to machine format.

Definition at line 72 of file csendian.h.

uint64 big_endian_longlong uint64    l [inline, static]
 

Convert a longlong from big-endian to machine format.

Definition at line 54 of file csendian.h.

uint16 big_endian_short uint16    s [inline, static]
 

Convert a short from big-endian to machine format.

Definition at line 76 of file csendian.h.

References uint16.

float convert_endian float    f [inline, static]
 

Swap the bytes in a float value.

Definition at line 248 of file csendian.h.

References little_endian_float().

uint16 convert_endian uint16    s [inline, static]
 

Swap the bytes in a uint16 value.

Definition at line 244 of file csendian.h.

References little_endian_short(), and uint16.

int16 convert_endian int16    s [inline, static]
 

Swap the bytes in a int16 value.

Definition at line 240 of file csendian.h.

References int16, and little_endian_short().

int32 convert_endian int32    l [inline, static]
 

Swap the bytes in a int32 value.

Definition at line 236 of file csendian.h.

References little_endian_long().

uint32 convert_endian uint32    l [inline, static]
 

Swap the bytes in a uint32 value.

Definition at line 232 of file csendian.h.

References little_endian_long().

int64 convert_endian int64    l [inline, static]
 

Swap the bytes in a int64 value.

Definition at line 228 of file csendian.h.

References little_endian_long().

uint64 convert_endian uint64    l [inline, static]
 

Swap the bytes in a uint64 value.

Definition at line 224 of file csendian.h.

References little_endian_long().

bool csDefaultRunLoop iObjectRegistry  
 

Implements a default run-loop for stand-alone applications.

This function implements a run-loop for stand-alone applications which do not provide their own run-loop. You only need to call this function if your application does not otherwise implement its own run-loop. For example, an existing Microsoft Windows-based application will already have a run-loop which processes the Windows event-queue, among other tasks. Such an application should not call this function, since doing so would interrupt the existing run-loop and prevent it from running. For each iteration of the run-loop, this function increments the Crystal Space virtual clock (if it is present in the shared-object registry at the time of the call to this function) and processes the Crystal Space event queue (which must be present in the shared-object registry at the time of the call to this function). This function only returns after a csevBroadcast message has been received in the Crystal Space event queue with command code cscmdQuit. The return value of this function indicates whether or not the run-loop was actually able to run. If there was a problem starting the run-loop, then `false' is returned, otherwise `true' is returned.

Referenced by csApplicationFramework::ProcessQueue().

char* csExpandName const char *    iName
 

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().

char* csExpandPath const char *    path
 

Expand a native path relative to the current directory.

Remarks:
The specified path must refer to a directory, rather than a file.
Caller is responsible to free the returend string with delete[] after using it.

Referenced by csPluginPaths::AddOnce().

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.

But, do not copy 'search', instead replace that with 'replace' string. max is size of dest.

csRef<iStringArray> csFindSystemRoots  
 

Get the list of root directories.

For instance in Unix it simply returns '/' but for Windows it may return a list of available drive letters.

int csFPutErr const char *    str
 

CS version of fputs (<str>, stderr).

It accepts UTF-8 strings and converts it, if required, to the platforms native codepage.

csString csGetAppDir const char *    argv0
 

Return the directory in which the application executable resides.

For MacOS/X, returns the directory in which the Cocoa application wrapper resides.

Remarks:
May return the empty string if some problem prevents determination of the application's directory.
This function is primarily intended for very low-level use before or during the initialization of CS core components. Past this point, applications and plugins should rather use iCommandLineParser::GetAppDir().
Parameters:
argv0  The first element of the argv[] array passed to main(). On many platforms, this is the only way to determine the actual location of the executable.

csString csGetAppPath const char *    argv0
 

Return the absolute path of the executable.

Remarks:
May return the empty string if some problem prevents determination of the application's path.
This function is primarily intended for very low-level use before or during the initialization of CS core components.
Parameters:
argv0  The first element of the argv[] array passed to main(). On many platforms, this is the only way to determine the actual location of the executable.

csString csGetConfigPath  
 

Get the installation path.

This returns the path where the system has been installed to. It has a limited use because mostly everything should be done through VFS which is installation directory - independent; but some initialization tasks still need this. May return the empty string if unable to determine the installation path.

void* csGetLibrarySymbol csLibraryHandle    Handle,
char const *    iName
 

Return a pointer to a symbol within given shared library.

Note that generally Crystal Space needs just one exported symbol from every shared library; the symbol is called <library>_scfInitialize. If your OS is short on features, you may implement querying of just this symbol.

bool csGetLoadLibraryVerbose  
 

Query if failed dynamic library loads generate verbose messages.

csPtr<iConfigFile> csGetPlatformConfig const char *    key
 

Get a platform-specific config object.

The data is stored in a platform-specific manner - e.g. in "Documents and Settings\Application Data" on Windows, or $HOME on Unix.

Parameters:
key  Used to distinguish different stored configurations.
Returns:
A config 'file'. Might return 0 on some platforms or in case an error occured.

csRef<iString> csGetPluginMetadata const char *    fullPath,
csRef< iDocument > &    metadata
 

Retrive a plugin's metadata.

Remarks:
`fullPath' should be either a string returned from csScanPluginDir() or csScanPluginDirs(), or a fully qualified native path of the plugin module. The path suffix should be either .csplugin if the plugin metadata is stored in an external .csplugin file, or it should be the standard suffix of shared libraries or bundles for the platform (for example, .so for Unix; .dll for Windows). If metadata is retrieved successfully for the specified plugin module, metadata.IsValid() will return true, and the `metadata' argument will reference an iDocument containing the data. If no metadata is located or an error occurrs while attempting to retrieve the metadata, metadata.IsValid() return false. If some type of reportable error or warning is encountered, it will be returned from the function as an iString. It is possible for a warning to be issued even if metadata was successfully retrieved. Finally, if metadata.IsValid() returns false and the returned iString is empty, then that indicates simply that the specified path does not correspond to a Crystal Space plugin module. This is a valid condition.

csPluginPaths* csGetPluginPaths const char *    argv0
 

Get a list of directories where plugins are installed.

Remarks:
Caller is responsible to free the list with delete after using it.

csString csGetResourceDir const char *    argv0
 

Return the directory in which the application's resources reside.

On many platforms, resources (such as plugin modules) reside in the same directory as the application itself. The default implementation returns the same value as csGetAppPath(), however platforms may want to override the default implementation if this behavior is unsuitable. For example, on MacOS/X, for GUI applications, resources reside in the "Resources" directory within the Cocoa application wrapper.

Remarks:
May return the empty string if some problem prevents determination of the resource path.
Parameters:
argv0  The first element of the argv[] array passed to main(). On many platforms, this is the only way to determine the actual location of the resources.

csTicks csGetTicks  
 

Get the current tick count.

Warning! Do NOT use this function for controlling game logic speed. To do that you should use the virtual clock (iVirtualClock) which you can get from the object registry. By using the virtual clock it will be possible to control the speed of your game and also to pause it if needed.

csString csGetUsername  
 

Get the username of the account running the program.

Returns the username of the owner of the process running the program. If the username can not be determined, then an empty string is returned.

bool csGlobMatches const char *    fName,
const char *    fMask
 

This is a really simple function that does very nice "filename against filemask" comparisons.

It understands even such things like "*a*.txt" or "*a?b*" or even "*" (wish I DOS could do it ...). No "[]" wildcards though :-)

Remarks:
If you want case-insensitive comparison, upcase (or lowercase, depends on personal taste) strings first.

bool csIsPowerOf2 int    n
 

returns true if n is a power of two

csLibraryHandle csLoadLibrary char const *    iName
 

Load a shared library and return a library handle, which is used later to query and unload the library.

iName is the FULL path to the library.

int csLog2 int    n [inline, static]
 

Find the log2 of argument.

Definition at line 157 of file util.h.

bool csPathsIdentical const char *    path1,
const char *    path2
 

Check whether two native paths actually point to the same location.

Use this instead of strcmp() or the like, as it may not suffice in all cases (e.g. on Windows paths names are case-insensitive, but on Unix they aren't).

Remarks:
Expects the paths to be fully qualified. Use csExpandPath() to ensure this.

Referenced by csPluginPaths::AddOnce().

bool csPlatformShutdown iObjectRegistry  
 

Platform-specific shutdown.

Some platforms on which Crystal Space runs need to perform their own shutdown processing. Typically, this function is automatically called by the higher-level csInitializer::DestroyApplication(), however if you are performing application shutdown manually, you should call it yourself. Returns `true' if shutdown processing was successful, otherwise `false'.

bool csPlatformStartup iObjectRegistry  
 

Platform-specific startup.

Some platforms on which Crystal Space runs need to perform their own startup processing. For instance, on some platforms, platform-specific "helper" objects may be placed in the shared-object registry for use by other platform-specific components. Typically, this function is automatically called by the higher-level csInitializer::CreateEnvironment(), however if you are performing application initialization manually, you should call it yourself. Returns `true' if startup initialization was successful, otherwise `false'.

int csPrintf const char *    str,
...   
 

CS version of printf.

It accepts UTF-8 strings and converts it, if required, to the platforms native codepage.

Referenced by csReporterHelper::ReportV().

int csPrintfV const char *    str,
va_list    arg
 

CS version of vprintf.

It accepts UTF-8 strings and converts it, if required, to the platforms native codepage.

Referenced by csReporterHelper::ReportV().

void csPrintLibraryError char const *    iModule
 

Print out the latest dynamic loader error.

This is not strictly required (and on some platforms its just a empty routine) but sometimes it helps to find problems.

csRef<iStringArray> csScanPluginDir const char *    dir,
csRef< iStringArray > &    plugins,
bool    recursive = true
 

Scan a given directory for plugins and return a list of the plugin native file names and their respective metadata.

Parameters:
dir  Directory to scan.
plugins  Native file names.
recursive  Recursively scan all subdirectories.
Remarks:
It is the responsibility of the caller to do any cleaning of metadata and plugins, if desired.
plugins can be 0, a string vector will be created in this case.
Returns:
If any errors occured, a vector of error descriptions.

csRef<iStringArray> csScanPluginDirs csPluginPaths   dirs,
csRef< iStringArray > &    plugins
 

Scan some given directories for plugins.

Accepts the same parameters as csScanPluginDir(), with the exception of dirs.

void csSetLoadLibraryVerbose bool   
 

Control whether dynamic library loading messages are verbose or terse.

When verbose, and a library fails to load, csPrintLibraryError() is invoked to emit detailed diagnostic information regarding the failure. If terse, then a simple message is emitted stating that the library failed to load and instructing the user to use the -verbose command-line option for more details. Verbose messages are enabled by default for debug builds; terse messages for optimized builds.

void csSleep int   
 

This function will freeze your application for given number of 1/1000 seconds.

The function is very inaccurate, so don't use it for accurate timing. It may be useful when the application is idle, to explicitly release CPU for other tasks in multi-tasking operating systems.

void csSplitPath const char *    iPathName,
char *    oPath,
size_t    iPathSize,
char *    oName,
size_t    iNameSize
 

Split a pathname into separate path and name.

Path delimiters are either '/', PATH_SEPARATOR and, for OS/2, MS-DOS and Win32 targets, ':'.

char* csStrNew const wchar_t *    s
 

Allocate a new char [] and copy an UTF-8 version of the string into the newly allocated storage.

Referenced by csPluginPaths::AddOnce(), csWtoC::csWtoC(), and csVariant::SetString().

char* csStrNew const char *    s
 

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[].

wchar_t* csStrNewW const char *    s
 

Allocate a new widechar [] and copy the string converted from UTF-8 into the newly allocated storage.

Referenced by csCtoW::csCtoW().

wchar_t* csStrNewW const wchar_t *    s
 

Allocate a new widechar [] and the string into the newly allocated storage.

bool csUnloadLibrary csLibraryHandle    Handle
 

Unload a shared library given its handle.

The function returns false on error.

int64 double2longlong double    d [inline, static]
 

Convert a double to a cross-platform 64-bit format (no endianess adjustments!).

Definition at line 174 of file csendian.h.

int32 float2long float    f [inline, static]
 

Convert a float to a cross-platform 32-bit format (no endianess adjustments!).

Definition at line 153 of file csendian.h.

References QRound().

Referenced by set_le_float32().

short float2short float    f [inline, static]
 

Convert a float to a cross-platform 16-bit format (no endianess adjustments!).

This is useful for low-precision data. They use the 1.4.12 format. The range of numbers that can be represented in this format is from 2^-8 to 2^7. The precision for numbers near to 2^-8 (0.00390625) is near 0.000001, for numbers near 2^7 (128) is near 0.03.

Definition at line 203 of file csendian.h.

References QRound().

Referenced by set_le_float16().

float get_le_float16 void *    buff [inline]
 

Read a little-endian 16-bit float from address.

Definition at line 278 of file csendian.h.

References get_le_short(), short2float(), and uint16.

float get_le_float32 void *    buff [inline]
 

Read a little-endian 32-bit float from address.

Definition at line 274 of file csendian.h.

References get_le_long(), and long2float().

uint32 get_le_long void *    buff [inline]
 

Read a little-endian long from address.

Definition at line 263 of file csendian.h.

References little_endian_long().

Referenced by get_le_float32().

uint16 get_le_short void *    buff [inline]
 

Read a little-endian short from address.

Definition at line 252 of file csendian.h.

References little_endian_short(), and uint16.

Referenced by get_le_float16().

float little_endian_float float    f [inline, static]
 

Convert a little-endian floating-point number to machine format.

Definition at line 125 of file csendian.h.

Referenced by convert_endian().

uint32 little_endian_long uint32    l [inline, static]
 

Convert a long from little-endian to machine format.

Definition at line 117 of file csendian.h.

Referenced by convert_endian(), get_le_long(), and set_le_long().

uint64 little_endian_longlong uint64    l [inline, static]
 

Convert a longlong from little-endian to machine format.

Definition at line 100 of file csendian.h.

uint16 little_endian_short uint16    s [inline, static]
 

Convert a short from little-endian to machine format.

Definition at line 121 of file csendian.h.

References uint16.

Referenced by convert_endian(), get_le_short(), and set_le_short().

float long2float int32    l [inline, static]
 

Convert a 32-bit cross-platform float to native format (no endianess adjustments!).

Definition at line 164 of file csendian.h.

Referenced by get_le_float32().

double longlong2double int64    i [inline, static]
 

Convert a 64-bit cross-platform double to native format (no endianess adjustments!).

Definition at line 185 of file csendian.h.

void csReporterHelper::Report iObjectRegistry   reg,
int    severity,
char const *    msgId,
char const *    description,
...   
[inline, static, inherited]
 

Helper function to use a reporter easily.

This function will also work if no reporter is present and use stdout in that case.

Remarks:
You can use the csReport macro for even more convenience.

Definition at line 330 of file reporter.h.

References csReporterHelper::ReportV().

void iReporter::ReportBug const char *    msgId,
const char *    description,
...   
[inline, inherited]
 

Report bug.

Definition at line 245 of file reporter.h.

References CS_REPORTER_SEVERITY_BUG.

void iReporter::ReportDebug const char *    msgId,
const char *    description,
...   
[inline, inherited]
 

Report debug.

Definition at line 254 of file reporter.h.

References CS_REPORTER_SEVERITY_DEBUG.

void iReporter::ReportError const char *    msgId,
const char *    description,
...   
[inline, inherited]
 

Report error.

Definition at line 218 of file reporter.h.

References CS_REPORTER_SEVERITY_ERROR.

void iReporter::ReportNotify const char *    msgId,
const char *    description,
...   
[inline, inherited]
 

Report notification.

Definition at line 236 of file reporter.h.

References CS_REPORTER_SEVERITY_NOTIFY.

void csReporterHelper::ReportV iObjectRegistry   reg,
int    severity,
char const *    msgId,
char const *    description,
va_list    args
[inline, static, inherited]
 

Helper function to use a reporter easily.

This function will also work if no reporter is present and use stdout in that case.

Remarks:
You can use the csReportV macro for even more convenience.

Definition at line 291 of file reporter.h.

References CS_REPORTER_SEVERITY_BUG, CS_REPORTER_SEVERITY_DEBUG, CS_REPORTER_SEVERITY_ERROR, CS_REPORTER_SEVERITY_NOTIFY, CS_REPORTER_SEVERITY_WARNING, csPrintf(), and csPrintfV().

Referenced by csReporterHelper::Report().

void iReporter::ReportWarning const char *    msgId,
const char *    description,
...   
[inline, inherited]
 

Report warning.

Definition at line 227 of file reporter.h.

References CS_REPORTER_SEVERITY_WARNING.

void set_le_float16 void *    buff,
float    f
[inline]
 

Set a little-endian 16-bit float on a address.

Definition at line 308 of file csendian.h.

References float2short(), and set_le_short().

void set_le_float32 void *    buff,
float    f
[inline]
 

Set a little-endian 32-bit float on a address.

Definition at line 304 of file csendian.h.

References float2long(), and set_le_long().

void set_le_long void *    buff,
uint32    l
[inline]
 

Set a little-endian long on a address.

Definition at line 293 of file csendian.h.

References little_endian_long().

Referenced by set_le_float32().

void set_le_short void *    buff,
uint16    s
[inline]
 

Set a little-endian short on a address.

Definition at line 282 of file csendian.h.

References little_endian_short(), and uint16.

Referenced by set_le_float16().

float short2float short    s [inline, static]
 

Convert a 16-bit cross-platform float to native format (no endianess adjustments!).

Definition at line 214 of file csendian.h.

Referenced by get_le_float16().


Generated for Crystal Space by doxygen 1.2.18