Classes | Public Member Functions | List of all members
fhicl::bin_parser Struct Reference

#include <tokens.h>

Inheritance diagram for fhicl::bin_parser:

Classes

struct  attribute
 

Public Member Functions

template<typename Iterator , typename Context , typename Skipper , typename Attribute >
bool parse (Iterator &first, Iterator const &last, Context &, Skipper const &skipper, Attribute &attr) const
 
template<typename Context >
boost::spirit::info what (Context &) const
 

Detailed Description

Definition at line 323 of file tokens.h.

Member Function Documentation

template<typename Iterator , typename Context , typename Skipper , typename Attribute >
bool fhicl::bin_parser::parse ( Iterator &  first,
Iterator const &  last,
Context &  ,
Skipper const &  skipper,
Attribute &  attr 
) const
inline

Definition at line 336 of file tokens.h.

341  {
342  boost::spirit::qi::skip_over(first, last, skipper);
343 
344  static std::string const allowed{"01"};
345  Iterator it = first;
346 
347  if (it == last || *it != '0')
348  return false;
349 
350  ++it;
351 
352  if (it == last || toupper(*it) != 'B')
353  return false;
354 
355  ++it;
356 
357  while (it != last && allowed.find(*it) != std::string::npos)
358  ++it;
359 
360  if (it != last && !maximally_munched_number(*it))
361  return false;
362 
363  Attribute raw(first, it);
364  if (raw.empty() || raw.size() == 2)
365  return false;
366 
367  Attribute result;
368  if (!cet::canonical_number(raw, result))
369  return false;
370 
371  first = it;
372  boost::spirit::traits::assign_to(result, attr);
373  return true;
374  }
bool canonical_number(std::string const &value, std::string &result)
static QCString result
std::string string
Definition: nybbler.cc:12
Raw data description.
bool maximally_munched_number(char const ch)
Definition: tokens.h:35
template<typename Context >
boost::spirit::info fhicl::bin_parser::what ( Context &  ) const
inline

Definition at line 379 of file tokens.h.

380  {
381  return boost::spirit::info{"fhicl::bin"};
382  }

The documentation for this struct was generated from the following file: