/*-------------------------------------------------------------- | Copyright (C) 1997-2007 by Prodigy Design Ltd | | All rights Reserved | |--------------------------------------------------------------| | Unauthorised use or distribution of this file or any | | portion of it may result in severe civil and criminal | | Penalties and will be prosecuted to the full extent of the | | law. | ---------------------------------------------------------------*/ #ifdef PREFIX_HAVE_PRAGMA_ONCE # pragma once #endif #ifndef PREFIX_CLASS_BUILDER_H # define PREFIX_CLASS_BUILDER_H PREFIX_BEGIN template class ClassBuilder { typedef Type::Traits Traits; Registry *registry; Class *klass; Pathname path; Object root; public: ClassBuilder(Registry &R, const Label &N) : registry(&R) { klass = new Class(N); } ClassBuilder(Registry &R, const Label &N, Object Q, const Pathname &P) : registry(&R), root(Q), path(P) { klass = new Class(N); } ~ClassBuilder() { registry->AddClass(klass); if (root.Exists() && !path.Empty()) Set(root, path, registry->NewFromClass(klass)); } template ClassBuilder &operator()(Label const &name, Method method, const char *D = 0) { MethodBase *M = MakeMethod(method, name); if (D != 0) M->Description = D; klass->AddMethod(name, M); return *this; } }; PREFIX_END #endif // PREFIX_CLASS_BUILDER_H //EOF