28 typedef std::vector<std::shared_ptr<fireworks::OptionNode> >
Options;
45 return iLHS->description() == iRHS->description();
54 unsigned long iSubstitutionEnd,
63 const std::vector<std::shared_ptr<OptionNode> >&
options()
const {
64 if(m_hasSubOptions && m_subOptions.empty()) {
65 fillOptionForType(m_type, m_subOptions);
66 std::sort(m_subOptions.begin(),m_subOptions.end(),
68 std::vector<std::shared_ptr<OptionNode> >::iterator it=
69 std::unique(m_subOptions.begin(),m_subOptions.end(),
71 m_subOptions.erase(it, m_subOptions.end());
73 m_hasSubOptions = !m_subOptions.empty();
83 std::vector<std::shared_ptr<OptionNode> >& );
94 unsigned long iSubstitutionEnd,
97 m_description(iDescription),
98 m_endOfName(iSubstitutionEnd),
99 m_hasSubOptions(typeHasOptions(iType) )
108 if(index == std::string::npos) {
109 return iMember.
name()+
":"+typeString;
111 return iMember.
name()+typeString.substr(index,std::string::npos)+
":"+
112 typeString.substr(0,index);
127 std::vector<std::shared_ptr<OptionNode> >& oOptions)
135 oOptions.reserve(oOptions.size()+functions.
size());
136 for(
auto const&
function : functions) {
143 m.
name().substr(0,2)==
"__") {
continue;}
144 oOptions.push_back(std::make_shared<OptionNode>(m));
148 for(
auto const&
base : bases) {
166 #define FUN1(_fun_) \ 167 m_builtins.push_back(std::make_shared<OptionNode>( # _fun_ "(float):float", strlen( # _fun_ )+1,s_float)) 169 #define FUN2(_fun_) \ 170 m_builtins.push_back(std::make_shared<OptionNode>( # _fun_ "(float,float):float", strlen( # _fun_ )+1,s_float)) 195 std::sort(m_builtins.begin(),m_builtins.end(),
230 m_options=m_builtins;
232 std::sort(m_options.begin(),m_options.end(),
234 std::vector<std::shared_ptr<OptionNode> >::iterator it=
237 m_options.erase(it, m_options.end());
244 void dummyDelete(
void*) {
247 void findTypeDelimiters(
const char*& ioBegin,
249 std::vector<const char*>& oDelimeters)
252 if(ioBegin==iEnd) {
return; }
253 const char* it = iEnd-1;
254 const char* itEnd = ioBegin-1;
255 for(; it != itEnd; --it) {
256 if(isalnum(*it)) {
continue;}
257 bool shouldStop=
false;
261 oDelimeters.push_back(it);
266 if(shouldStop) {
break;}
275 std::vector<std::pair<std::shared_ptr<std::string>,
std::string> >& oOptions)
const 279 std::vector<const char*> delimeters;
280 findTypeDelimiters(iBegin, iEnd, delimeters);
283 const char*
begin = iBegin;
284 for(std::vector<const char*>::iterator it = delimeters.begin(), itEnd = delimeters.end();
290 std::shared_ptr<OptionNode>
comp(&temp, dummyDelete);
291 Options::const_iterator itFind =std::lower_bound(nodes->begin(),
296 if(itFind == nodes->end() || *comp < *(*itFind) ) {
300 nodes = &((*itFind)->options());
306 unsigned int part_size = part.size();
307 for(Options::const_iterator it = nodes->begin(), itEnd = nodes->end();
310 if(part == (*it)->description().substr(0,part_size) ) {
311 oOptions.push_back(std::make_pair(std::shared_ptr<std::string>(const_cast<std::string*>(&((*it)->description())), dummyDelete),
312 (*it)->description().substr(part_size,(*it)->substitutionEnd()-part_size)));
const std::vector< std::shared_ptr< OptionNode > > & options() const
OptionNode(const edm::FunctionWithDict &)
void setType(const edm::TypeWithDict &)
std::string::size_type m_endOfName
bool isConstructor() const
Sin< T >::type sin(const T &t)
bool operator<(const OptionNode &iRHS) const
TypeWithDict toType() const
std::string typeName() const
const std::string & description() const
def unique(seq, keepstr=True)
edm::TypeWithDict returnType(const edm::FunctionWithDict &func)
Cos< T >::type cos(const T &t)
unsigned long substitutionEnd() const
Tan< T >::type tan(const T &t)
Abs< T >::type abs(const T &t)
std::vector< std::shared_ptr< fireworks::OptionNode > > Options
std::string m_description
base
Make Sure CMSSW is Setup ##.
static bool typeHasOptions(const edm::TypeWithDict &iType)
virtual void fillOptions(const char *iBegin, const char *iEnd, std::vector< std::pair< std::shared_ptr< std::string >, std::string > > &oOptions) const
bool operator()(const T &iLHS, const T &iRHS) const
static void fillOptionForType(const edm::TypeWithDict &, std::vector< std::shared_ptr< OptionNode > > &)
virtual ~FWExpressionValidator()
std::vector< std::shared_ptr< OptionNode > > m_subOptions
bool isDestructor() const
bool operator()(const T &iLHS, const T &iRHS) const
Power< A, B >::type pow(const A &a, const B &b)