ATLAS Offline Software
Loading...
Searching...
No Matches
Identifier Namespace Reference

Classes

struct  get_compact_func
 A get_compact functional for use in STL algorithms. More...

Functions

bool isDigit (const char c)
IdentifierField::element_type parseStreamDigits (std::istream &is)
IdentifierField::element_vector parseStreamList (std::istream &is)
IdentifierField::element_vector parseTextList (std::string &text)

Function Documentation

◆ isDigit()

bool Identifier::isDigit ( const char c)

Definition at line 16 of file IdentifierFieldParser.cxx.

16 {
17 return std::isdigit(c) or c=='-' or c=='+';
18 }

◆ parseStreamDigits()

IdentifierField::element_type Identifier::parseStreamDigits ( std::istream & is)

Definition at line 21 of file IdentifierFieldParser.cxx.

21 {
22 static constexpr std::errc ok{};
23 char buffer[20]{};
24 int i{};
26 for(int c{};isDigit(is.peek()) and i<20;++i ){
27 if (c == '+') is.ignore();
28 c=is.get();
29 buffer[i] = c;
30 }
31 const auto [ptr,ec] = std::from_chars(buffer, buffer+i, v);
32 if (ec != ok) throw std::invalid_argument("Invalid argument in parseStreamDigits");
33 return v;
34 }
ExpandedIdentifier::element_type element_type
bool isDigit(const char c)
void * ptr(T *p)
Definition SGImplSvc.cxx:74

◆ parseStreamList()

IdentifierField::element_vector Identifier::parseStreamList ( std::istream & is)

Definition at line 37 of file IdentifierFieldParser.cxx.

37 {
39 for (int c{};(not is.eof());c=is.peek()){
40 while (std::isspace(is.peek())){is.ignore();}
41 if (isDigit(c)){
42 if (c =='+') is.ignore();
43 int v = parseStreamDigits(is);
44 result.push_back(v);
45 } else if (c == ','){
46 is.ignore();
47 } else if (c == '/' ){
48 break;
49 }
50 }
51 return result;
52 }
std::vector< element_type > element_vector
IdentifierField::element_type parseStreamDigits(std::istream &is)

◆ parseTextList()

IdentifierField::element_vector Identifier::parseTextList ( std::string & text)