18 #include "Reflex/Member.h"
19 #include "Reflex/Base.h"
29 typedef std::vector<boost::shared_ptr<fireworks::OptionNode> >
Options;
46 return iLHS->description() == iRHS->description();
55 unsigned long iSubstitutionEnd,
64 const std::vector<boost::shared_ptr<OptionNode> >&
options()
const {
69 std::vector<boost::shared_ptr<OptionNode> >::iterator it=
84 std::vector<boost::shared_ptr<OptionNode> >& );
95 unsigned long iSubstitutionEnd,
98 m_description(iDescription),
99 m_endOfName(iSubstitutionEnd),
100 m_hasSubOptions(typeHasOptions(iType) )
105 std::string descriptionFromMember(
const ROOT::Reflex::Member& iMember)
107 std::string typeString = iMember.TypeOf().Name();
109 if(index == std::string::npos) {
110 return iMember.Name()+
":"+typeString;
112 return iMember.Name()+typeString.substr(index,std::string::npos)+
":"+
113 typeString.substr(0,index);
120 m_description(descriptionFromMember(iMember)),
121 m_endOfName(iMember.Name().
size()),
122 m_hasSubOptions(typeHasOptions(m_type))
128 std::vector<boost::shared_ptr<OptionNode> >& oOptions)
131 if(type.IsPointer()) {
132 type = type.ToType();
135 oOptions.reserve(oOptions.size()+type.FunctionMemberSize());
136 for(ROOT::Reflex::Member_Iterator
m = type.FunctionMember_Begin();
m != type.FunctionMember_End(); ++
m ) {
137 if(!
m->TypeOf().IsConst() ||
138 m->IsConstructor() ||
142 m->Name().substr(0,2)==
"__") {
continue;}
143 oOptions.push_back(boost::shared_ptr<OptionNode>(
new OptionNode(*
m)));
146 for(ROOT::Reflex::Base_Iterator
b = type.Base_Begin();
b != type.Base_End(); ++
b) {
152 return iType.IsClass();
164 #define FUN1(_fun_) \
165 m_builtins.push_back(boost::shared_ptr<OptionNode>( new OptionNode( # _fun_ "(float):float", strlen( # _fun_ )+1,s_float)))
167 #define FUN2(_fun_) \
168 m_builtins.push_back(boost::shared_ptr<OptionNode>( new OptionNode( # _fun_ "(float,float):float", strlen( # _fun_ )+1,s_float)))
173 static const ROOT::Reflex::Type s_float(ROOT::Reflex::Type::ByTypeInfo(
typeid(
float)));
229 OptionNode::fillOptionForType(iType,
m_options);
232 std::vector<boost::shared_ptr<OptionNode> >::iterator it=
242 void dummyDelete(
void*) {
245 void findTypeDelimiters(
const char*& ioBegin,
247 std::vector<const char*>& oDelimeters)
250 if(ioBegin==iEnd) {
return; }
251 const char* it = iEnd-1;
252 const char* itEnd = ioBegin-1;
253 for(; it != itEnd; --it) {
254 if(isalnum(*it)) {
continue;}
255 bool shouldStop=
false;
259 oDelimeters.push_back(it);
264 if(shouldStop) {
break;}
267 std::reverse(oDelimeters.begin(),oDelimeters.end());
273 std::vector<std::pair<boost::shared_ptr<std::string>, std::string> >& oOptions)
const
277 std::vector<const char*> delimeters;
278 findTypeDelimiters(iBegin, iEnd, delimeters);
281 const char*
begin = iBegin;
282 for(std::vector<const char*>::iterator it = delimeters.begin(), itEnd = delimeters.end();
284 OptionNode
temp(std::string(begin,*it),
288 boost::shared_ptr<OptionNode> comp(&temp, dummyDelete);
289 Options::const_iterator itFind =std::lower_bound(nodes->begin(),
294 if(itFind == nodes->end() || *comp < *(*itFind) ) {
298 nodes = &((*itFind)->options());
303 std::string
part(begin,iEnd);
304 unsigned int part_size = part.size();
305 for(Options::const_iterator it = nodes->begin(), itEnd = nodes->end();
308 if(part == (*it)->description().substr(0,part_size) ) {
309 oOptions.push_back(std::make_pair(boost::shared_ptr<std::string>(const_cast<std::string*>(&((*it)->description())), dummyDelete),
310 (*it)->description().substr(part_size,(*it)->substitutionEnd()-part_size)));
std::string::size_type m_endOfName
Sin< T >::type sin(const T &t)
bool operator<(const OptionNode &iRHS) const
Exp< T >::type exp(const T &t)
std::vector< boost::shared_ptr< fireworks::OptionNode > > m_options
Type returnType(const Member &mem)
static bool typeHasOptions(const ROOT::Reflex::Type &iType)
virtual void fillOptions(const char *iBegin, const char *iEnd, std::vector< std::pair< boost::shared_ptr< std::string >, std::string > > &oOptions) const
const T & max(const T &a, const T &b)
const std::string & description() const
Cos< T >::type cos(const T &t)
unsigned long substitutionEnd() const
Tan< T >::type tan(const T &t)
std::string m_description
const std::vector< boost::shared_ptr< OptionNode > > & options() const
std::vector< boost::shared_ptr< OptionNode > > m_subOptions
bool operator()(const T &iLHS, const T &iRHS) const
Log< T >::type log(const T &t)
OptionNode(const ROOT::Reflex::Member &)
virtual ~FWExpressionValidator()
std::vector< boost::shared_ptr< fireworks::OptionNode > > Options
static void fillOptionForType(const ROOT::Reflex::Type &, std::vector< boost::shared_ptr< OptionNode > > &)
std::vector< boost::shared_ptr< fireworks::OptionNode > > m_builtins
bool operator()(const T &iLHS, const T &iRHS) const
ROOT::Reflex::Type m_type
void setType(const ROOT::Reflex::Type &)
tuple size
Write out results.
Power< A, B >::type pow(const A &a, const B &b)
ROOT::Reflex::Type m_type