AnCH Framework 0.1
Another C++ Hack Framework
 
Loading...
Searching...
No Matches
lexer.hpp
1/*
2 ANCH Framework: ANother C++ Hack is a C++ framework based on C++11 standard
3 Copyright (C) 2020 Vincent Lachenal
4
5 This file is part of ANCH Framework.
6
7 ANCH Framework is free software: you can redistribute it and/or modify
8 it under the terms of the GNU Lesser General Public License as published by
9 the Free Software Foundation, either version 3 of the License, or
10 (at your option) any later version.
11
12 ANCH Framework is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU Lesser General Public License for more details.
16
17 You should have received a copy of the GNU Lesser General Public License
18 along with ANCH Framework. If not, see <http://www.gnu.org/licenses/>.
19*/
20#pragma once
21
22#include <string>
23#include <optional>
24#include <map>
25#include <set>
26#include <functional>
27
28#include "json/readerContext.hpp"
29#include "json/mappingError.hpp"
30
31namespace anch::json {
32
33 // Types' definitions +
35 using LexFunc = std::function<bool(anch::json::ReaderContext&)>;
36
38 using AddItem = std::function<bool(anch::json::ReaderContext&)>;
39
41 using PushItem = std::function<void(const std::string&, anch::json::ReaderContext&)>;
42
44 using jint = int64_t;
45
47 using juint = uint64_t;
48
50 using jfloat = long double;
51 // Types' definitions -
52
53 // Boolean lexer functions +
62
71
83 bool lexBoolean(bool& value, anch::json::ReaderContext& context);
84 // Boolean lexer functions -
85
86 // Integer lexer functions +
93
106
119 // Integer lexer functions -
120
121 // Number lexer functions +
129
141 bool lexNumber(double& value, anch::json::ReaderContext& context);
142 // Number lexer functions -
143
144 // String lexer functions +
152
166 bool lexString(std::string& value, anch::json::ReaderContext& context);
167
181 bool lexField(std::string& field, anch::json::ReaderContext& context);
182 // String lexer functions -
183
184 // Generic lexer functions +
195
206
215
226
236 void lexObject(const std::map<std::string, anch::json::LexFunc>& readers,
237 std::set<std::string>& fields,
239 // Generic lexer functions -
240
241 // Container lexer functions +
251
261 // Container lexer functions -
262
263 // Unknown lexer functions +
272
281 // Unknown lexer functions +
282
283}
JSON mapper context.
Definition readerContext.hpp:42
JSON namespace.
Definition constants.hpp:25
bool objectHasValueLex(anch::json::ReaderContext &context)
bool lexNumber(double &value, anch::json::ReaderContext &context)
void lexFalse(anch::json::ReaderContext &context)
bool lexInteger(anch::json::jint &value, anch::json::ReaderContext &context)
void lexTrue(anch::json::ReaderContext &context)
char lexDiscard(anch::json::ReaderContext &context)
void lexArray(anch::json::AddItem addFunc, anch::json::ReaderContext &context)
void lexMap(anch::json::PushItem pushFunc, anch::json::ReaderContext &context)
std::function< void(const std::string &, anch::json::ReaderContext &)> PushItem
Definition lexer.hpp:41
long double jfloat
Definition lexer.hpp:50
void lexUnknownFail(anch::json::ReaderContext &context)
void lexObject(const std::map< std::string, anch::json::LexFunc > &readers, std::set< std::string > &fields, anch::json::ReaderContext &context)
void lexUnknown(anch::json::ReaderContext &context)
std::function< bool(anch::json::ReaderContext &)> AddItem
Definition lexer.hpp:38
void lexNull(anch::json::ReaderContext &context)
bool lexUInteger(anch::json::juint &value, anch::json::ReaderContext &context)
int64_t jint
Definition lexer.hpp:44
char discardFail(anch::json::ReaderContext &context)
void lexStringContent(anch::json::ReaderContext &context)
bool lexField(std::string &field, anch::json::ReaderContext &context)
void parseDecimal(anch::json::ReaderContext &context)
bool lexString(std::string &value, anch::json::ReaderContext &context)
std::function< bool(anch::json::ReaderContext &)> LexFunc
Definition lexer.hpp:35
void parseNumber(anch::json::ReaderContext &context)
bool lexBoolean(bool &value, anch::json::ReaderContext &context)
uint64_t juint
Definition lexer.hpp:47