root/src/Writer.h

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
////////////////////////////////////////////////////////////////////////
// Copyright (c) Nehmulos 2011-2014
// This file is part of N0 Strain Serialization Library.
//
// N0Strain-Serialization-Library is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// N0Strain-Serialization-Library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with N0Strain-Serialization-Library.  If not, see https://gnu.org/licenses/lgpl-3.0
////////////////////////////////////////////////////////////////////////

#pragma once

#include "Describer.h"

namespace nw {

class Writer : public Describer {
public:
        virtual void describeValueConst(const bool&)            = 0;
        virtual void describeValueConst(const char&)            = 0;
        virtual void describeValueConst(const unsigned char&)   = 0;
        virtual void describeValueConst(const signed char&)     = 0;
        //2 byte
        virtual void describeValueConst(const short&)           = 0;
        virtual void describeValueConst(const unsigned short&)  = 0;
        //4 byte
        virtual void describeValueConst(const int&)             = 0;
        virtual void describeValueConst(const unsigned int&)    = 0;
        virtual void describeValueConst(const long&)            = 0;
        virtual void describeValueConst(const unsigned long&)   = 0;
        virtual void describeValueConst(const float&)           = 0;
        virtual void describeValueConst(const Pointer)          = 0;
        //8 byte
        virtual void describeValueConst(const double&)          = 0;
        virtual void describeValueConst(const long long&)       = 0;
        //12 byte
        virtual void describeValueConst(const long double&)     = 0;
        //variable size
        virtual void describeValueConst(const String&)          = 0;
        virtual void describeBlobConst(const String blobName, const nw::Pointer binaryBlob, unsigned int blobSize) = 0;

        inline void describeConst(const String childName,const bool& ref)           {describeName(childName); describeValueConst(ref);}
        inline void describeConst(const String childName,const char& ref)           {describeName(childName); describeValueConst(ref);}
        inline void describeConst(const String childName,const unsigned char& ref)  {describeName(childName); describeValueConst(ref);}
        inline void describeConst(const String childName,const signed char& ref)    {describeName(childName); describeValueConst(ref);}
        inline void describeConst(const String childName,const short& ref)          {describeName(childName); describeValueConst(ref);}
        inline void describeConst(const String childName,const unsigned short& ref) {describeName(childName); describeValueConst(ref);}
        inline void describeConst(const String childName,const int& ref)            {describeName(childName); describeValueConst(ref);}
        inline void describeConst(const String childName,const unsigned int& ref)   {describeName(childName); describeValueConst(ref);}
        inline void describeConst(const String childName,const long& ref)           {describeName(childName); describeValueConst(ref);}
        inline void describeConst(const String childName,const unsigned long& ref)  {describeName(childName); describeValueConst(ref);}
        inline void describeConst(const String childName,const float& ref)          {describeName(childName); describeValueConst(ref);}
        inline void describeConst(const String childName,const Pointer ref)         {describeName(childName); describeValueConst(ref);}
        inline void describeConst(const String childName,const double& ref)         {describeName(childName); describeValueConst(ref);}
        inline void describeConst(const String childName,const long long& ref)      {describeName(childName); describeValueConst(ref);}
        inline void describeConst(const String childName,const long double& ref)    {describeName(childName); describeValueConst(ref);}
        inline void describeConst(const String childName,const String& ref)         {describeName(childName); describeValueConst(ref);}

        inline void describeValue(bool& value) final           {describeValueConst(value);}
        inline void describeValue(char& value) final           {describeValueConst(value);}
        inline void describeValue(unsigned char& value) final   {describeValueConst(value);}
        inline void describeValue(signed char& value) final    {describeValueConst(value);}
        //2 byte
        inline void describeValue(short& value) final          {describeValueConst(value);}
        inline void describeValue(unsigned short& value) final {describeValueConst(value);}
        //4 byte
        inline void describeValue(int& value) final            {describeValueConst(value);}
        inline void describeValue(unsigned int& value) final    {describeValueConst(value);}
        inline void describeValue(long& value) final           {describeValueConst(value);}
        inline void describeValue(unsigned long& value) final   {describeValueConst(value);}
        inline void describeValue(float& value) final          {describeValueConst(value);}
        inline void describeValue(Pointer value) final         {describeValueConst(value);}
        //8 byte
        inline void describeValue(double& value) final         {describeValueConst(value);}
        inline void describeValue(long long& value) final      {describeValueConst(value);}
        //12 byte
        inline void describeValue(long double& value) final    {describeValueConst(value);}
        //variable size
        inline void describeValue(String& value) final         {describeValueConst(value);}
        inline void describeBlob(const String blobName, const nw::Pointer binaryBlob, unsigned int blobSize) final {describeBlobConst(blobName, binaryBlob, blobSize);}
};

}  // namespace nw