#ifndef REFLEX_BUILD
#define REFLEX_BUILD
#endif
#include "Reflex/Builder/FunctionBuilder.h"
#include "Reflex/PropertyList.h"
#include "Reflex/Scope.h"
#include "Reflex/Any.h"
#include "Reflex/Type.h"
#include "Reflex/Tools.h"
#include "Reflex/internal/OwnedMember.h"
#include "FunctionMember.h"
#include "FunctionMemberTemplateInstance.h"
#include "Namespace.h"
Reflex::FunctionBuilder::~FunctionBuilder() {
FireFunctionCallback( fFunction );
}
Reflex::FunctionBuilder &
Reflex::FunctionBuilder::AddProperty( const char * key,
const char * value ) {
fFunction.Properties().AddProperty( key , value );
return * this;
}
Reflex::FunctionBuilder &
Reflex::FunctionBuilder::AddProperty( const char * key,
Any value ) {
fFunction.Properties().AddProperty( key , value );
return * this;
}
Reflex::Member Reflex::FunctionBuilder::ToMember() {
return fFunction;
}
Reflex::FunctionBuilderImpl::FunctionBuilderImpl( const char * nam,
const Type & typ,
StubFunction stubFP,
void * stubCtx,
const char * params,
unsigned char modifiers)
: fFunction( Member(0)) {
std::string fullname( nam );
std::string declScope;
std::string funcName;
size_t pos = Tools::GetTemplateName(nam).rfind( "::" );
if ( pos != std::string::npos ) {
funcName = fullname.substr( pos + 2 );
declScope = fullname.substr( 0, pos );
}
else {
funcName = nam;
declScope = "";
}
Scope sc = Scope::ByName(declScope);
if ( ! sc ) {
sc = (new Namespace(declScope.c_str()))->ThisScope();
}
if ( ! sc.IsNamespace() ) throw RuntimeError("Declaring scope is not a namespace");
if ( Tools::IsTemplated( funcName.c_str()))
fFunction = Member( new FunctionMemberTemplateInstance( funcName.c_str(),
typ,
stubFP,
stubCtx,
params,
modifiers,
sc ));
else fFunction = Member(new FunctionMember(funcName.c_str(),
typ,
stubFP,
stubCtx,
params,
modifiers));
sc.AddFunctionMember(fFunction);
}
Reflex::FunctionBuilderImpl::~FunctionBuilderImpl() {
FireFunctionCallback( fFunction );
}
void Reflex::FunctionBuilderImpl::AddProperty( const char * key,
const char * value ) {
fFunction.Properties().AddProperty( key , value );
}
void Reflex::FunctionBuilderImpl::AddProperty( const char * key,
Any value ) {
fFunction.Properties().AddProperty( key , value );
}
Reflex::Member Reflex::FunctionBuilderImpl::ToMember() {
return fFunction;
}
Reflex::FunctionBuilder::FunctionBuilder( const Type & typ,
const char * nam,
StubFunction stubFP,
void * stubCtx,
const char * params,
unsigned char modifiers)
: fFunction(Member(0)) {
std::string fullname( nam );
std::string declScope;
std::string funcName;
size_t pos = Tools::GetTemplateName( nam ).rfind( "::" );
if ( pos != std::string::npos ) {
funcName = fullname.substr( pos + 2 );
declScope = fullname.substr( 0, pos );
}
else {
funcName = nam;
declScope = "";
}
Scope sc = Scope::ByName(declScope);
if ( ! sc ) {
sc = (new Namespace(declScope.c_str()))->ThisScope();
}
if ( ! sc.IsNamespace() ) throw RuntimeError("Declaring scope is not a namespace");
if ( Tools::IsTemplated( funcName.c_str()))
fFunction = Member( new FunctionMemberTemplateInstance( funcName.c_str(),
typ,
stubFP,
stubCtx,
params,
modifiers,
sc ));
else fFunction = Member(new FunctionMember( funcName.c_str(),
typ,
stubFP,
stubCtx,
params,
modifiers));
sc.AddFunctionMember(fFunction);
}
Last change: Wed Jun 25 08:31:13 2008
Last generated: 2008-06-25 08:31
This page has been automatically generated. If you have any comments or suggestions about the page layout send a mail to ROOT support, or contact the developers with any questions or problems regarding ROOT.