73 CSVLexer(QTextStream &stream, QObject *parent=
nullptr);
99 static QVector< QPair<QRegExp, Token::TokenType> >
_pattern;
121 virtual bool handleRadioId(
const QList<qint64> &ids, qint64 line, qint64 column, QString &errorMessage);
123 virtual bool handleRadioName(
const QString &name, qint64 line, qint64 column, QString &errorMessage);
125 virtual bool handleIntroLine1(
const QString &text, qint64 line, qint64 column, QString &errorMessage);
127 virtual bool handleIntroLine2(
const QString &text, qint64 line, qint64 column, QString &errorMessage);
129 virtual bool handleMicLevel(
unsigned level, qint64 line, qint64 column, QString &errorMessage);
131 virtual bool handleSpeech(
bool speech, qint64 line, qint64 column, QString &errorMessage);
133 virtual bool handleDTMFContact(qint64 idx,
const QString &name,
const QString &num,
bool rxTone,
134 qint64 line, qint64 column, QString &errorMessage);
137 bool rxTone, qint64 line, qint64 column, QString &errorMessage);
139 virtual bool handleGroupList(qint64 idx,
const QString &name,
const QList<qint64> &contacts,
140 qint64 line, qint64 column, QString &errorMessage);
144 qint64 gl, qint64 contact, qint64 gps, qint64 roam, qint64 radioID, qint64 line, qint64 column, QString &errorMessage);
150 virtual bool handleZone(qint64 idx,
const QString &name,
bool a,
const QList<qint64> &channels,
151 qint64 line, qint64 column, QString &errorMessage);
153 virtual bool handleGPSSystem(qint64 idx,
const QString &name, qint64 contactIdx, qint64 period,
154 qint64 revertChannelIdx, qint64 line, qint64 column, QString &errorMessage);
156 virtual bool handleAPRSSystem(qint64 idx,
const QString &name, qint64 channelIdx, qint64 period,
157 const QString &src,
unsigned srcSSID,
const QString &dest,
unsigned destSSID,
158 const QString &path,
const QString &icon,
const QString &message,
159 qint64 line, qint64 column, QString &errorMessage);
161 virtual bool handleScanList(qint64 idx,
const QString &name, qint64 pch1, qint64 pch2, qint64 txch,
162 const QList<qint64> &channels, qint64 line, qint64 column, QString &errorMessage);
164 virtual bool handleRoamingZone(qint64 idx,
const QString &name,
const QList<qint64> &channels,
165 qint64 line, qint64 column, QString &errorMessage);
183 bool parse(QTextStream &stream);
262 static bool read(
Config *config, QTextStream &stream, QString &errorMessage);
264 virtual bool handleRadioId(
const QList<qint64> &ids, qint64 line, qint64 column, QString &errorMessage);
265 virtual bool handleRadioName(
const QString &name, qint64 line, qint64 column, QString &errorMessage);
266 virtual bool handleIntroLine1(
const QString &text, qint64 line, qint64 column, QString &errorMessage);
267 virtual bool handleIntroLine2(
const QString &text, qint64 line, qint64 column, QString &errorMessage);
268 virtual bool handleMicLevel(
unsigned level, qint64 line, qint64 column, QString &errorMessage);
269 virtual bool handleSpeech(
bool speech, qint64 line, qint64 column, QString &errorMessage);
270 virtual bool handleDTMFContact(qint64 idx,
const QString &name,
const QString &num,
bool rxTone,
271 qint64 line, qint64 column, QString &errorMessage);
273 qint64 idx,
const QString &name,
DMRContact::Type type, qint64
id,
bool rxTone,
274 qint64 line, qint64 column, QString &errorMessage);
275 virtual bool handleGroupList(qint64 idx,
const QString &name,
const QList<qint64> &contacts,
276 qint64 line, qint64 column, QString &errorMessage);
278 qint64 idx,
const QString &name,
double rx,
double tx,
Channel::Power power, qint64 scan,
280 qint64 gl, qint64 contact, qint64 gps, qint64 roam, qint64 radioID, qint64 line, qint64 column, QString &errorMessage);
282 qint64 idx,
const QString &name,
double rx,
double tx,
Channel::Power power, qint64 scan, qint64 aprs,
285 virtual bool handleZone(qint64 idx,
const QString &name,
bool a,
const QList<qint64> &channels,
286 qint64 line, qint64 column, QString &errorMessage);
287 virtual bool handleGPSSystem(qint64 idx,
const QString &name, qint64 contactIdx, qint64 period,
288 qint64 revertChannelIdx, qint64 line, qint64 column, QString &errorMessage);
289 virtual bool handleAPRSSystem(qint64 idx,
const QString &name, qint64 channelIdx, qint64 period,
290 const QString &src,
unsigned srcSSID,
const QString &dest,
unsigned destSSID,
const QString &path,
291 const QString &icon,
const QString &message,
292 qint64 line, qint64 column, QString &errorMessage);
293 virtual bool handleScanList(qint64 idx,
const QString &name, qint64 pch1, qint64 pch2, qint64 txch,
294 const QList<qint64> &channels, qint64 line, qint64 column, QString &errorMessage);
295 virtual bool handleRoamingZone(qint64 idx,
const QString &name,
const QList<qint64> &channels,
296 qint64 line, qint64 column, QString &errorMessage);
Basic parse-handler interface.
Definition: csvreader.hh:109
virtual ~CSVHandler()
Destructor.
Definition: csvreader.cc:100
virtual bool handleGPSSystem(qint64 idx, const QString &name, qint64 contactIdx, qint64 period, qint64 revertChannelIdx, qint64 line, qint64 column, QString &errorMessage)
Gets called once a GPS system has been parsed.
Definition: csvreader.cc:267
virtual bool handleScanList(qint64 idx, const QString &name, qint64 pch1, qint64 pch2, qint64 txch, const QList< qint64 > &channels, qint64 line, qint64 column, QString &errorMessage)
Gets called once a scan list has been parsed.
Definition: csvreader.cc:305
virtual bool handleMicLevel(unsigned level, qint64 line, qint64 column, QString &errorMessage)
Gets called once the MIC level has been parsed.
Definition: csvreader.cc:141
virtual bool handleGroupList(qint64 idx, const QString &name, const QList< qint64 > &contacts, qint64 line, qint64 column, QString &errorMessage)
Gets called once an RX group list has been parsed.
Definition: csvreader.cc:188
virtual bool handleSpeech(bool speech, qint64 line, qint64 column, QString &errorMessage)
Gets called once the Speech flag has been parsed.
Definition: csvreader.cc:150
virtual bool handleAnalogChannel(qint64 idx, const QString &name, double rx, double tx, Channel::Power power, qint64 scan, qint64 aprs, qint64 tot, bool ro, FMChannel::Admit admit, qint64 squelch, Signaling::Code rxTone, Signaling::Code txTone, FMChannel::Bandwidth bw, qint64 line, qint64 column, QString &errorMessage)
Gets called once a analog channel has been parsed.
Definition: csvreader.cc:228
virtual bool handleIntroLine2(const QString &text, qint64 line, qint64 column, QString &errorMessage)
Gets called once the second intro line has been parsed.
Definition: csvreader.cc:132
CSVHandler(QObject *parent=nullptr)
Hidden constructor.
Definition: csvreader.cc:94
virtual bool handleAPRSSystem(qint64 idx, const QString &name, qint64 channelIdx, qint64 period, const QString &src, unsigned srcSSID, const QString &dest, unsigned destSSID, const QString &path, const QString &icon, const QString &message, qint64 line, qint64 column, QString &errorMessage)
Gets called once a APRS system has been parsed.
Definition: csvreader.cc:283
virtual bool handleDTMFContact(qint64 idx, const QString &name, const QString &num, bool rxTone, qint64 line, qint64 column, QString &errorMessage)
Gets called once a DTMF contact has been parsed.
Definition: csvreader.cc:159
virtual bool handleZone(qint64 idx, const QString &name, bool a, const QList< qint64 > &channels, qint64 line, qint64 column, QString &errorMessage)
Gets called once a zone list has been parsed.
Definition: csvreader.cc:253
virtual bool handleRoamingZone(qint64 idx, const QString &name, const QList< qint64 > &channels, qint64 line, qint64 column, QString &errorMessage)
Gets called once a roaming zone list has been parsed.
Definition: csvreader.cc:321
virtual bool handleRadioName(const QString &name, qint64 line, qint64 column, QString &errorMessage)
Gets called once the radio name has been parsed.
Definition: csvreader.cc:114
virtual bool handleDigitalChannel(qint64 idx, const QString &name, double rx, double tx, Channel::Power power, qint64 scan, qint64 tot, bool ro, DMRChannel::Admit admit, qint64 color, DMRChannel::TimeSlot slot, qint64 gl, qint64 contact, qint64 gps, qint64 roam, qint64 radioID, qint64 line, qint64 column, QString &errorMessage)
Gets called once a digital channel has been parsed.
Definition: csvreader.cc:201
virtual bool handleRadioId(const QList< qint64 > &ids, qint64 line, qint64 column, QString &errorMessage)
Gets called once the DMR IDs has been parsed.
Definition: csvreader.cc:105
virtual bool handleIntroLine1(const QString &text, qint64 line, qint64 column, QString &errorMessage)
Gets called once the first intro line has been parsed.
Definition: csvreader.cc:123
virtual bool handleDigitalContact(qint64 idx, const QString &name, DMRContact::Type type, qint64 id, bool rxTone, qint64 line, qint64 column, QString &errorMessage)
Gets called once a digital contact has been parsed.
Definition: csvreader.cc:173
The lexer class divides a text stream into tokens.
Definition: csvreader.hh:23
static QVector< QPair< QRegExp, Token::TokenType > > _pattern
The list of patterns to match.
Definition: csvreader.hh:99
void pop()
Restores the last lexer state.
Definition: csvreader.cc:83
QVector< State > _stack
The stack of saved lexer states.
Definition: csvreader.hh:95
QString _currentLine
The current line count.
Definition: csvreader.hh:97
void push()
Saves the current lexer state.
Definition: csvreader.cc:78
QTextStream & _stream
The text stream to read from.
Definition: csvreader.hh:93
QString _errorMessage
The error message.
Definition: csvreader.hh:91
Token lex()
Internal used function to get the next token.
Definition: csvreader.cc:52
CSVLexer(QTextStream &stream, QObject *parent=nullptr)
Constructs a lexer for the given stream.
Definition: csvreader.cc:29
const QString & errorMessage() const
Returns the last error message.
Definition: csvreader.cc:39
Token next()
Reads the next token from the stream.
Definition: csvreader.cc:44
The actual config file parser.
Definition: csvreader.hh:175
bool _parse_userdb(CSVLexer &lexer)
Internal function to parse UserDB flag.
Definition: csvreader.cc:595
CSVHandler * _handler
The handler instance.
Definition: csvreader.hh:244
bool _parse_aprs_systems(CSVLexer &lexer)
Internal function to parse a APRS system list.
Definition: csvreader.cc:1401
bool _parse_analog_channel(qint64 id, CSVLexer &lexer)
Internal function to parse an analog channel.
Definition: csvreader.cc:1065
CSVParser(CSVHandler *handler, QObject *parent=nullptr)
Constructs a parser using the given handler instance.
Definition: csvreader.cc:337
bool _parse_contacts(CSVLexer &lexer)
Internal function to parse a digital contact list.
Definition: csvreader.cc:628
QString _errorMessage
Holds the current error message.
Definition: csvreader.hh:242
const QString & errorMessage() const
Returns the current error message, for example if parse returns false.
Definition: csvreader.cc:344
bool _parse_speech(CSVLexer &lexer)
Internal function to parse Speech flag.
Definition: csvreader.cc:565
bool _parse_digital_channel(qint64 id, CSVLexer &lexer)
Internal function to parse a digital channel.
Definition: csvreader.cc:817
bool _parse_zone(qint64 id, CSVLexer &lexer)
Internal function to parse a zone.
Definition: csvreader.cc:1281
bool _parse_radio_name(CSVLexer &lexer)
Internal function to parse radio names.
Definition: csvreader.cc:456
bool _parse_rx_groups(CSVLexer &lexer)
Internal function to parse an RX group list.
Definition: csvreader.cc:732
bool _parse_mic_level(CSVLexer &lexer)
Internal function to parse MIC level.
Definition: csvreader.cc:537
bool _parse_radio_id(CSVLexer &lexer)
Internal function to parse DMR IDs.
Definition: csvreader.cc:421
bool _parse_gps_systems(CSVLexer &lexer)
Internal function to parse a GPS system list.
Definition: csvreader.cc:1319
bool _parse_rx_group(qint64 id, CSVLexer &lexer)
Internal function to parse an RX group.
Definition: csvreader.cc:760
bool _parse_roaming_zone(qint64 id, CSVLexer &lexer)
Internal function to parse a zone.
Definition: csvreader.cc:1676
bool _parse_scanlists(CSVLexer &lexer)
Internal function to parse a scanlist list.
Definition: csvreader.cc:1532
bool parse(QTextStream &stream)
Parses the given text stream.
Definition: csvreader.cc:349
bool _parse_scanlist(qint64 id, CSVLexer &lexer)
Internal function to parse a scanlist.
Definition: csvreader.cc:1560
bool _parse_contact(qint64 id, CSVLexer &lexer)
Internal function to parse digital contact.
Definition: csvreader.cc:656
bool _parse_introline1(CSVLexer &lexer)
Internal function to parse intro line 1.
Definition: csvreader.cc:483
bool _parse_gps_system(qint64 id, CSVLexer &lexer)
Internal function to parse a GPS system.
Definition: csvreader.cc:1347
bool _parse_zones(CSVLexer &lexer)
Internal function to parse a zone list.
Definition: csvreader.cc:1253
bool _parse_introline2(CSVLexer &lexer)
Internal function to parse intro line 2.
Definition: csvreader.cc:510
bool _parse_digital_channels(CSVLexer &lexer)
Internal function to parse a digital channel list.
Definition: csvreader.cc:789
bool _parse_aprs_system(qint64 id, CSVLexer &lexer)
Internal function to parse a APRS system.
Definition: csvreader.cc:1429
bool _parse_roaming_zones(CSVLexer &lexer)
Internal function to parse a roaming zone list.
Definition: csvreader.cc:1648
bool _parse_analog_channels(CSVLexer &lexer)
Internal function to parse an analog channel list.
Definition: csvreader.cc:1037
Implements the text-file codeplug reader.
Definition: csvreader.hh:252
virtual bool handleGPSSystem(qint64 idx, const QString &name, qint64 contactIdx, qint64 period, qint64 revertChannelIdx, qint64 line, qint64 column, QString &errorMessage)
Gets called once a GPS system has been parsed.
Definition: csvreader.cc:2091
QMap< int, DMRRadioID * > _radioIDs
Index <-> radio ID map.
Definition: csvreader.hh:318
QMap< int, Channel * > _channels
Index <-> Channel map.
Definition: csvreader.hh:304
virtual bool handleRadioName(const QString &name, qint64 line, qint64 column, QString &errorMessage)
Gets called once the radio name has been parsed.
Definition: csvreader.cc:1764
virtual bool handleAPRSSystem(qint64 idx, const QString &name, qint64 channelIdx, qint64 period, const QString &src, unsigned srcSSID, const QString &dest, unsigned destSSID, const QString &path, const QString &icon, const QString &message, qint64 line, qint64 column, QString &errorMessage)
Gets called once a APRS system has been parsed.
Definition: csvreader.cc:2138
virtual bool handleAnalogChannel(qint64 idx, const QString &name, double rx, double tx, Channel::Power power, qint64 scan, qint64 aprs, qint64 tot, bool ro, FMChannel::Admit admit, qint64 squelch, Signaling::Code rxTone, Signaling::Code txTone, FMChannel::Bandwidth bw, qint64 line, qint64 column, QString &errorMessage)
Gets called once a analog channel has been parsed.
Definition: csvreader.cc:2001
virtual bool handleGroupList(qint64 idx, const QString &name, const QList< qint64 > &contacts, qint64 line, qint64 column, QString &errorMessage)
Gets called once an RX group list has been parsed.
Definition: csvreader.cc:1869
CSVReader(Config *config, QObject *parent=nullptr)
Hidden constructor.
Definition: csvreader.cc:1708
virtual bool handleIntroLine1(const QString &text, qint64 line, qint64 column, QString &errorMessage)
Gets called once the first intro line has been parsed.
Definition: csvreader.cc:1776
static bool read(Config *config, QTextStream &stream, QString &errorMessage)
Reads a config file from stream and stores the read configuration into config.
Definition: csvreader.cc:1716
Config * _config
The configuration to read.
Definition: csvreader.hh:302
virtual bool handleZone(qint64 idx, const QString &name, bool a, const QList< qint64 > &channels, qint64 line, qint64 column, QString &errorMessage)
Gets called once a zone list has been parsed.
Definition: csvreader.cc:2060
QMap< int, PositioningSystem * > _posSystems
Index <-> GPS System map.
Definition: csvreader.hh:312
virtual bool handleDigitalChannel(qint64 idx, const QString &name, double rx, double tx, Channel::Power power, qint64 scan, qint64 tot, bool ro, DMRChannel::Admit admit, qint64 color, DMRChannel::TimeSlot slot, qint64 gl, qint64 contact, qint64 gps, qint64 roam, qint64 radioID, qint64 line, qint64 column, QString &errorMessage)
Gets called once a digital channel has been parsed.
Definition: csvreader.cc:1902
QMap< int, ScanList * > _scanlists
Index <-> Scan list map.
Definition: csvreader.hh:314
virtual bool handleIntroLine2(const QString &text, qint64 line, qint64 column, QString &errorMessage)
Gets called once the second intro line has been parsed.
Definition: csvreader.cc:1788
virtual bool handleScanList(qint64 idx, const QString &name, qint64 pch1, qint64 pch2, qint64 txch, const QList< qint64 > &channels, qint64 line, qint64 column, QString &errorMessage)
Gets called once a scan list has been parsed.
Definition: csvreader.cc:2178
bool _link
If true, the reader is in "link" mode.
Definition: csvreader.hh:300
virtual bool handleMicLevel(unsigned level, qint64 line, qint64 column, QString &errorMessage)
Gets called once the MIC level has been parsed.
Definition: csvreader.cc:1800
virtual bool handleRoamingZone(qint64 idx, const QString &name, const QList< qint64 > &channels, qint64 line, qint64 column, QString &errorMessage)
Gets called once a roaming zone list has been parsed.
Definition: csvreader.cc:2250
QMap< int, DMRContact * > _digital_contacts
Index <-> Digital contact map.
Definition: csvreader.hh:306
virtual bool handleDigitalContact(qint64 idx, const QString &name, DMRContact::Type type, qint64 id, bool rxTone, qint64 line, qint64 column, QString &errorMessage)
Gets called once a digital contact has been parsed.
Definition: csvreader.cc:1848
virtual bool handleSpeech(bool speech, qint64 line, qint64 column, QString &errorMessage)
Gets called once the Speech flag has been parsed.
Definition: csvreader.cc:1813
QMap< int, Zone * > _zones
Index <-> Zone map.
Definition: csvreader.hh:310
QMap< int, RoamingZone * > _roamingZones
Index <-> RoamingZone map.
Definition: csvreader.hh:316
virtual bool handleDTMFContact(qint64 idx, const QString &name, const QString &num, bool rxTone, qint64 line, qint64 column, QString &errorMessage)
Gets called once a DTMF contact has been parsed.
Definition: csvreader.cc:1826
QMap< int, RXGroupList * > _rxgroups
Index <-> RX group list map.
Definition: csvreader.hh:308
virtual bool handleRadioId(const QList< qint64 > &ids, qint64 line, qint64 column, QString &errorMessage)
Gets called once the DMR IDs has been parsed.
Definition: csvreader.cc:1746
Power
Specifies the prefix for every ID assigned to every channel during serialization.
Definition: channel.hh:61
The config class, representing the codeplug configuration.
Definition: config.hh:70
TimeSlot
Possible timeslots for digital channels.
Definition: channel.hh:389
Admit
Possible admit criteria of digital channels.
Definition: channel.hh:381
Admit
Admit criteria of analog channel.
Definition: channel.hh:232
Bandwidth
Possible bandwidth of an analog channel.
Definition: channel.hh:240
Base class of the positioning systems, that is APRS and DMR position reporting system.
Definition: gpssystem.hh:17
Generic representation of a RX group list.
Definition: rxgrouplist.hh:14
Represents a RoamingZone within the abstract device configuration.
Definition: roamingzone.hh:15
Generic representation of a scan list.
Definition: scanlist.hh:15
Code
This huge enum lists all possible RX/TX tones that can be associated with analog channels.
Definition: signaling.hh:18
Represents a zone within the generic configuration.
Definition: zone.hh:15
Current state of lexer.
Definition: csvreader.hh:62
qint64 column
The current column number.
Definition: csvreader.hh:68
qint64 line
The current line count.
Definition: csvreader.hh:66
qint64 offset
The current stream offset.
Definition: csvreader.hh:64
The token.
Definition: csvreader.hh:28
QString value
The token value.
Definition: csvreader.hh:54
qint64 line
Line number.
Definition: csvreader.hh:56
qint64 column
Column number.
Definition: csvreader.hh:58
TokenType type
The token type.
Definition: csvreader.hh:52
TokenType
Possible token types.
Definition: csvreader.hh:31
@ T_ERROR
Indicates a lexer error.
Definition: csvreader.hh:48
@ T_APRSCALL
A APRS call of form CALL-SSID.
Definition: csvreader.hh:33
@ T_STRING
A quoted string.
Definition: csvreader.hh:34
@ T_COMMA
A comma.
Definition: csvreader.hh:41
@ T_DCS_N
A normal DCS code number.
Definition: csvreader.hh:36
@ T_COLON
A colon.
Definition: csvreader.hh:38
@ T_NEWLINE
A new line.
Definition: csvreader.hh:44
@ T_WHITESPACE
Any whitespace character excluding newline.
Definition: csvreader.hh:43
@ T_ENABLED
A plus sign, being used as "enabled".
Definition: csvreader.hh:40
@ T_DCS_I
An inverted DCS code number.
Definition: csvreader.hh:37
@ T_NOT_SET
A dash, being used as "not-set".
Definition: csvreader.hh:39
@ T_COMMENT
A comment starts with # end ends at the line-end.
Definition: csvreader.hh:45
@ T_END_OF_STREAM
Indicates the end-of-input.
Definition: csvreader.hh:47
@ T_KEYWORD
A Keyword/Identifier.
Definition: csvreader.hh:32
@ T_NUMBER
An integer or floating point number.
Definition: csvreader.hh:35