\doxysection{DSNParser\+Base.\+hpp}
\hypertarget{DSNParserBase_8hpp_source}{}\label{DSNParserBase_8hpp_source}\index{/home/chr/devel/PhD/Environment/pub/PCBEnv/pcbenv/cxx/Loaders/DSNParserBase.hpp@{/home/chr/devel/PhD/Environment/pub/PCBEnv/pcbenv/cxx/Loaders/DSNParserBase.hpp}}

\begin{DoxyCode}{0}
\DoxyCodeLine{00001\ }
\DoxyCodeLine{00002\ \textcolor{preprocessor}{\#ifndef\ GYM\_PCB\_LOADERS\_DSNPARSERBASE\_H}}
\DoxyCodeLine{00003\ \textcolor{preprocessor}{\#define\ GYM\_PCB\_LOADERS\_DSNPARSERBASE\_H}}
\DoxyCodeLine{00004\ }
\DoxyCodeLine{00005\ \textcolor{preprocessor}{\#include\ "{}Loaders/DSN.hpp"{}}}
\DoxyCodeLine{00006\ \textcolor{preprocessor}{\#include\ <cassert>}}
\DoxyCodeLine{00007\ \textcolor{preprocessor}{\#include\ <iostream>}}
\DoxyCodeLine{00008\ \textcolor{preprocessor}{\#include\ <iterator>}}
\DoxyCodeLine{00009\ \textcolor{preprocessor}{\#include\ <regex>}}
\DoxyCodeLine{00010\ }
\DoxyCodeLine{00011\ \textcolor{keyword}{class\ }Token}
\DoxyCodeLine{00012\ \{}
\DoxyCodeLine{00013\ \textcolor{keyword}{public}:}
\DoxyCodeLine{00014\ \ \ \ \ Token(\textcolor{keyword}{const}\ std::string\ \&s)\ :\ \_s(s)\ \{\ \}}
\DoxyCodeLine{00015\ \ \ \ \ \textcolor{keywordtype}{size\_t}\ length()\textcolor{keyword}{\ const\ }\{\ \textcolor{keywordflow}{return}\ \_s.size();\ \}}
\DoxyCodeLine{00016\ \ \ \ \ \textcolor{keyword}{const}\ std::string\&\ String()\textcolor{keyword}{\ const\ }\{\ \textcolor{keywordflow}{return}\ \_s;\ \}}
\DoxyCodeLine{00017\ \ \ \ \ int64\_t\ Int64()\textcolor{keyword}{\ const\ }\{\ \textcolor{keywordflow}{return}\ std::stol(\_s);\ \}}
\DoxyCodeLine{00018\ \ \ \ \ \textcolor{keywordtype}{int}\ AngleDeg()\ \textcolor{keyword}{const};}
\DoxyCodeLine{00019\ \ \ \ \ \textcolor{keywordtype}{double}\ Float64()\ \textcolor{keyword}{const};}
\DoxyCodeLine{00020\ \ \ \ \ \textcolor{keywordtype}{bool}\ Bool()\ \textcolor{keyword}{const};}
\DoxyCodeLine{00021\ \textcolor{keyword}{private}:}
\DoxyCodeLine{00022\ \ \ \ \ \textcolor{keyword}{const}\ std::string\ \_s;}
\DoxyCodeLine{00023\ \};}
\DoxyCodeLine{00024\ \textcolor{keyword}{inline}\ \textcolor{keywordtype}{double}\ Token::Float64()\textcolor{keyword}{\ const}}
\DoxyCodeLine{00025\ \textcolor{keyword}{}\{}
\DoxyCodeLine{00026\ \ \ \ \ \textcolor{keywordtype}{double}\ d;}
\DoxyCodeLine{00027\ \ \ \ \ std::from\_chars(\_s.data(),\ \_s.data()\ +\ \_s.size(),\ d);}
\DoxyCodeLine{00028\ \ \ \ \ \textcolor{keywordflow}{return}\ d;}
\DoxyCodeLine{00029\ \}}
\DoxyCodeLine{00030\ }
\DoxyCodeLine{00031\ \textcolor{keyword}{class\ }DSNParserBase}
\DoxyCodeLine{00032\ \{}
\DoxyCodeLine{00033\ \textcolor{keyword}{public}:}
\DoxyCodeLine{00034\ \ \ \ \ DSNParserBase(\mbox{\hyperlink{structdsn_1_1Data}{dsn::Data}}\&);}
\DoxyCodeLine{00035\ \ \ \ \ \textcolor{keyword}{virtual}\ \textcolor{keywordtype}{bool}\ parse(\textcolor{keyword}{const}\ std::string\&)\ =\ 0;}
\DoxyCodeLine{00036\ \textcolor{keyword}{protected}:}
\DoxyCodeLine{00037\ \ \ \ \ \mbox{\hyperlink{structdsn_1_1Data}{dsn::Data}}\ \&mData;}
\DoxyCodeLine{00038\ \ \ \ \ \textcolor{keywordtype}{char}\ mStringQuote\{0\};}
\DoxyCodeLine{00039\ \ \ \ \ \textcolor{keywordtype}{char}\ mEscapeChar\{0\};}
\DoxyCodeLine{00040\ \ \ \ \ \textcolor{keywordtype}{bool}\ mQuoteOpen\{\textcolor{keyword}{false}\};}
\DoxyCodeLine{00041\ \ \ \ \ \textcolor{keywordtype}{bool}\ mEscapeActive\{\textcolor{keyword}{false}\};}
\DoxyCodeLine{00042\ \textcolor{keyword}{protected}:}
\DoxyCodeLine{00043\ \ \ \ \ \textcolor{keywordtype}{bool}\ checkQuote(\textcolor{keywordtype}{char}\ c);}
\DoxyCodeLine{00044\ \ \ \ \ \textcolor{keywordtype}{void}\ resetQuote();}
\DoxyCodeLine{00045\ \ \ \ \ \textcolor{keywordtype}{int}\ isBracket(\textcolor{keywordtype}{char}\ c)\ \textcolor{keyword}{const};}
\DoxyCodeLine{00046\ \ \ \ \ \textcolor{keywordtype}{int}\ checkBracket(\textcolor{keywordtype}{char}\ c);}
\DoxyCodeLine{00047\ \ \ \ \ \textcolor{keywordtype}{size\_t}\ nextBracket(\textcolor{keyword}{const}\ std::string\&,\ \textcolor{keywordtype}{int}\ dir);}
\DoxyCodeLine{00048\ \ \ \ \ \textcolor{keywordtype}{size\_t}\ skipspace(\textcolor{keyword}{const}\ std::string\&,\ \textcolor{keywordtype}{size\_t}\ pos)\ \textcolor{keyword}{const};}
\DoxyCodeLine{00049\ \ \ \ \ \textcolor{keywordtype}{size\_t}\ skipspaceRev(\textcolor{keyword}{const}\ std::string\&,\ \textcolor{keywordtype}{size\_t}\ minPos,\ \textcolor{keywordtype}{size\_t}\ pos)\ \textcolor{keyword}{const};}
\DoxyCodeLine{00050\ \ \ \ \ std::vector<std::string>\ gather(\textcolor{keyword}{const}\ std::string\&,\ \textcolor{keyword}{const}\ \textcolor{keywordtype}{char}\ *name,\ \textcolor{keyword}{const}\ \textcolor{keywordtype}{int}\ depth\ =\ 1);}
\DoxyCodeLine{00051\ \ \ \ \ std::vector<std::string>\ gatherArray(\textcolor{keyword}{const}\ std::string\&);}
\DoxyCodeLine{00052\ \ \ \ \ std::vector<Token>\ tokenize(\textcolor{keyword}{const}\ std::string\&);}
\DoxyCodeLine{00053\ \ \ \ \ \mbox{\hyperlink{classToken}{Token}}\ firstToken(\textcolor{keyword}{const}\ std::string\&,\ \textcolor{keywordtype}{size\_t}\ *from\ =\ 0);}
\DoxyCodeLine{00054\ \ \ \ \ std::string\ unquote(\textcolor{keyword}{const}\ std::string\&)\ \textcolor{keyword}{const};}
\DoxyCodeLine{00055\ \ \ \ \ std::string\ unquotePin(\textcolor{keyword}{const}\ std::string\&);}
\DoxyCodeLine{00056\ \ \ \ \ std::string\ noHyphen(std::string)\ \textcolor{keyword}{const};}
\DoxyCodeLine{00057\ }
\DoxyCodeLine{00058\ \ \ \ \ \textcolor{keywordtype}{int}\ unitToExp10(\textcolor{keyword}{const}\ std::string\&)\ \textcolor{keyword}{const};}
\DoxyCodeLine{00059\ \ \ \ \ \textcolor{keywordtype}{char}\ parseSide(\textcolor{keyword}{const}\ std::string\&)\ \textcolor{keyword}{const};}
\DoxyCodeLine{00060\ \};}
\DoxyCodeLine{00061\ }
\DoxyCodeLine{00062\ \textcolor{keyword}{inline}\ std::string\ DSNParserBase::noHyphen(std::string\ s)\textcolor{keyword}{\ const}}
\DoxyCodeLine{00063\ \textcolor{keyword}{}\{}
\DoxyCodeLine{00064\ \ \ \ \ \textcolor{keywordflow}{for}\ (\textcolor{keyword}{auto}\ \&c\ :\ s)}
\DoxyCodeLine{00065\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}\ (c\ ==\ \textcolor{charliteral}{'-\/'})}
\DoxyCodeLine{00066\ \ \ \ \ \ \ \ \ \ \ \ \ c\ =\ \textcolor{charliteral}{'\_'};}
\DoxyCodeLine{00067\ \ \ \ \ \textcolor{keywordflow}{return}\ s;}
\DoxyCodeLine{00068\ \}}
\DoxyCodeLine{00069\ }
\DoxyCodeLine{00070\ \textcolor{preprocessor}{\#endif\ }\textcolor{comment}{//\ GYM\_PCB\_LOADERS\_DSNPARSERBASE\_H}}

\end{DoxyCode}
