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  BaseModifiableDescription
 Basic implementation of CS::Utility::iModifiableDescription, suitable for most uses. More...
class  BaseModifiableParameter
 Implementation of some of the most common CS::Utility::iModifiableParameter usage. 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...
struct  iModifiable
 This interface is to be implemented by all objects willing to be modified automatically. More...
struct  iModifiableConstraint
 A constraint allows to limit the range of values that a parameter of a CS::Utility::iMovable can take. More...
struct  iModifiableConstraintBounded
 A bounded constraint forces the value of a parameter to either stay under a certain value, over a certain value, or between two values. More...
struct  iModifiableConstraintEnum
 An enum constraint defines a list of values that a parameter can take. More...
struct  iModifiableDescription
 The description of an CS::Utility::iModifiable object. More...
struct  iModifiableListener
 Listener for the notification of the state changes of a CS::Utility::iModifiable. More...
struct  iModifiableParameter
 Description of a specific parameter of a CS::Utility::iMovable. 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  MeshFilter
 Structure holding filtering data in order to restrict the list of meshes from a scene that must be rendered. More...
class  ModifiableConstraintBitMask
 Validates a CSVAR_LONG value, checking that its bits satisfy a given mask. More...
class  ModifiableConstraintBounded
 Implementation of CS::Utility::iModifiableConstraintBounded. More...
class  ModifiableConstraintEnum
 Implements an enum constraint for a CSVAR_LONG CS::Utility::iModifiable field. More...
class  ModifiableConstraintTextEntry
 Can validate a text entry, using minimum/ maximum length and/or a regular expression. More...
class  ModifiableConstraintVFSDir
 Attached to an CS::Utility::iModifiable parameters, verifies that the value entered within is always a VFS directory, relative or absolute. More...
class  ModifiableConstraintVFSFile
 Attached to an CS::Utility::iModifiable parameters, verifies that the value entered within is always a VFS file, not a path or a directory. More...
class  ModifiableConstraintVFSPath
 Attached to an CS::Utility::iModifiable parameters, verifies that the value entered within is always a full VFS path - a directory and a file, relative or absolute. More...
class  PriorityQueue
 An implementation of a priority queue. More...
class  RootedHierarchicalCache
 iHierarchicalCache providing a 'view' into a path of another cache. More...
class  ScopedArrayPointer
 Smart pointer that delete[]s the contained pointer when the scope is exited. 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...
enum  iModifiableConstraintType {
  MODIFIABLE_CONSTRAINT_BOUNDED = 0, MODIFIABLE_CONSTRAINT_ENUM, MODIFIABLE_CONSTRAINT_VFS_FILE, MODIFIABLE_CONSTRAINT_VFS_DIR,
  MODIFIABLE_CONSTRAINT_VFS_PATH, MODIFIABLE_CONSTRAINT_TEXT_ENTRY, MODIFIABLE_CONSTRAINT_TEXT_BLOB, MODIFIABLE_CONSTRAINT_BITMASK
}
 

List of types that a CS::Utility::iModifiableConstraint can be.

More...
enum  MeshFilterMode { MESH_FILTER_EXCLUDE, MESH_FILTER_INCLUDE }
 

Filtering modes for a CS::Utility::MeshFilter.

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 45 of file cameramanager.h.

List of types that a CS::Utility::iModifiableConstraint can be.

Enumerator:
MODIFIABLE_CONSTRAINT_BOUNDED 

This constraint is a bounded constraint.

It can be upcast to a CS::Utility::iModifiableConstraintBounded.

This constraint can only be set for parameters of type CSVAR_LONG, CSVAR_FLOAT, CSVAR_VECTOR2, CSVAR_VECTOR3, or CSVAR_VECTOR4.

MODIFIABLE_CONSTRAINT_ENUM 

This constraint is an enum.

It can be upcast to a CS::Utility::iModifiableConstraintEnum.

This constraint can be set on all type of parameters.

MODIFIABLE_CONSTRAINT_VFS_FILE 

This constraint defines a string referencing a VFS path to a file.

This constraint can only be set for parameters of type CSVAR_STRING.

See also:
CS::Utility::ModifiableConstraintVFSFile for a default implementation
MODIFIABLE_CONSTRAINT_VFS_DIR 

This constraint defines a string referencing a VFS path to a directory.

This constraint can only be set for parameters of type CSVAR_STRING.

See also:
CS::Utility::ModifiableConstraintVFSDir for a default implementation
MODIFIABLE_CONSTRAINT_VFS_PATH 

This constraint defines a string referencing a VFS path to either a file or a directory.

This constraint can only be set for parameters of type CSVAR_STRING.

See also:
CS::Utility::ModifiableConstraintVFSPath for a default implementation
MODIFIABLE_CONSTRAINT_TEXT_ENTRY 

This constraint defines a single line string.

This constraint can only be set for parameters of type CSVAR_STRING.

MODIFIABLE_CONSTRAINT_TEXT_BLOB 

This constraint defines a string that uses to have a great size.

It is usually represented in more than one line of text.

This constraint can only be set for parameters of type CSVAR_STRING.

MODIFIABLE_CONSTRAINT_BITMASK 

This constraint defines a mask of bits than can be set separately.

This constraint can only be set for parameters of type CSVAR_LONG.

Definition at line 246 of file modifiable.h.

Filtering modes for a CS::Utility::MeshFilter.

Enumerator:
MESH_FILTER_EXCLUDE 

The meshes in this filter must be excluded from the scene when rendering.

MESH_FILTER_INCLUDE 

Only the meshes in this filter must be included when rendering.

Definition at line 31 of file meshfilter.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.1 by doxygen 1.6.1