/usr/include/gsmlib/gsm_parser.h is in libgsmme-dev 1.10+20120414.gita5e5ae9a-0.2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 | // *************************************************************************
// * GSM TA/ME library
// *
// * File: gsm_parser.h
// *
// * Purpose: Parser to parse MA/TA result strings
// *
// * Author: Peter Hofmann (software@pxh.de)
// *
// * Created: 13.5.1999
// *************************************************************************
#ifndef GSM_PARSER_H
#define GSM_PARSER_H
#include <gsmlib/gsm_util.h>
#include <gsmlib/gsm_error.h>
#include <string>
#include <vector>
namespace gsmlib
{
class Parser : public RefBase
{
private:
unsigned int _i; // index into _s, next character
std::string _s; // std::string to parse
bool _eos; // true if end-of-string reached in nextChar()
// return next character or -1 if end of string
int nextChar(bool skipWhiteSpace = true);
// "puts back" a character
void putBackChar() {if (! _eos) --_i;}
// check for empty parameter (ie. "," or end of string)
// skips white space
// returns true if no parameter
// or throw an GsmException if allowNoParameter == false
bool checkEmptyParameter(bool allowNoParameter) throw(GsmException);
// parse a std::string (like "string")
// throw an exception if not well-formed
std::string parseString2(bool stringWithQuotationMarks) throw(GsmException);
// parse a int (like 1234)
// throw an exception if not well-formed
int parseInt2() throw(GsmException);
// throw a parser exception
void throwParseException(std::string message = "") throw(GsmException);
public:
Parser(std::string s);
// the following functions skip white space
// parse a character, if absent throw a GsmException
// return false if allowNoChar == true and character not encountered
bool parseChar(char c, bool allowNoChar = false) throw(GsmException);
// parse a list of the form "("ABC", DEF")"
// the list can be empty (ie. == "" ) if allowNoList == true
std::vector<std::string> parseStringList(bool allowNoList = false)
throw(GsmException);
// parse a list of the form "(12, 14)" or "(1-4, 10)"
// the result is returned as a bit vector where for each integer
// in the list and/or range(s) a bit is set
// the list can be empty (ie. == "") if allowNoList == true
std::vector<bool> parseIntList(bool allowNoList = false)
throw(GsmException);
// parse a list of parameter ranges (see below)
// the list can be empty (ie. == "" ) if allowNoList == true
std::vector<ParameterRange> parseParameterRangeList(bool allowNoList = false)
throw(GsmException);
// parse a std::string plus its valid integer range of the
// form "("string",(1-125))"
// the parameter range may be absent if allowNoParameterRange == true
ParameterRange parseParameterRange(bool allowNoParameterRange = false)
throw(GsmException);
// parse an integer range of the form "(1-125)"
// the range may be absent if allowNoRange == true
// then IntRange::_high and _low are set to NOT_SET
// the range may be short if allowNonRange == true
// then IntRange::_high is set to NOT_SET
IntRange parseRange(bool allowNoRange = false, bool allowNonRange = false)
throw(GsmException);
// parse an integer of the form "1234"
// allow absent int if allowNoInt == true
// then it returns NOT_SET
int parseInt(bool allowNoInt = false) throw(GsmException);
// parse a std::string of the form ""string""
// allow absent std::string if allowNoString == true
// then it returns ""
// if stringWithQuotationMarks == true the std::string may contain """
// the std::string is then parsed till the end of the line
std::string parseString(bool allowNoString = false,
bool stringWithQuotationMarks = false)
throw(GsmException);
// parse a single ","
// the comma may be absent if allowNoComma == true
// returns true if there was a comma
bool parseComma(bool allowNoComma = false) throw(GsmException);
// parse till end of line, return result without whitespace
std::string parseEol() throw(GsmException);
// check that end of line is reached
void checkEol() throw(GsmException);
// return std::string till end of line without whitespace
// (does not change internal state)
std::string getEol();
};
};
#endif // GSM_PARSER_H
|