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 | FastRefCount |
This is a class which provides basic reference-counting semantics. More... | |
class | GenericResourceCache |
Generic cache for resources. More... | |
struct | GraphEdge |
Represent an edge in a graph. 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 | ScopedDelete |
Helper class to delete a pointer when exiting a scope. More... | |
class | WeakReferenced |
This is a class which provides basic weak reference-counting semantics. More... | |
Functions | |
int | setenv (char const *key, char const *value, bool overwrite) |
Set an environment variable, much like POSIX setenv() but portably. | |
csPtr< iFile > | 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. | |
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. |
Detailed Description
Assorted utility functions and classes that doesn't belong anywhere else.
Function Documentation
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.
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.
Try to open a file given a path that could be any of a VFS path, a plain file name or directory in the real file system, name of a level in /lev/, or .zip file.
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.
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 1.4.0 by doxygen 1.5.8