Yage3D.net
 

yage.core.misc

Authors:
Eric Poggel

License:
LGPL v3

Miscellaneous core functions and templates that haven't found a place yet.

char[] cleanPath (char[] path);
Resolve "../", "./", "//" and other redirections from any path. This function also ensures correct use of path separators for the current platform.

T dup (T : Object)(T object);
Make a shallow copy of a class.

TODO:
dup for structs, and this also doesn't copy base Members.

TODO:
Betware arrays, both will be slices of the same array afterward, even after resizing one.

R delegate(P) toDelegate (R, P...)(R function(P) fp);
Convert any function pointer to a delegate. From: http://www.digitalmars.com/d/archives/digitalmars/D/easily_convert_any_method_function_to_a_delegate_55827.html

template baseTypedef (T)
Get the base type of any chain of typedefs. This should be added to ParameterTypeTuple so it can work with typedefs.

template SharedSingleton (T)
Turn any class into a Singleton via a template mixin.

Example:
 class Foo
 {   private this()
     {   // do stuff
     }
     mixin SharedSingleton!(Foo);
 }

 auto a = new Foo();  // a and b reference
 auto b = new Foo();  // the same object.


T singleton ;
Reference to the single instance

T getSharedInstance ();
Get an instance shared among all threads.

template Singleton (T)
Unlike shared singleton, this mixin allows one unique instance per thread.

T getInstance ();
Get an instance unique to the calling thread. Each thread can only have one instance.

Yage source files are copywritten by their specified authors and available under the terms of the GNU LGPL.
Documentation generated with CandyDoc on Wed Aug 11 11:14:27 2010