LArSoft  v06_85_00
Liquid Argon Software toolkit - http://larsoft.org/
fhicl::hex_parser Struct Reference

#include "tokens.h"

Inheritance diagram for fhicl::hex_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 216 of file tokens.h.

Member Function Documentation

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

Definition at line 229 of file tokens.h.

References fhicl::maximally_munched_number().

234  {
235  boost::spirit::qi::skip_over(first, last, skipper);
236 
237  static std::string const allowed{"0123456789abcdefABCDEF"};
238  Iterator it = first;
239 
240  if (it == last || *it != '0')
241  return false;
242 
243  ++it;
244 
245  if (it == last || toupper(*it) != 'X')
246  return false;
247 
248  ++it;
249 
250  while (it != last && allowed.find(*it) != std::string::npos)
251  ++it;
252 
253  if (it != last && !maximally_munched_number(*it))
254  return false;
255 
256  Attribute raw(first, it);
257  if (raw.empty() || raw.size() == 2)
258  return false;
259 
260  Attribute result;
261  if (!cet::canonical_number(raw, result))
262  return false;
263 
264  first = it;
265  boost::spirit::traits::assign_to(result, attr);
266  return true;
267  }
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::hex_parser::what ( Context &  ) const
inline

Definition at line 272 of file tokens.h.

273  {
274  return boost::spirit::info{"fhicl::hex"};
275  }

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