LArSoft  v07_13_02
Liquid Argon Software toolkit - http://larsoft.org/
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 331 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 344 of file tokens.h.

References fhicl::maximally_munched_number().

349  {
350  boost::spirit::qi::skip_over(first, last, skipper);
351 
352  static std::string const allowed{"01"};
353  Iterator it = first;
354 
355  if (it == last || *it != '0')
356  return false;
357 
358  ++it;
359 
360  if (it == last || toupper(*it) != 'B')
361  return false;
362 
363  ++it;
364 
365  while (it != last && allowed.find(*it) != std::string::npos)
366  ++it;
367 
368  if (it != last && !maximally_munched_number(*it))
369  return false;
370 
371  Attribute raw(first, it);
372  if (raw.empty() || raw.size() == 2)
373  return false;
374 
375  Attribute result;
376  if (!cet::canonical_number(raw, result))
377  return false;
378 
379  first = it;
380  boost::spirit::traits::assign_to(result, attr);
381  return true;
382  }
Raw data description.
Definition: RawTypes.h:6
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 387 of file tokens.h.

388  {
389  return boost::spirit::info{"fhicl::bin"};
390  }

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