28 typedef std::vector<std::shared_ptr<fireworks::OptionNode> >
Options;
33 bool operator()(
const T& iLHS,
const T& iRHS)
const {
return *iLHS < *iRHS; }
38 bool operator()(
const T& iLHS,
const T& iRHS)
const {
return iLHS->description() == iRHS->description(); }
48 const std::vector<std::shared_ptr<OptionNode> >&
options()
const {
49 if (m_hasSubOptions && m_subOptions.empty()) {
50 fillOptionForType(m_type, m_subOptions);
53 std::vector<std::shared_ptr<OptionNode> >::iterator it =
std::unique(
55 m_subOptions.erase(it, m_subOptions.end());
57 m_hasSubOptions = !m_subOptions.empty();
66 static void fillOptionForType(
const edm::TypeWithDict&, std::vector<std::shared_ptr<OptionNode> >&);
78 unsigned long iSubstitutionEnd,
81 m_description(iDescription),
82 m_endOfName(iSubstitutionEnd),
83 m_hasSubOptions(typeHasOptions(iType)) {}
89 if (index == std::string::npos) {
90 return iMember.
name() +
":" + typeString;
92 return iMember.
name() + typeString.substr(index, std::string::npos) +
":" + typeString.substr(0, index);
104 std::vector<std::shared_ptr<OptionNode> >& oOptions) {
111 oOptions.reserve(oOptions.size() + functions.
size());
112 for (
auto const&
function : functions) {
115 m.
name().substr(0, 2) ==
"__") {
118 oOptions.push_back(std::make_shared<OptionNode>(m));
122 for (
auto const&
base : bases) {
138 #define FUN1(_fun_) \ 139 m_builtins.push_back(std::make_shared<OptionNode>(#_fun_ "(float):float", strlen(#_fun_) + 1, s_float)) 141 #define FUN2(_fun_) \ 142 m_builtins.push_back(std::make_shared<OptionNode>(#_fun_ "(float,float):float", strlen(#_fun_) + 1, s_float)) 195 m_options = m_builtins;
198 std::vector<std::shared_ptr<OptionNode> >::iterator it =
200 m_options.erase(it, m_options.end());
207 void dummyDelete(
void*) {}
209 void findTypeDelimiters(
const char*& ioBegin,
const char* iEnd, std::vector<const char*>& oDelimeters) {
211 if (ioBegin == iEnd) {
214 const char* it = iEnd - 1;
215 const char* itEnd = ioBegin - 1;
216 for (; it != itEnd; --it) {
220 bool shouldStop =
false;
225 oDelimeters.push_back(it);
242 std::vector<std::pair<std::shared_ptr<std::string>,
std::string> >& oOptions)
const {
245 std::vector<const char*> delimeters;
246 findTypeDelimiters(iBegin, iEnd, delimeters);
249 const char*
begin = iBegin;
250 for (std::vector<const char*>::iterator it = delimeters.begin(), itEnd = delimeters.end(); it != itEnd; ++it) {
253 std::shared_ptr<OptionNode>
comp(&temp, dummyDelete);
254 Options::const_iterator itFind = std::lower_bound(
257 if (itFind == nodes->end() || *comp < *(*itFind)) {
261 nodes = &((*itFind)->options());
267 unsigned int part_size = part.size();
268 for (Options::const_iterator it = nodes->begin(), itEnd = nodes->end(); it != itEnd; ++it) {
269 if (part == (*it)->description().substr(0, part_size)) {
271 std::make_pair(std::shared_ptr<std::string>(const_cast<std::string*>(&((*it)->description())), dummyDelete),
272 (*it)->description().substr(part_size, (*it)->substitutionEnd() - part_size)));
void fillOptions(const char *iBegin, const char *iEnd, std::vector< std::pair< std::shared_ptr< std::string >, std::string > > &oOptions) const override
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
~FWExpressionValidator() override
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
static bool typeHasOptions(const edm::TypeWithDict &iType)
bool operator()(const T &iLHS, const T &iRHS) const
static void fillOptionForType(const edm::TypeWithDict &, std::vector< std::shared_ptr< OptionNode > > &)
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)