AnCH Framework 0.2
Another C++ Hack: C++23 utility libraries
Loading...
Searching...
No Matches
primitiveMapper.hpp
1/*
2 ANCH Framework: ANother C++ Hack is a C++ framework based on C++23 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 <https://www.gnu.org/licenses/>.
19*/
20#pragma once
21
22#include "anch-json-export.hpp"
23
24#include <string>
25#include <vector>
26#include <map>
27#include <ostream>
28#include <functional>
29#include <list>
30#include <set>
31#include <map>
32
33#include "json/genericMapper.hpp"
34#include "json/constants.hpp"
35#include "json/mappingOptions.hpp"
36
37
38namespace anch::json {
39
40 // JSON mapper early declaration
41 template<typename T>
42 class Factory;
43
55 template<typename T>
56 class ANCH_JSON_EXPORT PrimitiveMapper: public anch::json::GenericMapper<PrimitiveMapper<T>, T> {
57 friend class anch::json::Factory<T>;
58
59 // Constructors +
60 private:
64 PrimitiveMapper();
65
66 public:
72 PrimitiveMapper(const PrimitiveMapper& other) = delete;
73
79 PrimitiveMapper(PrimitiveMapper&& other) = delete;
80 // Constructors -
81
82 // Destructor +
83 private:
87 virtual ~PrimitiveMapper();
88 // Destructor -
89
90 // Methods +
91 public:
98 void serializeValue(const T& value, anch::json::WriterContext& context) const;
99
108 bool deserializeValue(T& value, anch::json::ReaderContext& context) const;
109 // Methods -
110
111 };
112
113} // anch::json
JSON mapper factory.
Definition factory.hpp:54
Generic mapper.
Definition genericMapper.hpp:49
bool deserializeValue(T &value, anch::json::ReaderContext &context) const
void serializeValue(const T &value, anch::json::WriterContext &context) const
PrimitiveMapper(PrimitiveMapper &&other)=delete
PrimitiveMapper(const PrimitiveMapper &other)=delete
JSON reader context.
Definition readerContext.hpp:44
JSON writer context.
Definition writerContext.hpp:45
JSON namespace.
Definition constants.hpp:27