| ## Public API Reference

- Main Page
- Modules
- Namespaces
- Classes
- Files
- Related Pages

- Namespace List
- Namespace Members

# CS Namespace Reference
[Graphics, 3D, Common Plugin Classes, Common Plugin Classes, Common Plugin Classes, Common Plugin Classes, Common Plugin Classes, Memory Management, Memory Management, Event handling, Memory Management, Utilities]

## Classes
struct | AllocPlatform
struct | ConditionAnd
class | CowWrapper
| Copy-on-write wrapper for arbitrary types. More...
class | ImageAutoConvert
| Small wrapper class to automatically convert an image into a different storage format, if needed. More...
class | ImportKit
| Crystal Space Import Kit. More...
class | MeasureTime
| Simple helper class to measure execution time of a block. More...
class | NumberedFilenameHelper
| Helper to deal with numbered filename. More...
class | ShaderVariableContextImpl
| Simple implementation for iShaderVariableContext. More...
struct | ShaderVarName
| Helper class to obtain an ID for a shader variable. More...
class | SpinLock
class | TriangleIndicesStream
| Helper class to extract triangles from an index buffer. More...
class | UberScreenshotMaker
| Helper to create "&uuml;berscreenshots", screenshots with a resolution larger than the current framebuffer resolution. More...
## Namespaces
namespace | DocumentHelper
| Namespace contains helper functions and classes which operate on iDocumentNode and iDocumentNodeIterator.

namespace | ImportKitImpl
namespace | Math
namespace | Memory
namespace | PluginCommon
namespace | SndSys
namespace | TypeTraits
## Functions
template<class T, class Fn, class P>
CS_FORCEINLINE_TEMPLATEMETHOD Fn & | ForEach (T it, Fn &Func, P &p)
| Iterate over all elements in the iterator and perform operation given by Func.
template<class T, class Fn>
CS_FORCEINLINE_TEMPLATEMETHOD Fn & | ForEach (T *start, T *end, Fn &Func)
| Iterate over all elements in the list and perform operation given by Func.
template<class T, class Fn>
CS_FORCEINLINE_TEMPLATEMETHOD Fn & | ForEach (T it, Fn &Func)
| Iterate over all elements in the iterator and perform operation given by Func.
csHandlerID | RegisterWeakListener (iEventQueue *q, iEventHandler *listener, csRef< iEventHandler > &handler)
| Helper function for registering an event handler using a weak reference.
void | RemoveWeakListener (iEventQueue *q, csRef< iEventHandler > &handler)
| Helper function for removing an event handler that was registered with RegisterWeakListener().
template<class T>
CS_FORCEINLINE_TEMPLATEMETHOD void | Swap (T &a, T &b)
| Swap two elements.

## Function Documentation

template<class T, class Fn, class P>

CS_FORCEINLINE_TEMPLATEMETHOD Fn& CS::ForEach | ( | T | it,
|  | Fn & | Func,
|  | P & | p |
| ) |  |  |

Iterate over all elements in the iterator and perform operation given by Func.

Definition at line 81 of file algorithms.h.

template<class T, class Fn>

CS_FORCEINLINE_TEMPLATEMETHOD Fn& CS::ForEach | ( | T * | start,
|  | T * | end,
|  | Fn & | Func |
| ) |  |  |

Iterate over all elements in the list and perform operation given by Func.

Definition at line 66 of file algorithms.h.

template<class T, class Fn>

CS_FORCEINLINE_TEMPLATEMETHOD Fn& CS::ForEach | ( | T | it,
|  | Fn & | Func |
| ) |  |  |

Iterate over all elements in the iterator and perform operation given by Func.

     csArray<int> anArray;
     anArray.Push (1);
     anArray.Push (4);
     ForEach (anArray.GetIterator (), OurFunctor ());

Definition at line 52 of file algorithms.h.

csHandlerID CS::RegisterWeakListener | ( | iEventQueue * | q,
|  | iEventHandler * | listener,
|  | csRef< iEventHandler > & | handler |
| ) |  |  |

Helper function for registering an event handler using a weak reference.

Use RemoveWeakListener() to remove an event handler registered with this function.

void CS::RemoveWeakListener | ( | iEventQueue * | q,
|  | csRef< iEventHandler > & | handler |
| ) |  |  |

Helper function for removing an event handler that was registered with RegisterWeakListener().

template<class T>

CS_FORCEINLINE_TEMPLATEMETHOD void CS::Swap | ( | T & | a,
|  | T & | b |
| ) |  |  |

Swap two elements.

Definition at line 34 of file algorithms.h.

Referenced by csSort().