#ifndef REFLEX_BUILD
#define REFLEX_BUILD
#endif
#include "Reflex/Builder/VariableBuilder.h"
#include "Reflex/internal/OwnedMember.h"
#include "Namespace.h"
#include "DataMember.h"
Reflex::VariableBuilderImpl::VariableBuilderImpl( const char * nam,
const Type & typ,
size_t offs,
unsigned int modifiers )
: fDataMember(Member()) {
std::string declScope = "";
std::string memName = std::string( nam );
size_t pos = memName.rfind( "::" );
if ( pos != std::string::npos ) {
declScope = memName.substr( 0, pos );
memName = memName.substr( pos + 2 );
}
Scope sc = Scope::ByName(declScope);
if ( ! sc ) {
sc = (new Namespace(declScope.c_str()))->ThisScope();
}
if ( ! sc.IsNamespace()) throw RuntimeError("Declaring At is not a namespace");
sc.AddDataMember( memName.c_str(),
typ,
offs,
modifiers );
}
Reflex::VariableBuilderImpl::~VariableBuilderImpl() {
FireFunctionCallback( fDataMember );
}
void Reflex::VariableBuilderImpl::AddProperty( const char * key,
const char * value ) {
fDataMember.Properties().AddProperty( key , value );
}
void Reflex::VariableBuilderImpl::AddProperty( const char * key,
Any value ) {
fDataMember.Properties().AddProperty( key , value );
}
Reflex::Member Reflex::VariableBuilderImpl::ToMember() {
return fDataMember;
}
Reflex::VariableBuilder::VariableBuilder( const char * nam,
const Type & typ,
size_t offs,
unsigned int modifiers)
: fDataMember( Member()) {
std::string declScope = Tools::GetScopeName(nam);
std::string memName = Tools::GetBaseName(nam);
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");
DataMember* dm = new DataMember( memName.c_str(),
typ,
offs,
modifiers );
sc.AddDataMember(Member(dm));
fDataMember = Member(dm);
}
Reflex::VariableBuilder::~VariableBuilder() {
FireFunctionCallback( fDataMember );
}
Reflex::VariableBuilder &
Reflex::VariableBuilder::AddProperty( const char * key,
const char * value ) {
fDataMember.Properties().AddProperty( key , value );
return * this;
}
Reflex::VariableBuilder &
Reflex::VariableBuilder::AddProperty( const char * key,
Any value ) {
fDataMember.Properties().AddProperty( key , value );
return * this;
}
Reflex::Member Reflex::VariableBuilder::ToMember() {
return fDataMember;
}
Last change: Wed Jun 25 08:31:11 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.