CrystalSpace

Public API Reference

CS::Utility Namespace Reference

Assorted utility functions and classes that doesn't belong anywhere else. More...

Namespaces

namespace  BitOps
 

Bit operations.


namespace  ResourceCache
 

Mixins intended for use with GenericResourceCache<>.


Classes

class  AtomicRefCount
 This is a class which provides basic atomic reference-counting semantics. More...
class  DemoApplication
 Crystal Space demo application framework class. More...
class  FastRefCount
 This is a class which provides basic reference-counting semantics. More...
class  FixedSizeBestChoiceLRUPolicy
 LRU policy deciding between array LRU and pseudo-LRU based on set size. More...
class  FixedSizeCache
 Templated fixed size cache class. More...
class  FixedSizeLRUPolicy
 LRU policy using an array based fixed-size LRU. More...
class  FixedSizePseudoLRUPolicy
 LRU policy using bit-tree base pseudo-LRU. More...
class  GenericResourceCache
 Generic cache for resources. More...
struct  GraphEdge
 Represent an edge in a graph. More...
struct  iCameraManager
 A generic tool to control the motion of the camera through the keyboard and/or the mouse. More...
struct  iHUDManager
 A generic tool managing the display of a minimal text-based HUD, eg for applications implementing CS::Utility::DemoApplication or providing a user interface through the keyboard. More...
class  ImportKit
 Crystal Space Import Kit. More...
class  InternalRefCount
 This class is used to hold a reference count seperate to the normal one. More...
class  PriorityQueue
 An implementation of a priority queue. More...
class  RootedHierarchicalCache
 iHierarchicalCache providing a 'view' into a path of another cache. More...
class  ScopedDelete
 Helper class to delete a pointer when exiting a scope. More...
class  ScopedPointer
 Smart pointer that deletes the contained pointer when the scope is exited. More...
class  StringArray
 An array of strings. More...
class  StringHash
 A string-to-ID hash table. More...
class  StringSet
 The string set is a collection of unique strings. More...
class  VfsHierarchicalCache
 This is a general cache that can cache data on VFS. More...
class  WeakReferenced
 This is a class which provides basic weak reference-counting semantics. More...

Enumerations

enum  CameraMode { CAMERA_NO_MOVE = 0, CAMERA_MOVE_FREE, CAMERA_MOVE_LOOKAT, CAMERA_ROTATE }
 

Various camera modes which can be used with CS::Utility::CameraManager.

More...

Functions

csString ftostr (float f)
 Convert a float to a string, and attempting to keep as much precision as possible.
int setenv (char const *key, char const *value, bool overwrite)
 Set an environment variable, much like POSIX setenv() but portably.
bool SmartChDir (iVFS *vfs, const char *path, const char *defaultFilename=0, const char **actualFilename=0)
 "Smartly" change to the directory with some file given a path that could be: a plain file name, directory, name of a level in /lev/, or .zip file.
csPtr< iFileSmartFileOpen (iVFS *vfs, const char *path, const char *defaultFilename=0, const char **actualFilename=0)
 "Smartly" try to locate a file given a path that could be: a plain file name, directory, name of a level in /lev/, or .zip file.
float strtof (const char *str, const char **end=0)
 Convert a string to float value independent of the locale.
csArray< size_t > TopologicalSort (csArray< GraphEdge > &inputGraph)
 Do a topological sort on a graph defined by its edges.



csString EncodeBase64 (iDataBuffer *data)
 Base64-encode the given data buffer.
csString EncodeBase64 (void *data, size_t size)
 Base64-encode the given data buffer.

Detailed Description

Assorted utility functions and classes that doesn't belong anywhere else.


Enumeration Type Documentation

Various camera modes which can be used with CS::Utility::CameraManager.

Enumerator:
CAMERA_NO_MOVE 

The application will manage the camera by itself

CAMERA_MOVE_FREE 

The camera is free to move

CAMERA_MOVE_LOOKAT 

