KiCad PCB EDA Suite
Loading...
Searching...
No Matches
sch_io_kicad_legacy_helpers.h
Go to the documentation of this file.
1/*
2 * This program source code file is part of KiCad, a free EDA CAD application.
3 *
4 * Copyright (C) 2022 KiCad Developers, see AUTHORS.txt for contributors.
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version 2
9 * of the License, or (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License along
17 * with this program. If not, see <http://www.gnu.org/licenses/>.
18 */
19
20#ifndef SCH_IO_KICAD_LEGACY_HELPERS_H_
21#define SCH_IO_KICAD_LEGACY_HELPERS_H_
22
23#include <cstdint>
24
25
26#define SCH_PARSE_ERROR( text, reader, pos ) \
27 THROW_PARSE_ERROR( text, reader.GetSource(), reader.Line(), \
28 reader.LineNumber(), pos - reader.Line() )
29
30
31class LINE_READER;
32class wxString;
33
34
35extern bool is_eol( char c );
36
46extern bool strCompare( const char* aString, const char* aLine, const char** aOutput = nullptr );
47
61extern int parseInt( LINE_READER& aReader, const char* aLine, const char** aOutput = nullptr );
62
76extern uint32_t parseHex( LINE_READER& aReader, const char* aLine, const char** aOutput = nullptr );
77
91extern double parseDouble( LINE_READER& aReader, const char* aLine,
92 const char** aOutput = nullptr );
93
105extern char parseChar( LINE_READER& aReader, const char* aCurrentToken,
106 const char** aNextToken = nullptr );
107
122extern void parseUnquotedString( wxString& aString, LINE_READER& aReader, const char* aCurrentToken,
123 const char** aNextToken = nullptr, bool aCanBeEmpty = false );
124
140extern void parseQuotedString( wxString& aString, LINE_READER& aReader, const char* aCurrentToken,
141 const char** aNextToken = nullptr, bool aCanBeEmpty = false );
142
143
144
145#endif // SCH_IO_KICAD_LEGACY_HELPERS_H_
An abstract class from which implementation specific LINE_READERs may be derived to read single lines...
Definition: richio.h:93
uint32_t parseHex(LINE_READER &aReader, const char *aLine, const char **aOutput=nullptr)
Parse an ASCII hex integer string with possible leading whitespace into a long integer and updates th...
void parseQuotedString(wxString &aString, LINE_READER &aReader, const char *aCurrentToken, const char **aNextToken=nullptr, bool aCanBeEmpty=false)
Parse an quoted ASCII utf8 and updates the pointer at aOutput if it is not NULL.
void parseUnquotedString(wxString &aString, LINE_READER &aReader, const char *aCurrentToken, const char **aNextToken=nullptr, bool aCanBeEmpty=false)
Parse an unquoted utf8 string and updates the pointer at aOutput if it is not NULL.
bool strCompare(const char *aString, const char *aLine, const char **aOutput=nullptr)
Compare aString to the string starting at aLine and advances the character point to the end of String...
char parseChar(LINE_READER &aReader, const char *aCurrentToken, const char **aNextToken=nullptr)
Parse a single ASCII character and updates the pointer at aOutput if it is not NULL.
double parseDouble(LINE_READER &aReader, const char *aLine, const char **aOutput=nullptr)
Parses an ASCII point string with possible leading whitespace into a double precision floating point ...
int parseInt(LINE_READER &aReader, const char *aLine, const char **aOutput=nullptr)
Parse an ASCII integer string with possible leading whitespace into an integer and updates the pointe...
bool is_eol(char c)