The camera is free to move but keeps looking at the target

CAMERA_ROTATE 

The camera rotates around the target

Definition at line 44 of file cameramanager.h.


Function Documentation

csString CS::Utility::EncodeBase64 ( iDataBuffer data  )  [inline]

Base64-encode the given data buffer.

Definition at line 35 of file base64.h.

csString CS::Utility::EncodeBase64 ( void *  data,
size_t  size 
)

Base64-encode the given data buffer.

csString CS::Utility::ftostr ( float  f  ) 

Convert a float to a string, and attempting to keep as much precision as possible.

Parameters:
f The float value to convert.
Returns:
String representation of the float value.
Remarks:
Practically, the float value will be converted to a decimal number. The decimal point will be a '.', independent of locale.
int CS::Utility::setenv ( char const *  key,
char const *  value,
bool  overwrite 
)

Set an environment variable, much like POSIX setenv() but portably.

Parameters:
key Environment variable name.
value Value for environment variable.
overwrite If false, set the environment variable only if it does not already have a value, else set it unconditionally.
Returns:
0 upon success, else -1 and errno is set with failure reason.
bool CS::Utility::SmartChDir ( iVFS vfs,
const char *  path,
const char *  defaultFilename = 0,
const char **  actualFilename = 0 
)

"Smartly" change to the directory with some file given a path that could be: a plain file name, directory, name of a level in /lev/, or .zip file.

path is tried to be interpreted in a number of different ways:

  • A VFS directory. Succeeds if a file named defaultFilename exists in the directory.
  • A level name in VFS /lev/. Succeeds if a file named defaultFilename exists below that directory.
  • A .zip file name. Succeeds if a file named defaultFilename exists in the archive.
  • A plain file name. Succeeds if the file exists.

This is for example useful for tool applications which want to let the user specify paths and file locations in a variety of ways.

Parameters:
vfs The VFS interface to use to open the file.
path The path that is attempted to be opened.
defaultFilename Default filename, used to check whether the provided path is a directory or .zip file.
actualFilename Can return the filename used to determine the directory to change to. (Note: is either defaultFilename or a pointer into path).
Returns:
Whether the changing the directory succeeded.
csPtr<iFile> CS::Utility::SmartFileOpen ( iVFS vfs,
const char *  path,
const char *  defaultFilename = 0,
const char **  actualFilename = 0 
)

"Smartly" try to locate a file given a path that could be: a plain file name, directory, name of a level in /lev/, or .zip file.

path is tried to be interpreted in a number of different ways:

  • A VFS directory. Succeeds if a file named defaultFilename exists in the directory.
  • A level name in VFS /lev/. Succeeds if a file named defaultFilename exists below that directory.
  • A .zip file name. Succeeds if a file named defaultFilename exists in the archive.
  • A plain file name. Succeeds if the file exists.

This is for example useful for tool applications which want to let the user specify paths and file locations in a variety of ways.

Parameters:
vfs The VFS interface to use to open the file.
path The path that is attempted to be opened.
defaultFilename Default filename, used when the provided path is a directory or .zip file.
actualFilename Can return the actual filename opened. (Note: is either defaultFilename or a pointer into path).
Returns:
The file if opening succeeded.
float CS::Utility::strtof ( const char *  str,
const char **  end = 0 
)

Convert a string to float value independent of the locale.

Parameters:
str The string to convert.
end If not 0 receives pointer to the first character after the converted value.
Remarks:
Wraps the C runtime library's strtod() or strtof() functions and has thus the same behaviour with respect to invalid inputs and under-/overflow.
csArray<size_t> CS::Utility::TopologicalSort ( csArray< GraphEdge > &  inputGraph  ) 

Do a topological sort on a graph defined by its edges.

Returns the vertices in a topological order.

Note:
If the graph is in fact cyclic the returned array will not contain all nodes.
Parameters:
inputGraph the edges defining the graph

Generated for Crystal Space 2.0 by doxygen 1.6.1