Giter Site home page Giter Site logo

loki-astari / thorsserializer Goto Github PK

View Code? Open in Web Editor NEW
309.0 21.0 70.0 5.45 MB

C++ Serialization library for JSON

License: MIT License

Makefile 0.12% C++ 98.31% M4 0.09% Roff 1.33% HTML 0.08% Python 0.08%
c-plus-plus serialization serialization-library json yaml review json-pointer json-serialization json-serialization-library stl-containers

thorsserializer's Introduction

ThorsSerializer

Support for

Build Status codecov.io
Code Review Code Review Code Review Code Review

Conan package Brew package

Benchmark Results

Conformance mac linux
Performance max linux
For details see: JsonBenchmark

ThorStream

Yet another JSON/YAML/BSON serialization library for C++.

Unlike other libraries this one does not require you to build DOM of you object before serialization. Using a declarative C++ style you define what C++ classes (and members) you want to serialize "ThorSerializer" will generate the appropriate code automagically.

HomeBrew

Can be installed via brew on Mac and Linux

brew install thors-serializer

Header Only

To install header only version

git clone --single-branch --branch header-only https://github.com/Loki-Astari/ThorsSerializer.git

Version 2

I have deprecated the jsonImport() and jsonExport() functions. These have been replaced with jsonImporter() and jsonExporter() functions (though the original versions still exist but are marked [[deprecated]]). The main difference is that the new functions catch exceptions (by default) this makes the serialization work like normal C++ serialization and simply set the bad bit on the stream.

Contributors

Added the all-contributers bot to generate the table.


One Page

thorsserializer's People

Contributors

loki-astari avatar scgroot avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

thorsserializer's Issues

Is it possible to generate JSON schema from a class declaration?

It would greatly benefit the non-C++ programs or human to communicate with C++ programs via JSON.
I know there is no exact mapping between C++ and JSON, but even the intersection would be helpful.
E.g.

class Car {
  enum MAKE {
    Toyota,
    BMW,
    Ford
  };
  MAKE make;
  std::string model;
  int year = 2008;
  std::vector<float> prices;
};

Could generate such a schema:

{
          type: "object",
          title: "Car",
          properties: {
            make: {
              type: "string",
              enum: [
                "Toyota",
                "BMW",
                "Honda",
                "Ford",
                "Chevy",
                "VW"
              ]
            },
            model: {
              type: "string"
            },
            year: {
              type: "integer",
              default: 2008
            },
            prices: {
              type: "array",
              items: {
                type: "number"
              }
            }
          }
}

So other programs or human can know what kind of data the C++ part is expecting.

Is "__type" not required to be the first property anymore?

The documentation states that "__type" has to be the first property when polymorphic types are used: https://github.com/Loki-Astari/ThorsSerializer/blob/master/doc/full.md#example-3-see-docexample3cpp

I noticed that a partner using the REST webservice we provide uses a JSON client that automatically sorts members and it thinks "__type" should be sorted as "type". Thus, it does not appear as the first property of the JSON anymore. But there is no exception from ThorsSerializer.

Is it not required any more that it has to be the first property?

error when running configure

hi I'm getting this erros when running ./configure --disable-binary

checking for wget... wget
checking for unzip... unzip
checking for g++... g++
checking whether the C++ compiler works... yes
checking for C++ compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C++ compiler... yes
checking whether g++ accepts -g... yes
Submodule 'build' () registered for path 'build'
Warning: Permanently added the RSA host key for IP address '192.30.252.128' to the list of known hosts.
Permission denied (publickey).
fatal: The remote end hung up unexpectedly
Unable to fetch in submodule path 'build'
./configure: line 2990: pushd: build/third: No such file or directory
./configure: line 2991: ./setup: No such file or directory
configure: error: Failed to set up the test utilities

am i doing something wrong !!!
thanks

Maximum number of levels/depth?

Is there maximum number of levels that can be encoded in the JSON output?

I am creating a JSON tree structure of vectors and pointers that goes down 9 levels. On the ninth level I have a member std::array. As soon as I jsonExport at that level, the export hangs. If I move the std::array one level up, it works as expected.

class level8_cont
{
public:
	std::array<int, 3> array9 = { 1, 2, 3 };
};
class level7
{
public:
	level7()
	{
		levels8.emplace_back();
	}
	std::vector<level8_cont> levels8;
};
class level6_cont
{
public:
	level6_cont()
	{
		nextLevel7 = new level7();
	}
	level7 *nextLevel7;
};
class level5
{
public:
	level5()
	{
		levels6.emplace_back();
	}
	std::vector<level6_cont> levels6;
};
class level4_cont
{
public:
	level4_cont()
	{
		nextLevel5 = new level5();
	}
	level5 *nextLevel5;
};
class level3
{
public:
	level3()
	{
		levels4.emplace_back();
	}
	std::vector<level4_cont> levels4;
};
class level2_cont
{
public:
	level2_cont()
	{
		nextLevel3 = new level3();
	}
	level3 *nextLevel3;
};
class level1
{
public:
	level1()
	{
		levels2.emplace_back();
	}

	std::vector<level2_cont> levels2;
};

ThorsAnvil_MakeTrait(level1, levels2);
ThorsAnvil_MakeTrait(level2_cont, nextLevel3);
ThorsAnvil_MakeTrait(level3, levels4);
ThorsAnvil_MakeTrait(level4_cont, nextLevel5);
ThorsAnvil_MakeTrait(level5, levels6);
ThorsAnvil_MakeTrait(level6_cont, nextLevel7);
ThorsAnvil_MakeTrait(level7, levels8);
ThorsAnvil_MakeTrait(level8_cont, array9);

using ThorsAnvil::Serialize::jsonExport;
using ThorsAnvil::Serialize::jsonImport;

// Use the export function to serialize
level1 levelTest = level1();
std::cout << jsonExport(levelTest) << "\n";

this gives the (stalled) output:

	{ 
		"levels2": [ 
			{ 
				"nextLevel3": 
				{ 
					"levels4": [ 
						{ 
							"nextLevel5": 
							{ 
								"levels6": [ 
									{ 
										"nextLevel7": 
										{ 
											"levels8": [ 
												{ 

moving the array9 up a level gives correct output:

class level8_cont
{
public:

};
class level7
{
public:
	level7()
	{
		levels8.emplace_back();
	}
	std::vector<level8_cont> levels8;
	std::array<int, 3> array9 = { 1, 2, 3 };
};
class level6_cont
{
public:
	level6_cont()
	{
		nextLevel7 = new level7();
	}
	level7 *nextLevel7;
};
class level5
{
public:
	level5()
	{
		levels6.emplace_back();
	}
	std::vector<level6_cont> levels6;
};
class level4_cont
{
public:
	level4_cont()
	{
		nextLevel5 = new level5();
	}
	level5 *nextLevel5;
};
class level3
{
public:
	level3()
	{
		levels4.emplace_back();
	}
	std::vector<level4_cont> levels4;
};
class level2_cont
{
public:
	level2_cont()
	{
		nextLevel3 = new level3();
	}
	level3 *nextLevel3;
};
class level1
{
public:
	level1()
	{
		levels2.emplace_back();
	}

	std::vector<level2_cont> levels2;
};

ThorsAnvil_MakeTrait(level1, levels2);
ThorsAnvil_MakeTrait(level2_cont, nextLevel3);
ThorsAnvil_MakeTrait(level3, levels4);
ThorsAnvil_MakeTrait(level4_cont, nextLevel5);
ThorsAnvil_MakeTrait(level5, levels6);
ThorsAnvil_MakeTrait(level6_cont, nextLevel7);
ThorsAnvil_MakeTrait(level7, levels8, array9);
ThorsAnvil_MakeTrait(level8_cont);

using ThorsAnvil::Serialize::jsonExport;
using ThorsAnvil::Serialize::jsonImport;

level1 levelTest = level1();
std::cout << jsonExport(levelTest) << "\n";

which gives this (correct) output:

{ 
		"levels2": [ 
			{ 
				"nextLevel3": 
				{ 
					"levels4": [ 
						{ 
							"nextLevel5": 
							{ 
								"levels6": [ 
									{ 
										"nextLevel7": 
										{ 
											"levels8": [ 
												{
												}], 
											"array9": [ 1, 2, 3]
										}
									}]
							}
						}]
				}
			}]
	}

How to make traits for a template

Suppose I have such a struct

namespace n {
template <typename R>
struct RR {
  std::string msg;
  std::vector<R> vec_R;
};

How should I ThorsAnvil_MakeTrait it?
I tried the simplest one

ThorsAnvil_MakeTrait(n::RR, msg, vec_R);

But it failed without surprise.

Unable to build the library, flex: unknown flag '-'

Hi!
Could you help me please. I'm following your Build instructions. Configure step succeeds. But make fails.

vitvlkv@sakura:~/src$ git clone [email protected]:Loki-Astari/ThorsSerializer.git
Cloning into 'ThorsSerializer'...
Warning: Permanently added 'github.com,192.30.253.112' (RSA) to the list of known hosts.
remote: Counting objects: 3062, done.
remote: Total 3062 (delta 0), reused 0 (delta 0), pack-reused 3062
Receiving objects: 100% (3062/3062), 875.07 KiB | 753.00 KiB/s, done.
Resolving deltas: 100% (1966/1966), done.
Checking connectivity... done.
vitvlkv@sakura:~/src$ cd ThorsSerializer/
vitvlkv@sakura:~/src/ThorsSerializer$ ./configure --disable-binary --disable-yaml
checking for wget... wget
checking for unzip... unzip
checking for g++... g++
checking whether the C++ compiler works... yes
checking for C++ compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C++ compiler... yes
checking whether g++ accepts -g... yes
Submodule 'build' (https://github.com/Loki-Astari/ThorMaker.git) registered for path 'build'
Cloning into 'build'...
remote: Counting objects: 745, done.
remote: Total 745 (delta 0), reused 0 (delta 0), pack-reused 745
Receiving objects: 100% (745/745), 384.89 KiB | 479.00 KiB/s, done.
Resolving deltas: 100% (465/465), done.
Checking connectivity... done.
Submodule path 'build': checked out '4b8ea1d12bf083651692086c631bf00175fb69f8'
Submodule 'googletest' (https://github.com/google/googletest.git) registered for path 'googletest'
Submodule 'vera-plusplus' (https://github.com/Loki-Astari/vera-plusplus.git) registered for path 'vera-plusplus'
Cloning into 'googletest'...
remote: Counting objects: 7439, done.
remote: Compressing objects: 100% (13/13), done.
remote: Total 7439 (delta 5), reused 0 (delta 0), pack-reused 7426
Receiving objects: 100% (7439/7439), 2.51 MiB | 623.00 KiB/s, done.
Resolving deltas: 100% (5522/5522), done.
Checking connectivity... done.
Submodule path 'googletest': checked out 'ed9d1e1ff92ce199de5ca2667a667cd0a368482a'
Cloning into 'vera-plusplus'...
remote: Counting objects: 2715, done.
remote: Total 2715 (delta 0), reused 0 (delta 0), pack-reused 2715
Receiving objects: 100% (2715/2715), 702.82 KiB | 349.00 KiB/s, done.
Resolving deltas: 100% (1841/1841), done.
Checking connectivity... done.
Submodule path 'vera-plusplus': checked out '526e6fba9ed8d7f99b74188ee670c819bc4f895c'
-- The C compiler identification is GNU 5.4.0
-- The CXX compiler identification is GNU 5.4.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found Tclsh: /usr/bin/tclsh (found version "8.6") 
-- Found TCL: /usr/lib/x86_64-linux-gnu/libtcl.so  
-- Could NOT find TCLTK (missing:  TK_INCLUDE_PATH) 
-- Could NOT find TK (missing:  TK_INCLUDE_PATH) 
-- Found PythonInterp: /usr/bin/python2 (found suitable version "2.7.12", minimum required is "2.0") 
-- Found PythonLibs: /usr/lib/x86_64-linux-gnu/libpython2.7.so (found suitable version "2.7.12", minimum required is "2.0") 
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Looking for pthread_create
-- Looking for pthread_create - not found
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Found Threads: TRUE  
-- Boost version: 1.61.0
-- Found the following Boost libraries:
--   filesystem
--   system
--   program_options
--   regex
--   wave
--   python
--   serialization
--   thread
--   chrono
--   date_time
--   atomic
CMake Warning at doc/CMakeLists.txt:5 (message):
  The documentation won't be built because pandoc was not found.


-- Configuring done
-- Generating done
-- Build files have been written to: /home/vitvlkv/src/ThorsSerializer/build/vera-plusplus/build
Scanning dependencies of target vera
[  3%] Building CXX object src/CMakeFiles/vera.dir/main.cpp.o
[  6%] Building CXX object src/CMakeFiles/vera.dir/plugins/Rules.cpp.o
[ 10%] Building CXX object src/CMakeFiles/vera.dir/plugins/tcl/TclInterpreter.cpp.o
[ 13%] Building CXX object src/CMakeFiles/vera.dir/plugins/tcl/cpptcl-1.1.4/cpptcl.cpp.o
[ 17%] Building CXX object src/CMakeFiles/vera.dir/plugins/Exclusions.cpp.o
[ 20%] Building CXX object src/CMakeFiles/vera.dir/plugins/lua/LuaInterpreter.cpp.o
[ 24%] Building CXX object src/CMakeFiles/vera.dir/plugins/Reports.cpp.o
[ 27%] Building CXX object src/CMakeFiles/vera.dir/plugins/Interpreter.cpp.o
[ 31%] Building CXX object src/CMakeFiles/vera.dir/plugins/RootDirectory.cpp.o
[ 34%] Building CXX object src/CMakeFiles/vera.dir/plugins/python/PythonInterpreter.cpp.o
[ 37%] Building CXX object src/CMakeFiles/vera.dir/plugins/Parameters.cpp.o
[ 41%] Building CXX object src/CMakeFiles/vera.dir/plugins/Transformations.cpp.o
[ 44%] Building CXX object src/CMakeFiles/vera.dir/plugins/Profiles.cpp.o
[ 48%] Building CXX object src/CMakeFiles/vera.dir/legacy_main.cpp.o
[ 51%] Building CXX object src/CMakeFiles/vera.dir/get_vera_root_default.cpp.o
[ 55%] Building CXX object src/CMakeFiles/vera.dir/structures/Tokens.cpp.o
[ 58%] Building CXX object src/CMakeFiles/vera.dir/structures/SourceLines.cpp.o
[ 62%] Building CXX object src/CMakeFiles/vera.dir/structures/SourceFiles.cpp.o
[ 65%] Building CXX object src/CMakeFiles/vera.dir/executable_path.cpp.o
[ 68%] Building CXX object src/CMakeFiles/vera.dir/boost_main.cpp.o
[ 72%] Linking CXX executable vera++
[ 72%] Built target vera
Scanning dependencies of target style_reports
[ 75%] Checking style with vera++ in src
[ 79%] Checking style with vera++ in src/plugins
[ 82%] Checking style with vera++ in src/plugins/lua
[ 86%] Checking style with vera++ in src/plugins/python
[ 89%] Checking style with vera++ in src/plugins/tcl
[ 93%] Checking style with vera++ in src/plugins/tcl/cpptcl-1.1.4
[ 96%] Checking style with vera++ in src/plugins/tcl/cpptcl-1.1.4/details
[100%] Checking style with vera++ in src/structures
[100%] Built target style_reports
[ 72%] Built target vera
[100%] Built target style_reports
Install the project...
-- Install configuration: ""
-- Installing: /home/vitvlkv/src/ThorsSerializer/build/bin/vera++
-- Set runtime path of "/home/vitvlkv/src/ThorsSerializer/build/bin/vera++" to ""
-- Installing: /home/vitvlkv/src/ThorsSerializer/build/lib/vera++/rules/T011.tcl
-- Installing: /home/vitvlkv/src/ThorsSerializer/build/lib/vera++/rules/T009.tcl
-- Installing: /home/vitvlkv/src/ThorsSerializer/build/lib/vera++/rules/T018.tcl
-- Installing: /home/vitvlkv/src/ThorsSerializer/build/lib/vera++/rules/T001.tcl
-- Installing: /home/vitvlkv/src/ThorsSerializer/build/lib/vera++/rules/T015.tcl
-- Installing: /home/vitvlkv/src/ThorsSerializer/build/lib/vera++/rules/L006.tcl
-- Installing: /home/vitvlkv/src/ThorsSerializer/build/lib/vera++/rules/M002.tcl
-- Installing: /home/vitvlkv/src/ThorsSerializer/build/lib/vera++/rules/T010.tcl
-- Installing: /home/vitvlkv/src/ThorsSerializer/build/lib/vera++/rules/T002.tcl
-- Installing: /home/vitvlkv/src/ThorsSerializer/build/lib/vera++/rules/T008B.tcl
-- Installing: /home/vitvlkv/src/ThorsSerializer/build/lib/vera++/rules/L002.tcl
-- Installing: /home/vitvlkv/src/ThorsSerializer/build/lib/vera++/rules/T005.tcl
-- Installing: /home/vitvlkv/src/ThorsSerializer/build/lib/vera++/rules/DUMP.tcl
-- Installing: /home/vitvlkv/src/ThorsSerializer/build/lib/vera++/rules/M003.tcl
-- Installing: /home/vitvlkv/src/ThorsSerializer/build/lib/vera++/rules/T008.tcl
-- Installing: /home/vitvlkv/src/ThorsSerializer/build/lib/vera++/rules/T012.tcl
-- Installing: /home/vitvlkv/src/ThorsSerializer/build/lib/vera++/rules/L003.tcl
-- Installing: /home/vitvlkv/src/ThorsSerializer/build/lib/vera++/rules/T008A.tcl
-- Installing: /home/vitvlkv/src/ThorsSerializer/build/lib/vera++/rules/T019.tcl
-- Installing: /home/vitvlkv/src/ThorsSerializer/build/lib/vera++/rules/L001.tcl
-- Installing: /home/vitvlkv/src/ThorsSerializer/build/lib/vera++/rules/T009A.tcl
-- Installing: /home/vitvlkv/src/ThorsSerializer/build/lib/vera++/rules/T003.tcl
-- Installing: /home/vitvlkv/src/ThorsSerializer/build/lib/vera++/rules/T016.tcl
-- Installing: /home/vitvlkv/src/ThorsSerializer/build/lib/vera++/rules/L004.tcl
-- Installing: /home/vitvlkv/src/ThorsSerializer/build/lib/vera++/rules/Doc
-- Installing: /home/vitvlkv/src/ThorsSerializer/build/lib/vera++/rules/T006.tcl
-- Installing: /home/vitvlkv/src/ThorsSerializer/build/lib/vera++/rules/T007.tcl
-- Installing: /home/vitvlkv/src/ThorsSerializer/build/lib/vera++/rules/T004.tcl
-- Installing: /home/vitvlkv/src/ThorsSerializer/build/lib/vera++/rules/M001.tcl
-- Installing: /home/vitvlkv/src/ThorsSerializer/build/lib/vera++/rules/L005.tcl
-- Installing: /home/vitvlkv/src/ThorsSerializer/build/lib/vera++/rules/F001.tcl
-- Installing: /home/vitvlkv/src/ThorsSerializer/build/lib/vera++/rules/T014.tcl
-- Installing: /home/vitvlkv/src/ThorsSerializer/build/lib/vera++/rules/T013.tcl
-- Installing: /home/vitvlkv/src/ThorsSerializer/build/lib/vera++/rules/F002.tcl
-- Installing: /home/vitvlkv/src/ThorsSerializer/build/lib/vera++/rules/T017.tcl
-- Installing: /home/vitvlkv/src/ThorsSerializer/build/lib/vera++/transformations/move_macros.tcl
-- Installing: /home/vitvlkv/src/ThorsSerializer/build/lib/vera++/transformations/to_xml.tcl
-- Installing: /home/vitvlkv/src/ThorsSerializer/build/lib/vera++/transformations/move_includes.tcl
-- Installing: /home/vitvlkv/src/ThorsSerializer/build/lib/vera++/transformations/to_lower.tcl
-- Installing: /home/vitvlkv/src/ThorsSerializer/build/lib/vera++/transformations/trim_right.tcl
-- Installing: /home/vitvlkv/src/ThorsSerializer/build/lib/vera++/transformations/to_xml2.tcl
-- Installing: /home/vitvlkv/src/ThorsSerializer/build/lib/vera++/transformations/move_namespace.tcl
-- Installing: /home/vitvlkv/src/ThorsSerializer/build/lib/vera++/transformations/fullblock.tcl
-- Installing: /home/vitvlkv/src/ThorsSerializer/build/lib/vera++/profiles/full
-- Installing: /home/vitvlkv/src/ThorsSerializer/build/lib/vera++/profiles/thor
-- Installing: /home/vitvlkv/src/ThorsSerializer/build/lib/vera++/profiles/moz
-- Installing: /home/vitvlkv/src/ThorsSerializer/build/lib/vera++/profiles/default
-- Installing: /home/vitvlkv/src/ThorsSerializer/build/lib/vera++/profiles/boost
-- Installing: /home/vitvlkv/src/ThorsSerializer/build/lib/vera++/vera++-config-version.cmake
-- Installing: /home/vitvlkv/src/ThorsSerializer/build/lib/vera++/vera++-config.cmake
-- Installing: /home/vitvlkv/src/ThorsSerializer/build/lib/vera++/use_vera++.cmake
-- Installing: /home/vitvlkv/src/ThorsSerializer/build/lib/vera++/test_wrapper.cmake.in
~/src/ThorsSerializer/build/third ~/src/ThorsSerializer
~/src/ThorsSerializer/build/googletest/googletest ~/src/ThorsSerializer/build/third
ar: creating libgtest.a
a - gtest-all.o
a - gtest_main.o
~/src/ThorsSerializer/build/third
Installing google test
~/src/ThorsSerializer/build ~/src/ThorsSerializer/build/third
~/src/ThorsSerializer/build/third
~/src/ThorsSerializer
checking whether we are using the GNU C++ compiler... (cached) yes
checking whether g++ accepts -g... (cached) yes
checking for gcc... gcc
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking whether gcc understands -c and -o together... yes
checking for flex... flex
checking lex output file root... lex.yy
checking lex library... -lfl
checking whether yytext is a pointer... yes
checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking how to print strings... printf
checking for a sed that does not truncate output... /bin/sed
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for fgrep... /bin/grep -F
checking for ld used by gcc... /usr/bin/ld
checking if the linker (/usr/bin/ld) is GNU ld... yes
checking for BSD- or MS-compatible name lister (nm)... /usr/bin/nm -B
checking the name lister (/usr/bin/nm -B) interface... BSD nm
checking whether ln -s works... yes
checking the maximum length of command line arguments... 1572864
checking how to convert x86_64-unknown-linux-gnu file names to x86_64-unknown-linux-gnu format... func_convert_file_noop
checking how to convert x86_64-unknown-linux-gnu file names to toolchain format... func_convert_file_noop
checking for /usr/bin/ld option to reload object files... -r
checking for objdump... objdump
checking how to recognize dependent libraries... pass_all
checking for dlltool... no
checking how to associate runtime and link libraries... printf %s\n
checking for ar... ar
checking for archiver @FILE support... @
checking for strip... strip
checking for ranlib... ranlib
checking for gawk... gawk
checking command to parse /usr/bin/nm -B output from gcc object... ok
checking for sysroot... no
checking for a working dd... /bin/dd
checking how to truncate binary pipes... /bin/dd bs=4096 count=1
checking for mt... mt
checking if mt is a manifest tool... no
checking how to run the C preprocessor... gcc -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking for dlfcn.h... yes
checking for objdir... .libs
checking if gcc supports -fno-rtti -fno-exceptions... no
checking for gcc option to produce PIC... -fPIC -DPIC
checking if gcc PIC flag -fPIC -DPIC works... yes
checking if gcc static flag -static works... yes
checking if gcc supports -c -o file.o... yes
checking if gcc supports -c -o file.o... (cached) yes
checking whether the gcc linker (/usr/bin/ld -m elf_x86_64) supports shared libraries... yes
checking whether -lc should be explicitly linked in... no
checking dynamic linker characteristics... GNU/Linux ld.so
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... yes
checking whether to build static libraries... no
checking how to run the C++ preprocessor... g++ -E
checking for ld used by g++... /usr/bin/ld -m elf_x86_64
checking if the linker (/usr/bin/ld -m elf_x86_64) is GNU ld... yes
checking whether the g++ linker (/usr/bin/ld -m elf_x86_64) supports shared libraries... yes
checking for g++ option to produce PIC... -fPIC -DPIC
checking if g++ PIC flag -fPIC -DPIC works... yes
checking if g++ static flag -static works... yes
checking if g++ supports -c -o file.o... yes
checking if g++ supports -c -o file.o... (cached) yes
checking whether the g++ linker (/usr/bin/ld -m elf_x86_64) supports shared libraries... yes
checking dynamic linker characteristics... (cached) GNU/Linux ld.so
checking how to hardcode library paths into programs... immediate
checking whether C compiler accepts -ansi... yes
checking whether C++ compiler accepts -std=c++11... yes
checking whether C++ compiler accepts -std=c++14... yes
checking whether C++ compiler accepts -std=c++17... yes
checking whether C++ compiler accepts -std=c++1x... no
checking whether C++ compiler accepts -std=c++1y... yes
checking whether C++ compiler accepts -std=c++1z... yes
checking Checking Compiler Compatibility g++ -std=c++17... good
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking whether make sets $(MAKE)... yes
checking for style of include used by make... GNU
checking whether make supports nested variables... yes
checking dependency style of gcc... none
checking dependency style of g++... none
checking that generated files are newer than configure... done
configure: creating ./config.status
config.status: creating Makefile.extra
config.status: creating Makefile.config
config.status: creating src/Serialize/SerializeConfig.h
config.status: creating src/BinaryRep/BinaryRepConfig.h
config.status: executing libtool commands
config.status: executing depfiles commands
vitvlkv@sakura:~/src/ThorsSerializer$ make 
Buiding src Start
make -C src build PREFIX=/home/vitvlkv/src/ThorsSerializer/build CXXSTDVER=17
make[1]: Entering directory '/home/vitvlkv/src/ThorsSerializer/src'
Buiding Serialize Start
make -C Serialize build PREFIX=/home/vitvlkv/src/ThorsSerializer/build CXXSTDVER=17
make[2]: Entering directory '/home/vitvlkv/src/ThorsSerializer/src/Serialize'
Building Objects for Testing and Coverage
make[3]: Entering directory '/home/vitvlkv/src/ThorsSerializer/src/Serialize'
Failed in Lexer Generator
ERROR
========================================
flex: unknown flag '-'.  For usage, try
	flex --help
/home/vitvlkv/src/ThorsSerializer/build/tools/Makefile:605: recipe for target 'JsonLexer.lex.cpp' failed
make[3]: *** [JsonLexer.lex.cpp] Error 1
make[3]: Leaving directory '/home/vitvlkv/src/ThorsSerializer/src/Serialize'
/home/vitvlkv/src/ThorsSerializer/build/tools/Makefile:341: recipe for target 'run_test' failed
make[2]: *** [run_test] Error 2
make[2]: Leaving directory '/home/vitvlkv/src/ThorsSerializer/src/Serialize'
/home/vitvlkv/src/ThorsSerializer/build/tools/Project.Makefile:33: recipe for target 'Serialize.dir' failed
make[1]: *** [Serialize.dir] Error 2
make[1]: Leaving directory '/home/vitvlkv/src/ThorsSerializer/src'
/home/vitvlkv/src/ThorsSerializer/build/tools/Project.Makefile:33: recipe for target 'src.dir' failed
make: *** [src.dir] Error 2

Help request

Dear sir,

I am Abdessattar Bahri, engineering student, in proess of setting my graduation project which is related to your repository.

I need to include this library to my project with visual studio 2015. To do this I must have the directories lib and include.
To obtain those , I have to compile this library.
May be it can be built with mingw and msys.
I tried with those tools but I can obtain the wanted result.
So i need a help.
Hwo can I compile it?

Thank you in advance,

Best regards,

Can't get it compiled.

I cloned this repo and tried : make -f MakeSample
it's strange that I many compile error appeared and make failed.
I'm use xubuntu 14.04

add more serialization type

I have a struct like this:

struct Profile { char name[20]; char type; int age; };

when compile, it says:

error: static assertion failed: Trying to serialize an object that does not have a ThorsAnvil::Serialize::Trait<> defined.Look at macro ThorsAnvil_MakeTrait() for more information.

Could you please add support for char or char[] ?

Issue with ThorsAnvil_MakeEnum

In traits.h, in the macro ThorsAnvil_MakeEnum, we have

static EnumName getValue(std::string const& val, std::string const& msg) \
{                                                               \
    char const* const* values = getValues();                    \
    std::size_t        size   = getSize();                      \
    for (std::size_t loop = 0;loop < size; ++loop)              \
    {                                                           \
        if (val == values[loop]) {                              \
            return static_cast<EnumName>(loop);                 \
        }                                                       \
    }                                                           \
    throw std::runtime_error(msg + " Invalid Enum Value");      \
}                                                               \

This looks to me like it will only work for enum types with consecutive values. That is, it will work for your test case,

enum RGB { Red, Green, Blue };

but not for something like

enum class FloatFormat {scientific = 1,fixed = 2,hex = 4,general = fixed | scientific};

Note that in the latter instance, the default initialized value FloatFormat() is a valid enum value even though, being 0, there is no name for it in the list, and the named values are not consecutive.

Instead of generating an array of # member, I would suggest generating an array of {EnumName::member, # member} pairs. Then getValue can search for the name and return the corresponding EnumName. I think you also need a fallback if there is no name for the default initialized value EnumName(), perhaps associating it with an empty string, or some other convention.

Also consider something like

enum class ErrorCode {Error1 = 1, Error2};

where ErrorCode() represents success. The standard library std::errc uses this convention. In this case you would want to be able to serialize/deserialize

ErrorCode ec = ErrorCode();

Best regards,
Daniel

Optional and required values

Hi,

I would like to use your lib with the following use-case:

  • JSON input can contain more values than the class has members
  • Some JSON values are optional, so I use pointers in the class
  • Some values are required, and I want an exception if it is missing

How do I get the behavior that

  • class members that are pointers are imported as nullptr when missing in JSON
  • JSON values that have no class members are ignored
  • class members that are no pointers have to be present in the JSON, otherwise, an exception should be thrown

The following code has all 4 examples I consider: Is there a way to make t1, t2 and t3 work and let import into t4 throw an exception?

#include <iostream>

#include <ThorSerialize/JsonThor.h>
#include <ThorSerialize/Traits.h>

using namespace std;
using namespace ThorsAnvil::Serialize;

struct Test {
    int num;
    int* optionalNum;
    ~Test() { delete optionalNum; }
};

ThorsAnvil_MakeTrait(Test, num, optionalNum);

int main()
{
    using PT = ParserInterface::ParseType;
    Test t1, t2, t3, t4;

    // should work perfectly: works
    string twoVals = R"( {"num": 42, "optionalNum": 43} )";
    istringstream(twoVals) >> jsonImport(t1, PT::Weak);
    cout << jsonExport(t1) << endl;

    // ignoring additional values is fine: works
    string threeVals = R"( {"num": 42, "optionalNum": 43, "tooMany": 44} )";
    istringstream(threeVals) >> jsonImport(t2, PT::Weak);
    cout << jsonExport(t2) << endl;

    // non-defined pointer members are nullptr: works
    string oneVal = R"( {"num": 42} )";
    istringstream(oneVal) >> jsonImport(t3, PT::Weak);
    cout << jsonExport(t3) << endl;

    // class T has a member "num" which is missing in the JSON -> exception?
    string zeroVals = "{}";
    istringstream(zeroVals) >> jsonImport(t4, PT::Weak);
    cout << jsonExport(t4) << endl;

    return 0;
}

Thanks

Serialize.h:169:88: error: ‘std::index_sequence’ has not been declared

Hi, I've managed to install Thor yesterday (after removing all vera++ stuff (--disable-vera didn't work)).

Now I'm trying to use it in my project and I'm getting multiple Errors, starting with the one in the title.

Here is the full log:

In file included from /usr/local/include/ThorSerialize/JsonParser.h:20:0, from /usr/local/include/ThorSerialize/JsonThor.h:14, from /home/mimre/workspace/isosurfaces/json/JSONHandler.h:8, from /home/mimre/workspace/isosurfaces/json/JSONHandler.cpp:5: /usr/local/include/ThorSerialize/Serialize.h:169:88: error: ‘std::index_sequence’ has not been declared void scanEachMember(std::string const& key, T& object, Members const& member, std::index_sequence<Seq...> const&); ^~~~~~~~~~~~~~ /usr/local/include/ThorSerialize/Serialize.h:169:102: error: expected ‘,’ or ‘...’ before ‘<’ token void scanEachMember(std::string const& key, T& object, Members const& member, std::index_sequence<Seq...> const&); ^ /usr/local/include/ThorSerialize/Serialize.h:200:71: error: ‘std::index_sequence’ has not been declared void printEachMember(T const& object, Members const& member, std::index_sequence<Seq...> const&); ^~~~~~~~~~~~~~ /usr/local/include/ThorSerialize/Serialize.h:200:85: error: expected ‘,’ or ‘...’ before ‘<’ token void printEachMember(T const& object, Members const& member, std::index_sequence<Seq...> const&); ^ In file included from /usr/local/include/ThorSerialize/Serialize.h:294:0, from /usr/local/include/ThorSerialize/JsonParser.h:20, from /usr/local/include/ThorSerialize/JsonThor.h:14, from /home/mimre/workspace/isosurfaces/json/JSONHandler.h:8, from /home/mimre/workspace/isosurfaces/json/JSONHandler.cpp:5: /usr/local/include/ThorSerialize/Serialize.tpp:255:105: error: ‘std::index_sequence’ has not been declared inline void DeSerializer::scanEachMember(std::string const& key, T& object, Members const& member, std::index_sequence<Seq...> const&) ^~~~~~~~~~~~~~ /usr/local/include/ThorSerialize/Serialize.tpp:255:119: error: expected ‘,’ or ‘...’ before ‘<’ token inline void DeSerializer::scanEachMember(std::string const& key, T& object, Members const& member, std::index_sequence<Seq...> const&) ^ /usr/local/include/ThorSerialize/Serialize.tpp: In member function ‘void ThorsAnvil::Serialize::DeSerializer::scanMembers(const string&, T&, const std::tuple<_Elements ...>&)’: /usr/local/include/ThorSerialize/Serialize.tpp:264:42: error: ‘make_index_sequence’ is not a member of ‘std’ scanEachMember(key, object, members, std::make_index_sequence<sizeof...(Members)>()); ^~~ /usr/local/include/ThorSerialize/Serialize.tpp:264:87: error: expected primary-expression before ‘)’ token scanEachMember(key, object, members, std::make_index_sequence<sizeof...(Members)>()); ^ /usr/local/include/ThorSerialize/Serialize.tpp: At global scope: /usr/local/include/ThorSerialize/Serialize.tpp:421:86: error: ‘std::index_sequence’ has not been declared inline void Serializer::printEachMember(T const& object, Members const& member, std::index_sequence<Seq...> const&) ^~~~~~~~~~~~~~ /usr/local/include/ThorSerialize/Serialize.tpp:421:100: error: expected ‘,’ or ‘...’ before ‘<’ token inline void Serializer::printEachMember(T const& object, Members const& member, std::index_sequence<Seq...> const&) ^ /usr/local/include/ThorSerialize/Serialize.tpp: In member function ‘void ThorsAnvil::Serialize::Serializer::printMembers(const T&, const std::tuple<_Elements ...>&)’: /usr/local/include/ThorSerialize/Serialize.tpp:430:38: error: ‘make_index_sequence’ is not a member of ‘std’ printEachMember(object, members, std::make_index_sequence<sizeof...(Members)>()); ^~~ /usr/local/include/ThorSerialize/Serialize.tpp:430:83: error: expected primary-expression before ‘)’ token printEachMember(object, members, std::make_index_sequence<sizeof...(Members)>()); ^ In file included from /usr/local/include/ThorSerialize/Serialize.h:34:0, from /usr/local/include/ThorSerialize/JsonParser.h:20, from /usr/local/include/ThorSerialize/JsonThor.h:14, from /home/mimre/workspace/isosurfaces/json/JSONHandler.h:8, from /home/mimre/workspace/isosurfaces/json/JSONHandler.cpp:5: /home/mimre/workspace/isosurfaces/json/JSONHandler.cpp: In member function ‘void json::JSONHandler::saveJSON(RunInformation)’: /home/mimre/workspace/isosurfaces/json/JSONHandler.cpp:13:5: error: ‘namespace’ definition is not allowed here ThorsAnvil_MakeTrait(RunInformation, dimensions, variables, volumens, similarityMaps); ^ /home/mimre/workspace/isosurfaces/json/JSONHandler.cpp:13:5: error: static assertion failed: The macro ThorsAnvil_MakeTrait must be used outside all namespace. ThorsAnvil_MakeTrait(RunInformation, dimensions, variables, volumens, similarityMaps); ^ In file included from /usr/local/include/ThorSerialize/Serialize.h:294:0, from /usr/local/include/ThorSerialize/JsonParser.h:20, from /usr/local/include/ThorSerialize/JsonThor.h:14, from /home/mimre/workspace/isosurfaces/json/JSONHandler.h:8, from /home/mimre/workspace/isosurfaces/json/JSONHandler.cpp:5: /usr/local/include/ThorSerialize/Serialize.tpp: In instantiation of ‘class ThorsAnvil::Serialize::SerializerForBlock<(ThorsAnvil::Serialize::TraitType)0, RunInformation>’: /usr/local/include/ThorSerialize/Serialize.tpp:442:48: required from ‘void ThorsAnvil::Serialize::Serializer::print(const T&) [with T = RunInformation]’ /usr/local/include/ThorSerialize/Exporter.h:32:13: required from ‘std::ostream& ThorsAnvil::Serialize::operator<<(std::ostream&, const ThorsAnvil::Serialize::Exporter<ThorsAnvil::Serialize::Json, RunInformation>&)’ /home/mimre/workspace/isosurfaces/json/JSONHandler.cpp:18:35: required from here /usr/local/include/ThorSerialize/Serialize.tpp:294:5: error: static assertion failed: Invalid Serialize TraitType. This usually means you have not define ThorsAnvil::Serialize::Traits<Your Type> static_assert( ^~~~~~~~~~~~~

I also was wondering where to put the "ThorsAnvil_MakeTrait"?

Thanks for any help :)

Add support to change the json property names when serializing/deserializing

Is it possible to have one field in the class, but different names for it during serialization/deserialization?

Something like this:

public class Videogame
{
private:

  [JsonProperty("name")]
   string Name;

   [JsonProperty("release_date")]
   private DateTime ReleaseDate;

}

Videogame starcraft = new Videogame
{
Name = "Starcraft",
ReleaseDate = new DateTime(1998, 1, 1)
};

string json = ThorsAnvil::Serialize::jsonExport(starcraft);

Console.WriteLine(json);
// {
// "name": "Starcraft",
// "release_date": "1998-01-01T00:00:00"
// }

Having trouble installing the library with Homebrew

When I run this command in the terminal brew install thors-serializer
I always have this error:

Last 15 lines from /home/mint/.cache/Homebrew/Logs/thors-serializer/02.make:
                       ^~~
Serialize.tpp:231:39: error: template argument 1 is invalid
 struct ConvertPointer<std::unique_ptr<T>>
                                       ^
Serialize.tpp:231:40: error: expected unqualified-id before '>' token
 struct ConvertPointer<std::unique_ptr<T>>
                                        ^~
/tmp/thors-serializer-20190313-23707-r92s0c/build/tools/Makefile:645: recipe for target 'coverage/Serialize.o' failed
make[3]: *** [coverage/Serialize.o] Error 1
/tmp/thors-serializer-20190313-23707-r92s0c/build/tools/Makefile:375: recipe for target 'unit_test' failed
make[2]: *** [unit_test] Error 2
/tmp/thors-serializer-20190313-23707-r92s0c/build/tools/Project.Makefile:47: recipe for target 'Serialize.dir' failed
make[1]: *** [Serialize.dir] Error 2
/tmp/thors-serializer-20190313-23707-r92s0c/build/tools/Project.Makefile:47: recipe for target 'src.dir' failed
make: *** [src.dir] Error 2

I tried running the install with gcc-6 which uses c++14 automatically but still get the error.
I also did a bunch of stuff:
updated homebew
downloaded gcc and g++ 6 and making sure the used version was 6.1 and higher
I don't know what I should do

Thank you

Include headers in header file - multiple definition

Hello,
I try to write serializer service with ThorsSerializer but I have problems with including header file.
serializerService.h

#pragma once

#include <string>
#include "ThorSerialize/SerUtil.h"
#include "ThorSerialize/JsonThor.h"

class SerializerService {
public:

    template <class T>
    std::string serialize(T &entity){
        using ThorsAnvil::Serialize::jsonExport;
        using ThorsAnvil::Serialize::PrinterInterface;

        std::stringstream stream;
        stream << jsonExport(entity, PrinterInterface::OutputType::Stream);
        return stream.str();
    };
};

serializerService.cpp

#include "serializerService.h"

mainEndpoint.cpp

#include <user.h>
#include "serializerService.h"
#include "mainEndpoint.h"


void MainEndpoint::doMain(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response) {

    User user("[email protected]");
    user.setUsername("admin");

    SerializerService serializer;

    std::string data = serializer.serialize(user);


    response.cookies()
            .add(Pistache::Http::Cookie("lang", "pl_PL"));
    response.headers()
            .add<Pistache::Http::Header::Server>("Sandbox server v0.1")
            .add<Pistache::Http::Header::ContentType>(MIME(Application, Json));
//    response.send(Pistache::Http::Code::Ok, "{}");
    response.send(Pistache::Http::Code::Ok, data);
}

When I try to link this (with multiple include header file serializerService.h which includes ThrosSerializer headers I got errors:

====================[ Build | sandbox | Debug ]=================================
/home/marcin/Programs/clion-2019.1.3/bin/cmake/linux/bin/cmake --build /home/marcin/CLionProjects/sandbox/cmake-build-debug --target sandbox -- -j 8
[ 76%] Built target pistache
Scanning dependencies of target sandbox
[ 80%] Building CXX object CMakeFiles/sandbox.dir/src/Service/serializerService.cpp.o
[ 84%] Linking CXX executable sandbox
/usr/bin/ld: CMakeFiles/sandbox.dir/src/Endpoint/mainEndpoint.cpp.o: in function `ThorsAnvil::Serialize::ParserInterface::ignoreValue()':
/home/marcin/CLionProjects/sandbox/lib/ThorsSerializer/ThorSerialize/Serialize.source:6: multiple definition of `ThorsAnvil::Serialize::ParserInterface::ignoreValue()'; CMakeFiles/sandbox.dir/src/Service/serializerService.cpp.o:/home/marcin/CLionProjects/sandbox/lib/ThorsSerializer/ThorSerialize/Serialize.source:6: first defined here
/usr/bin/ld: CMakeFiles/sandbox.dir/src/Endpoint/mainEndpoint.cpp.o: in function `ThorsAnvil::Serialize::ParserInterface::ignoreTheValue()':
/home/marcin/CLionProjects/sandbox/lib/ThorsSerializer/ThorSerialize/Serialize.source:47: multiple definition of `ThorsAnvil::Serialize::ParserInterface::ignoreTheValue()'; CMakeFiles/sandbox.dir/src/Service/serializerService.cpp.o:/home/marcin/CLionProjects/sandbox/lib/ThorsSerializer/ThorSerialize/Serialize.source:47: first defined here
/usr/bin/ld: CMakeFiles/sandbox.dir/src/Endpoint/mainEndpoint.cpp.o: in function `ThorsAnvil::Serialize::ParserInterface::ignoreTheMap()':
/home/marcin/CLionProjects/sandbox/lib/ThorsSerializer/ThorSerialize/Serialize.source:15: multiple definition of `ThorsAnvil::Serialize::ParserInterface::ignoreTheMap()'; CMakeFiles/sandbox.dir/src/Service/serializerService.cpp.o:/home/marcin/CLionProjects/sandbox/lib/ThorsSerializer/ThorSerialize/Serialize.source:15: first defined here
/usr/bin/ld: CMakeFiles/sandbox.dir/src/Endpoint/mainEndpoint.cpp.o: in function `ThorsAnvil::Serialize::ParserInterface::ignoreTheArray()':
/home/marcin/CLionProjects/sandbox/lib/ThorsSerializer/ThorSerialize/Serialize.source:27: multiple definition of `ThorsAnvil::Serialize::ParserInterface::ignoreTheArray()'; CMakeFiles/sandbox.dir/src/Service/serializerService.cpp.o:/home/marcin/CLionProjects/sandbox/lib/ThorsSerializer/ThorSerialize/Serialize.source:27: first defined here
/usr/bin/ld: CMakeFiles/sandbox.dir/src/Endpoint/mainEndpoint.cpp.o: in function `ThorsAnvil::Serialize::JsonManualLexer::JsonManualLexer(std::istream&)':
/home/marcin/CLionProjects/sandbox/lib/ThorsSerializer/ThorSerialize/JsonManualLexer.source:10: multiple definition of `ThorsAnvil::Serialize::JsonManualLexer::JsonManualLexer(std::istream&)'; CMakeFiles/sandbox.dir/src/Service/serializerService.cpp.o:/home/marcin/CLionProjects/sandbox/lib/ThorsSerializer/ThorSerialize/JsonManualLexer.source:10: first defined here
/usr/bin/ld: CMakeFiles/sandbox.dir/src/Endpoint/mainEndpoint.cpp.o: in function `ThorsAnvil::Serialize::JsonManualLexer::JsonManualLexer(std::istream&)':
/home/marcin/CLionProjects/sandbox/lib/ThorsSerializer/ThorSerialize/JsonManualLexer.source:10: multiple definition of `ThorsAnvil::Serialize::JsonManualLexer::JsonManualLexer(std::istream&)'; CMakeFiles/sandbox.dir/src/Service/serializerService.cpp.o:/home/marcin/CLionProjects/sandbox/lib/ThorsSerializer/ThorSerialize/JsonManualLexer.source:10: first defined here
/usr/bin/ld: CMakeFiles/sandbox.dir/src/Endpoint/mainEndpoint.cpp.o: in function `ThorsAnvil::Serialize::JsonManualLexer::yylex()':
/home/marcin/CLionProjects/sandbox/lib/ThorsSerializer/ThorSerialize/JsonManualLexer.source:16: multiple definition of `ThorsAnvil::Serialize::JsonManualLexer::yylex()'; CMakeFiles/sandbox.dir/src/Service/serializerService.cpp.o:/home/marcin/CLionProjects/sandbox/lib/ThorsSerializer/ThorSerialize/JsonManualLexer.source:16: first defined here
/usr/bin/ld: CMakeFiles/sandbox.dir/src/Endpoint/mainEndpoint.cpp.o: in function `ThorsAnvil::Serialize::JsonManualLexer::readTrue()':
/home/marcin/CLionProjects/sandbox/lib/ThorsSerializer/ThorSerialize/JsonManualLexer.source:65: multiple definition of `ThorsAnvil::Serialize::JsonManualLexer::readTrue()'; CMakeFiles/sandbox.dir/src/Service/serializerService.cpp.o:/home/marcin/CLionProjects/sandbox/lib/ThorsSerializer/ThorSerialize/JsonManualLexer.source:65: first defined here
/usr/bin/ld: CMakeFiles/sandbox.dir/src/Endpoint/mainEndpoint.cpp.o: in function `ThorsAnvil::Serialize::JsonManualLexer::readFalse()':
/home/marcin/CLionProjects/sandbox/lib/ThorsSerializer/ThorSerialize/JsonManualLexer.source:70: multiple definition of `ThorsAnvil::Serialize::JsonManualLexer::readFalse()'; CMakeFiles/sandbox.dir/src/Service/serializerService.cpp.o:/home/marcin/CLionProjects/sandbox/lib/ThorsSerializer/ThorSerialize/JsonManualLexer.source:70: first defined here
/usr/bin/ld: CMakeFiles/sandbox.dir/src/Endpoint/mainEndpoint.cpp.o: in function `ThorsAnvil::Serialize::JsonManualLexer::readNull()':
/home/marcin/CLionProjects/sandbox/lib/ThorsSerializer/ThorSerialize/JsonManualLexer.source:75: multiple definition of `ThorsAnvil::Serialize::JsonManualLexer::readNull()'; CMakeFiles/sandbox.dir/src/Service/serializerService.cpp.o:/home/marcin/CLionProjects/sandbox/lib/ThorsSerializer/ThorSerialize/JsonManualLexer.source:75: first defined here
/usr/bin/ld: CMakeFiles/sandbox.dir/src/Endpoint/mainEndpoint.cpp.o: in function `ThorsAnvil::Serialize::JsonManualLexer::readNumber(int)':
/home/marcin/CLionProjects/sandbox/lib/ThorsSerializer/ThorSerialize/JsonManualLexer.source:182: multiple definition of `ThorsAnvil::Serialize::JsonManualLexer::readNumber(int)'; CMakeFiles/sandbox.dir/src/Service/serializerService.cpp.o:/home/marcin/CLionProjects/sandbox/lib/ThorsSerializer/ThorSerialize/JsonManualLexer.source:182: first defined here
/usr/bin/ld: CMakeFiles/sandbox.dir/src/Endpoint/mainEndpoint.cpp.o: in function `ThorsAnvil::Serialize::JsonManualLexer::checkFixed(char const*, unsigned long)':
/home/marcin/CLionProjects/sandbox/lib/ThorsSerializer/ThorSerialize/JsonManualLexer.source:240: multiple definition of `ThorsAnvil::Serialize::JsonManualLexer::checkFixed(char const*, unsigned long)'; CMakeFiles/sandbox.dir/src/Service/serializerService.cpp.o:/home/marcin/CLionProjects/sandbox/lib/ThorsSerializer/ThorSerialize/JsonManualLexer.source:240: first defined here
/usr/bin/ld: CMakeFiles/sandbox.dir/src/Endpoint/mainEndpoint.cpp.o: in function `ThorsAnvil::Serialize::JsonManualLexer::ignoreRawValue()':
/home/marcin/CLionProjects/sandbox/lib/ThorsSerializer/ThorSerialize/JsonManualLexer.source:80: multiple definition of `ThorsAnvil::Serialize::JsonManualLexer::ignoreRawValue()'; CMakeFiles/sandbox.dir/src/Service/serializerService.cpp.o:/home/marcin/CLionProjects/sandbox/lib/ThorsSerializer/ThorSerialize/JsonManualLexer.source:80: first defined here
/usr/bin/ld: CMakeFiles/sandbox.dir/src/Endpoint/mainEndpoint.cpp.o: in function `ThorsAnvil::Serialize::JsonManualLexer::error()':
/home/marcin/CLionProjects/sandbox/lib/ThorsSerializer/ThorSerialize/JsonManualLexer.source:251: multiple definition of `ThorsAnvil::Serialize::JsonManualLexer::error()'; CMakeFiles/sandbox.dir/src/Service/serializerService.cpp.o:/home/marcin/CLionProjects/sandbox/lib/ThorsSerializer/ThorSerialize/JsonManualLexer.source:251: first defined here
/usr/bin/ld: CMakeFiles/sandbox.dir/src/Endpoint/mainEndpoint.cpp.o: in function `ThorsAnvil::Serialize::JsonManualLexer::getRawString[abi:cxx11]()':
/home/marcin/CLionProjects/sandbox/lib/ThorsSerializer/ThorSerialize/JsonManualLexer.source:98: multiple definition of `ThorsAnvil::Serialize::JsonManualLexer::getRawString[abi:cxx11]()'; CMakeFiles/sandbox.dir/src/Service/serializerService.cpp.o:/home/marcin/CLionProjects/sandbox/lib/ThorsSerializer/ThorSerialize/JsonManualLexer.source:98: first defined here
/usr/bin/ld: CMakeFiles/sandbox.dir/src/Endpoint/mainEndpoint.cpp.o: in function `ThorsAnvil::Serialize::JsonManualLexer::getString[abi:cxx11]()':
/home/marcin/CLionProjects/sandbox/lib/ThorsSerializer/ThorSerialize/JsonManualLexer.source:147: multiple definition of `ThorsAnvil::Serialize::JsonManualLexer::getString[abi:cxx11]()'; CMakeFiles/sandbox.dir/src/Service/serializerService.cpp.o:/home/marcin/CLionProjects/sandbox/lib/ThorsSerializer/ThorSerialize/JsonManualLexer.source:147: first defined here
/usr/bin/ld: CMakeFiles/sandbox.dir/src/Endpoint/mainEndpoint.cpp.o: in function `ThorsAnvil::Serialize::JsonManualLexer::getLastBool() const':
/home/marcin/CLionProjects/sandbox/lib/ThorsSerializer/ThorSerialize/JsonManualLexer.source:152: multiple definition of `ThorsAnvil::Serialize::JsonManualLexer::getLastBool() const'; CMakeFiles/sandbox.dir/src/Service/serializerService.cpp.o:/home/marcin/CLionProjects/sandbox/lib/ThorsSerializer/ThorSerialize/JsonManualLexer.source:152: first defined here
/usr/bin/ld: CMakeFiles/sandbox.dir/src/Endpoint/mainEndpoint.cpp.o: in function `ThorsAnvil::Serialize::JsonManualLexer::isLastNull() const':
/home/marcin/CLionProjects/sandbox/lib/ThorsSerializer/ThorSerialize/JsonManualLexer.source:164: multiple definition of `ThorsAnvil::Serialize::JsonManualLexer::isLastNull() const'; CMakeFiles/sandbox.dir/src/Service/serializerService.cpp.o:/home/marcin/CLionProjects/sandbox/lib/ThorsSerializer/ThorSerialize/JsonManualLexer.source:164: first defined here
/usr/bin/ld: CMakeFiles/sandbox.dir/src/Endpoint/mainEndpoint.cpp.o: in function `ThorsAnvil::Serialize::JsonManualLexer::readDigits(char)':
/home/marcin/CLionProjects/sandbox/lib/ThorsSerializer/ThorSerialize/JsonManualLexer.source:169: multiple definition of `ThorsAnvil::Serialize::JsonManualLexer::readDigits(char)'; CMakeFiles/sandbox.dir/src/Service/serializerService.cpp.o:/home/marcin/CLionProjects/sandbox/lib/ThorsSerializer/ThorSerialize/JsonManualLexer.source:169: first defined here
/usr/bin/ld: CMakeFiles/sandbox.dir/src/Endpoint/mainEndpoint.cpp.o: in function `ThorsAnvil::Serialize::JsonParser::JsonParser(std::istream&, ThorsAnvil::Serialize::ParserInterface::ParserConfig)':
/home/marcin/CLionProjects/sandbox/lib/ThorsSerializer/ThorSerialize/JsonParser.source:12: multiple definition of `ThorsAnvil::Serialize::JsonParser::JsonParser(std::istream&, ThorsAnvil::Serialize::ParserInterface::ParserConfig)'; CMakeFiles/sandbox.dir/src/Service/serializerService.cpp.o:/home/marcin/CLionProjects/sandbox/lib/ThorsSerializer/ThorSerialize/JsonParser.source:12: first defined here
/usr/bin/ld: CMakeFiles/sandbox.dir/src/Endpoint/mainEndpoint.cpp.o: in function `ThorsAnvil::Serialize::JsonParser::JsonParser(std::istream&, ThorsAnvil::Serialize::ParserInterface::ParserConfig)':
/home/marcin/CLionProjects/sandbox/lib/ThorsSerializer/ThorSerialize/JsonParser.source:12: multiple definition of `ThorsAnvil::Serialize::JsonParser::JsonParser(std::istream&, ThorsAnvil::Serialize::ParserInterface::ParserConfig)'; CMakeFiles/sandbox.dir/src/Service/serializerService.cpp.o:/home/marcin/CLionProjects/sandbox/lib/ThorsSerializer/ThorSerialize/JsonParser.source:12: first defined here
/usr/bin/ld: CMakeFiles/sandbox.dir/src/Endpoint/mainEndpoint.cpp.o: in function `ThorsAnvil::Serialize::JsonParser::getNextToken()':
/home/marcin/CLionProjects/sandbox/lib/ThorsSerializer/ThorSerialize/JsonParser.source:21: multiple definition of `ThorsAnvil::Serialize::JsonParser::getNextToken()'; CMakeFiles/sandbox.dir/src/Service/serializerService.cpp.o:/home/marcin/CLionProjects/sandbox/lib/ThorsSerializer/ThorSerialize/JsonParser.source:21: first defined here
/usr/bin/ld: CMakeFiles/sandbox.dir/src/Endpoint/mainEndpoint.cpp.o: in function `ThorsAnvil::Serialize::JsonParser::getString[abi:cxx11]()':
/home/marcin/CLionProjects/sandbox/lib/ThorsSerializer/ThorSerialize/JsonParser.source:139: multiple definition of `ThorsAnvil::Serialize::JsonParser::getString[abi:cxx11]()'; CMakeFiles/sandbox.dir/src/Service/serializerService.cpp.o:/home/marcin/CLionProjects/sandbox/lib/ThorsSerializer/ThorSerialize/JsonParser.source:139: first defined here
/usr/bin/ld: CMakeFiles/sandbox.dir/src/Endpoint/mainEndpoint.cpp.o: in function `ThorsAnvil::Serialize::JsonParser::getRawString[abi:cxx11]()':
/home/marcin/CLionProjects/sandbox/lib/ThorsSerializer/ThorSerialize/JsonParser.source:143: multiple definition of `ThorsAnvil::Serialize::JsonParser::getRawString[abi:cxx11]()'; CMakeFiles/sandbox.dir/src/Service/serializerService.cpp.o:/home/marcin/CLionProjects/sandbox/lib/ThorsSerializer/ThorSerialize/JsonParser.source:143: first defined here
/usr/bin/ld: CMakeFiles/sandbox.dir/src/Endpoint/mainEndpoint.cpp.o: in function `ThorsAnvil::Serialize::JsonParser::ignoreDataValue()':
/home/marcin/CLionProjects/sandbox/lib/ThorsSerializer/ThorSerialize/JsonParser.source:147: multiple definition of `ThorsAnvil::Serialize::JsonParser::ignoreDataValue()'; CMakeFiles/sandbox.dir/src/Service/serializerService.cpp.o:/home/marcin/CLionProjects/sandbox/lib/ThorsSerializer/ThorSerialize/JsonParser.source:147: first defined here
/usr/bin/ld: CMakeFiles/sandbox.dir/src/Endpoint/mainEndpoint.cpp.o: in function `ThorsAnvil::Serialize::JsonParser::getKey[abi:cxx11]()':
/home/marcin/CLionProjects/sandbox/lib/ThorsSerializer/ThorSerialize/JsonParser.source:152: multiple definition of `ThorsAnvil::Serialize::JsonParser::getKey[abi:cxx11]()'; CMakeFiles/sandbox.dir/src/Service/serializerService.cpp.o:/home/marcin/CLionProjects/sandbox/lib/ThorsSerializer/ThorSerialize/JsonParser.source:152: first defined here
/usr/bin/ld: CMakeFiles/sandbox.dir/src/Endpoint/mainEndpoint.cpp.o: in function `ThorsAnvil::Serialize::JsonParser::getValue(short&)':
/home/marcin/CLionProjects/sandbox/lib/ThorsSerializer/ThorSerialize/JsonParser.source:162: multiple definition of `ThorsAnvil::Serialize::JsonParser::getValue(short&)'; CMakeFiles/sandbox.dir/src/Service/serializerService.cpp.o:/home/marcin/CLionProjects/sandbox/lib/ThorsSerializer/ThorSerialize/JsonParser.source:162: first defined here
/usr/bin/ld: CMakeFiles/sandbox.dir/src/Endpoint/mainEndpoint.cpp.o: in function `ThorsAnvil::Serialize::JsonParser::getValue(int&)':
/home/marcin/CLionProjects/sandbox/lib/ThorsSerializer/ThorSerialize/JsonParser.source:163: multiple definition of `ThorsAnvil::Serialize::JsonParser::getValue(int&)'; CMakeFiles/sandbox.dir/src/Service/serializerService.cpp.o:/home/marcin/CLionProjects/sandbox/lib/ThorsSerializer/ThorSerialize/JsonParser.source:163: first defined here
/usr/bin/ld: CMakeFiles/sandbox.dir/src/Endpoint/mainEndpoint.cpp.o: in function `ThorsAnvil::Serialize::JsonParser::getValue(long&)':
/home/marcin/CLionProjects/sandbox/lib/ThorsSerializer/ThorSerialize/JsonParser.source:164: multiple definition of `ThorsAnvil::Serialize::JsonParser::getValue(long&)'; CMakeFiles/sandbox.dir/src/Service/serializerService.cpp.o:/home/marcin/CLionProjects/sandbox/lib/ThorsSerializer/ThorSerialize/JsonParser.source:164: first defined here
/usr/bin/ld: CMakeFiles/sandbox.dir/src/Endpoint/mainEndpoint.cpp.o: in function `ThorsAnvil::Serialize::JsonParser::getValue(long long&)':
/home/marcin/CLionProjects/sandbox/lib/ThorsSerializer/ThorSerialize/JsonParser.source:165: multiple definition of `ThorsAnvil::Serialize::JsonParser::getValue(long long&)'; CMakeFiles/sandbox.dir/src/Service/serializerService.cpp.o:/home/marcin/CLionProjects/sandbox/lib/ThorsSerializer/ThorSerialize/JsonParser.source:165: first defined here
/usr/bin/ld: CMakeFiles/sandbox.dir/src/Endpoint/mainEndpoint.cpp.o: in function `ThorsAnvil::Serialize::JsonParser::getValue(unsigned short&)':
/home/marcin/CLionProjects/sandbox/lib/ThorsSerializer/ThorSerialize/JsonParser.source:167: multiple definition of `ThorsAnvil::Serialize::JsonParser::getValue(unsigned short&)'; CMakeFiles/sandbox.dir/src/Service/serializerService.cpp.o:/home/marcin/CLionProjects/sandbox/lib/ThorsSerializer/ThorSerialize/JsonParser.source:167: first defined here
/usr/bin/ld: CMakeFiles/sandbox.dir/src/Endpoint/mainEndpoint.cpp.o: in function `ThorsAnvil::Serialize::JsonParser::getValue(unsigned int&)':
/home/marcin/CLionProjects/sandbox/lib/ThorsSerializer/ThorSerialize/JsonParser.source:168: multiple definition of `ThorsAnvil::Serialize::JsonParser::getValue(unsigned int&)'; CMakeFiles/sandbox.dir/src/Service/serializerService.cpp.o:/home/marcin/CLionProjects/sandbox/lib/ThorsSerializer/ThorSerialize/JsonParser.source:168: first defined here
/usr/bin/ld: CMakeFiles/sandbox.dir/src/Endpoint/mainEndpoint.cpp.o: in function `ThorsAnvil::Serialize::JsonParser::getValue(unsigned long&)':
/home/marcin/CLionProjects/sandbox/lib/ThorsSerializer/ThorSerialize/JsonParser.source:169: multiple definition of `ThorsAnvil::Serialize::JsonParser::getValue(unsigned long&)'; CMakeFiles/sandbox.dir/src/Service/serializerService.cpp.o:/home/marcin/CLionProjects/sandbox/lib/ThorsSerializer/ThorSerialize/JsonParser.source:169: first defined here
/usr/bin/ld: CMakeFiles/sandbox.dir/src/Endpoint/mainEndpoint.cpp.o: in function `ThorsAnvil::Serialize::JsonParser::getValue(unsigned long long&)':
/home/marcin/CLionProjects/sandbox/lib/ThorsSerializer/ThorSerialize/JsonParser.source:170: multiple definition of `ThorsAnvil::Serialize::JsonParser::getValue(unsigned long long&)'; CMakeFiles/sandbox.dir/src/Service/serializerService.cpp.o:/home/marcin/CLionProjects/sandbox/lib/ThorsSerializer/ThorSerialize/JsonParser.source:170: first defined here
/usr/bin/ld: CMakeFiles/sandbox.dir/src/Endpoint/mainEndpoint.cpp.o: in function `ThorsAnvil::Serialize::JsonParser::getValue(float&)':
/home/marcin/CLionProjects/sandbox/lib/ThorsSerializer/ThorSerialize/JsonParser.source:172: multiple definition of `ThorsAnvil::Serialize::JsonParser::getValue(float&)'; CMakeFiles/sandbox.dir/src/Service/serializerService.cpp.o:/home/marcin/CLionProjects/sandbox/lib/ThorsSerializer/ThorSerialize/JsonParser.source:172: first defined here
/usr/bin/ld: CMakeFiles/sandbox.dir/src/Endpoint/mainEndpoint.cpp.o: in function `ThorsAnvil::Serialize::JsonParser::getValue(double&)':
/home/marcin/CLionProjects/sandbox/lib/ThorsSerializer/ThorSerialize/JsonParser.source:173: multiple definition of `ThorsAnvil::Serialize::JsonParser::getValue(double&)'; CMakeFiles/sandbox.dir/src/Service/serializerService.cpp.o:/home/marcin/CLionProjects/sandbox/lib/ThorsSerializer/ThorSerialize/JsonParser.source:173: first defined here
/usr/bin/ld: CMakeFiles/sandbox.dir/src/Endpoint/mainEndpoint.cpp.o: in function `ThorsAnvil::Serialize::JsonParser::getValue(long double&)':
/home/marcin/CLionProjects/sandbox/lib/ThorsSerializer/ThorSerialize/JsonParser.source:174: multiple definition of `ThorsAnvil::Serialize::JsonParser::getValue(long double&)'; CMakeFiles/sandbox.dir/src/Service/serializerService.cpp.o:/home/marcin/CLionProjects/sandbox/lib/ThorsSerializer/ThorSerialize/JsonParser.source:174: first defined here
/usr/bin/ld: CMakeFiles/sandbox.dir/src/Endpoint/mainEndpoint.cpp.o: in function `ThorsAnvil::Serialize::JsonParser::getValue(bool&)':
/home/marcin/CLionProjects/sandbox/lib/ThorsSerializer/ThorSerialize/JsonParser.source:177: multiple definition of `ThorsAnvil::Serialize::JsonParser::getValue(bool&)'; CMakeFiles/sandbox.dir/src/Service/serializerService.cpp.o:/home/marcin/CLionProjects/sandbox/lib/ThorsSerializer/ThorSerialize/JsonParser.source:177: first defined here
/usr/bin/ld: CMakeFiles/sandbox.dir/src/Endpoint/mainEndpoint.cpp.o: in function `ThorsAnvil::Serialize::JsonParser::getValue(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&)':
/home/marcin/CLionProjects/sandbox/lib/ThorsSerializer/ThorSerialize/JsonParser.source:182: multiple definition of `ThorsAnvil::Serialize::JsonParser::getValue(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&)'; CMakeFiles/sandbox.dir/src/Service/serializerService.cpp.o:/home/marcin/CLionProjects/sandbox/lib/ThorsSerializer/ThorSerialize/JsonParser.source:182: first defined here
/usr/bin/ld: CMakeFiles/sandbox.dir/src/Endpoint/mainEndpoint.cpp.o: in function `ThorsAnvil::Serialize::JsonParser::isValueNull()':
/home/marcin/CLionProjects/sandbox/lib/ThorsSerializer/ThorSerialize/JsonParser.source:187: multiple definition of `ThorsAnvil::Serialize::JsonParser::isValueNull()'; CMakeFiles/sandbox.dir/src/Service/serializerService.cpp.o:/home/marcin/CLionProjects/sandbox/lib/ThorsSerializer/ThorSerialize/JsonParser.source:187: first defined here
/usr/bin/ld: CMakeFiles/sandbox.dir/src/Endpoint/mainEndpoint.cpp.o: in function `ThorsAnvil::Serialize::JsonParser::getRawValue[abi:cxx11]()':
/home/marcin/CLionProjects/sandbox/lib/ThorsSerializer/ThorSerialize/JsonParser.source:192: multiple definition of `ThorsAnvil::Serialize::JsonParser::getRawValue[abi:cxx11]()'; CMakeFiles/sandbox.dir/src/Service/serializerService.cpp.o:/home/marcin/CLionProjects/sandbox/lib/ThorsSerializer/ThorSerialize/JsonParser.source:192: first defined here
/usr/bin/ld: CMakeFiles/sandbox.dir/src/Endpoint/mainEndpoint.cpp.o: in function `ThorsAnvil::Serialize::JsonPrinter::JsonPrinter(std::ostream&, ThorsAnvil::Serialize::PrinterInterface::PrinterConfig)':
/home/marcin/CLionProjects/sandbox/lib/ThorsSerializer/ThorSerialize/JsonPrinter.source:112: multiple definition of `ThorsAnvil::Serialize::JsonPrinter::JsonPrinter(std::ostream&, ThorsAnvil::Serialize::PrinterInterface::PrinterConfig)'; CMakeFiles/sandbox.dir/src/Service/serializerService.cpp.o:/home/marcin/CLionProjects/sandbox/lib/ThorsSerializer/ThorSerialize/JsonPrinter.source:112: first defined here
/usr/bin/ld: CMakeFiles/sandbox.dir/src/Endpoint/mainEndpoint.cpp.o: in function `ThorsAnvil::Serialize::JsonPrinter::JsonPrinter(std::ostream&, ThorsAnvil::Serialize::PrinterInterface::PrinterConfig)':
/home/marcin/CLionProjects/sandbox/lib/ThorsSerializer/ThorSerialize/JsonPrinter.source:112: multiple definition of `ThorsAnvil::Serialize::JsonPrinter::JsonPrinter(std::ostream&, ThorsAnvil::Serialize::PrinterInterface::PrinterConfig)'; CMakeFiles/sandbox.dir/src/Service/serializerService.cpp.o:/home/marcin/CLionProjects/sandbox/lib/ThorsSerializer/ThorSerialize/JsonPrinter.source:112: first defined here
/usr/bin/ld: CMakeFiles/sandbox.dir/src/Endpoint/mainEndpoint.cpp.o: in function `ThorsAnvil::Serialize::JsonPrinter::openDoc()':
/home/marcin/CLionProjects/sandbox/lib/ThorsSerializer/ThorSerialize/JsonPrinter.source:119: multiple definition of `ThorsAnvil::Serialize::JsonPrinter::openDoc()'; CMakeFiles/sandbox.dir/src/Service/serializerService.cpp.o:/home/marcin/CLionProjects/sandbox/lib/ThorsSerializer/ThorSerialize/JsonPrinter.source:119: first defined here
/usr/bin/ld: CMakeFiles/sandbox.dir/src/Endpoint/mainEndpoint.cpp.o: in function `ThorsAnvil::Serialize::JsonPrinter::closeDoc()':
/home/marcin/CLionProjects/sandbox/lib/ThorsSerializer/ThorSerialize/JsonPrinter.source:121: multiple definition of `ThorsAnvil::Serialize::JsonPrinter::closeDoc()'; CMakeFiles/sandbox.dir/src/Service/serializerService.cpp.o:/home/marcin/CLionProjects/sandbox/lib/ThorsSerializer/ThorSerialize/JsonPrinter.source:121: first defined here
/usr/bin/ld: CMakeFiles/sandbox.dir/src/Endpoint/mainEndpoint.cpp.o: in function `ThorsAnvil::Serialize::JsonPrinter::openMap()':
/home/marcin/CLionProjects/sandbox/lib/ThorsSerializer/ThorSerialize/JsonPrinter.source:124: multiple definition of `ThorsAnvil::Serialize::JsonPrinter::openMap()'; CMakeFiles/sandbox.dir/src/Service/serializerService.cpp.o:/home/marcin/CLionProjects/sandbox/lib/ThorsSerializer/ThorSerialize/JsonPrinter.source:124: first defined here
/usr/bin/ld: CMakeFiles/sandbox.dir/src/Endpoint/mainEndpoint.cpp.o: in function `ThorsAnvil::Serialize::JsonPrinter::closeMap()':
/home/marcin/CLionProjects/sandbox/lib/ThorsSerializer/ThorSerialize/JsonPrinter.source:129: multiple definition of `ThorsAnvil::Serialize::JsonPrinter::closeMap()'; CMakeFiles/sandbox.dir/src/Service/serializerService.cpp.o:/home/marcin/CLionProjects/sandbox/lib/ThorsSerializer/ThorSerialize/JsonPrinter.source:129: first defined here
/usr/bin/ld: CMakeFiles/sandbox.dir/src/Endpoint/mainEndpoint.cpp.o: in function `ThorsAnvil::Serialize::JsonPrinter::openArray(unsigned long)':
/home/marcin/CLionProjects/sandbox/lib/ThorsSerializer/ThorSerialize/JsonPrinter.source:138: multiple definition of `ThorsAnvil::Serialize::JsonPrinter::openArray(unsigned long)'; CMakeFiles/sandbox.dir/src/Service/serializerService.cpp.o:/home/marcin/CLionProjects/sandbox/lib/ThorsSerializer/ThorSerialize/JsonPrinter.source:138: first defined here
/usr/bin/ld: CMakeFiles/sandbox.dir/src/Endpoint/mainEndpoint.cpp.o: in function `ThorsAnvil::Serialize::JsonPrinter::closeArray()':
/home/marcin/CLionProjects/sandbox/lib/ThorsSerializer/ThorSerialize/JsonPrinter.source:143: multiple definition of `ThorsAnvil::Serialize::JsonPrinter::closeArray()'; CMakeFiles/sandbox.dir/src/Service/serializerService.cpp.o:/home/marcin/CLionProjects/sandbox/lib/ThorsSerializer/ThorSerialize/JsonPrinter.source:143: first defined here
/usr/bin/ld: CMakeFiles/sandbox.dir/src/Endpoint/mainEndpoint.cpp.o: in function `ThorsAnvil::Serialize::JsonPrinter::addKey(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)':
/home/marcin/CLionProjects/sandbox/lib/ThorsSerializer/ThorSerialize/JsonPrinter.source:153: multiple definition of `ThorsAnvil::Serialize::JsonPrinter::addKey(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'; CMakeFiles/sandbox.dir/src/Service/serializerService.cpp.o:/home/marcin/CLionProjects/sandbox/lib/ThorsSerializer/ThorSerialize/JsonPrinter.source:153: first defined here
/usr/bin/ld: CMakeFiles/sandbox.dir/src/Endpoint/mainEndpoint.cpp.o: in function `ThorsAnvil::Serialize::JsonPrinter::addValue(short)':
/home/marcin/CLionProjects/sandbox/lib/ThorsSerializer/ThorSerialize/JsonPrinter.source:179: multiple definition of `ThorsAnvil::Serialize::JsonPrinter::addValue(short)'; CMakeFiles/sandbox.dir/src/Service/serializerService.cpp.o:/home/marcin/CLionProjects/sandbox/lib/ThorsSerializer/ThorSerialize/JsonPrinter.source:179: first defined here
/usr/bin/ld: CMakeFiles/sandbox.dir/src/Endpoint/mainEndpoint.cpp.o: in function `ThorsAnvil::Serialize::JsonPrinter::addValue(int)':
/home/marcin/CLionProjects/sandbox/lib/ThorsSerializer/ThorSerialize/JsonPrinter.source:180: multiple definition of `ThorsAnvil::Serialize::JsonPrinter::addValue(int)'; CMakeFiles/sandbox.dir/src/Service/serializerService.cpp.o:/home/marcin/CLionProjects/sandbox/lib/ThorsSerializer/ThorSerialize/JsonPrinter.source:180: first defined here
/usr/bin/ld: CMakeFiles/sandbox.dir/src/Endpoint/mainEndpoint.cpp.o: in function `ThorsAnvil::Serialize::JsonPrinter::addValue(long)':
/home/marcin/CLionProjects/sandbox/lib/ThorsSerializer/ThorSerialize/JsonPrinter.source:181: multiple definition of `ThorsAnvil::Serialize::JsonPrinter::addValue(long)'; CMakeFiles/sandbox.dir/src/Service/serializerService.cpp.o:/home/marcin/CLionProjects/sandbox/lib/ThorsSerializer/ThorSerialize/JsonPrinter.source:181: first defined here
/usr/bin/ld: CMakeFiles/sandbox.dir/src/Endpoint/mainEndpoint.cpp.o: in function `ThorsAnvil::Serialize::JsonPrinter::addValue(long long)':
/home/marcin/CLionProjects/sandbox/lib/ThorsSerializer/ThorSerialize/JsonPrinter.source:182: multiple definition of `ThorsAnvil::Serialize::JsonPrinter::addValue(long long)'; CMakeFiles/sandbox.dir/src/Service/serializerService.cpp.o:/home/marcin/CLionProjects/sandbox/lib/ThorsSerializer/ThorSerialize/JsonPrinter.source:182: first defined here
/usr/bin/ld: CMakeFiles/sandbox.dir/src/Endpoint/mainEndpoint.cpp.o: in function `ThorsAnvil::Serialize::JsonPrinter::addValue(unsigned short)':
/home/marcin/CLionProjects/sandbox/lib/ThorsSerializer/ThorSerialize/JsonPrinter.source:184: multiple definition of `ThorsAnvil::Serialize::JsonPrinter::addValue(unsigned short)'; CMakeFiles/sandbox.dir/src/Service/serializerService.cpp.o:/home/marcin/CLionProjects/sandbox/lib/ThorsSerializer/ThorSerialize/JsonPrinter.source:184: first defined here
/usr/bin/ld: CMakeFiles/sandbox.dir/src/Endpoint/mainEndpoint.cpp.o: in function `ThorsAnvil::Serialize::JsonPrinter::addValue(unsigned int)':
/home/marcin/CLionProjects/sandbox/lib/ThorsSerializer/ThorSerialize/JsonPrinter.source:185: multiple definition of `ThorsAnvil::Serialize::JsonPrinter::addValue(unsigned int)'; CMakeFiles/sandbox.dir/src/Service/serializerService.cpp.o:/home/marcin/CLionProjects/sandbox/lib/ThorsSerializer/ThorSerialize/JsonPrinter.source:185: first defined here
/usr/bin/ld: CMakeFiles/sandbox.dir/src/Endpoint/mainEndpoint.cpp.o: in function `ThorsAnvil::Serialize::JsonPrinter::addValue(unsigned long)':
/home/marcin/CLionProjects/sandbox/lib/ThorsSerializer/ThorSerialize/JsonPrinter.source:186: multiple definition of `ThorsAnvil::Serialize::JsonPrinter::addValue(unsigned long)'; CMakeFiles/sandbox.dir/src/Service/serializerService.cpp.o:/home/marcin/CLionProjects/sandbox/lib/ThorsSerializer/ThorSerialize/JsonPrinter.source:186: first defined here
/usr/bin/ld: CMakeFiles/sandbox.dir/src/Endpoint/mainEndpoint.cpp.o: in function `ThorsAnvil::Serialize::JsonPrinter::addValue(unsigned long long)':
/home/marcin/CLionProjects/sandbox/lib/ThorsSerializer/ThorSerialize/JsonPrinter.source:187: multiple definition of `ThorsAnvil::Serialize::JsonPrinter::addValue(unsigned long long)'; CMakeFiles/sandbox.dir/src/Service/serializerService.cpp.o:/home/marcin/CLionProjects/sandbox/lib/ThorsSerializer/ThorSerialize/JsonPrinter.source:187: first defined here
/usr/bin/ld: CMakeFiles/sandbox.dir/src/Endpoint/mainEndpoint.cpp.o: in function `ThorsAnvil::Serialize::JsonPrinter::addValue(float)':
/home/marcin/CLionProjects/sandbox/lib/ThorsSerializer/ThorSerialize/JsonPrinter.source:189: multiple definition of `ThorsAnvil::Serialize::JsonPrinter::addValue(float)'; CMakeFiles/sandbox.dir/src/Service/serializerService.cpp.o:/home/marcin/CLionProjects/sandbox/lib/ThorsSerializer/ThorSerialize/JsonPrinter.source:189: first defined here
/usr/bin/ld: CMakeFiles/sandbox.dir/src/Endpoint/mainEndpoint.cpp.o: in function `ThorsAnvil::Serialize::JsonPrinter::addValue(double)':
/home/marcin/CLionProjects/sandbox/lib/ThorsSerializer/ThorSerialize/JsonPrinter.source:190: multiple definition of `ThorsAnvil::Serialize::JsonPrinter::addValue(double)'; CMakeFiles/sandbox.dir/src/Service/serializerService.cpp.o:/home/marcin/CLionProjects/sandbox/lib/ThorsSerializer/ThorSerialize/JsonPrinter.source:190: first defined here
/usr/bin/ld: CMakeFiles/sandbox.dir/src/Endpoint/mainEndpoint.cpp.o: in function `ThorsAnvil::Serialize::JsonPrinter::addValue(long double)':
/home/marcin/CLionProjects/sandbox/lib/ThorsSerializer/ThorSerialize/JsonPrinter.source:191: multiple definition of `ThorsAnvil::Serialize::JsonPrinter::addValue(long double)'; CMakeFiles/sandbox.dir/src/Service/serializerService.cpp.o:/home/marcin/CLionProjects/sandbox/lib/ThorsSerializer/ThorSerialize/JsonPrinter.source:191: first defined here
/usr/bin/ld: CMakeFiles/sandbox.dir/src/Endpoint/mainEndpoint.cpp.o: in function `ThorsAnvil::Serialize::JsonPrinter::addValue(bool)':
/home/marcin/CLionProjects/sandbox/lib/ThorsSerializer/ThorSerialize/JsonPrinter.source:193: multiple definition of `ThorsAnvil::Serialize::JsonPrinter::addValue(bool)'; CMakeFiles/sandbox.dir/src/Service/serializerService.cpp.o:/home/marcin/CLionProjects/sandbox/lib/ThorsSerializer/ThorSerialize/JsonPrinter.source:193: first defined here
/usr/bin/ld: CMakeFiles/sandbox.dir/src/Endpoint/mainEndpoint.cpp.o: in function `ThorsAnvil::Serialize::JsonPrinter::addValue(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)':
/home/marcin/CLionProjects/sandbox/lib/ThorsSerializer/ThorSerialize/JsonPrinter.source:200: multiple definition of `ThorsAnvil::Serialize::JsonPrinter::addValue(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'; CMakeFiles/sandbox.dir/src/Service/serializerService.cpp.o:/home/marcin/CLionProjects/sandbox/lib/ThorsSerializer/ThorSerialize/JsonPrinter.source:200: first defined here
/usr/bin/ld: CMakeFiles/sandbox.dir/src/Endpoint/mainEndpoint.cpp.o: in function `ThorsAnvil::Serialize::JsonPrinter::addRawValue(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)':
/home/marcin/CLionProjects/sandbox/lib/ThorsSerializer/ThorSerialize/JsonPrinter.source:277: multiple definition of `ThorsAnvil::Serialize::JsonPrinter::addRawValue(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'; CMakeFiles/sandbox.dir/src/Service/serializerService.cpp.o:/home/marcin/CLionProjects/sandbox/lib/ThorsSerializer/ThorSerialize/JsonPrinter.source:277: first defined here
/usr/bin/ld: CMakeFiles/sandbox.dir/src/Endpoint/mainEndpoint.cpp.o: in function `ThorsAnvil::Serialize::JsonPrinter::addNull()':
/home/marcin/CLionProjects/sandbox/lib/ThorsSerializer/ThorSerialize/JsonPrinter.source:279: multiple definition of `ThorsAnvil::Serialize::JsonPrinter::addNull()'; CMakeFiles/sandbox.dir/src/Service/serializerService.cpp.o:/home/marcin/CLionProjects/sandbox/lib/ThorsSerializer/ThorSerialize/JsonPrinter.source:279: first defined here
collect2: error: ld returned 1 exit status

When I change my method to return simple text, disablig include lines with serializer I can include my header file anywhere.

How to combine templates and polymorphism?

I was trying to make a game using ECS framework. It's better to use POD as components, in order to improve performance and increase stability of the game. So I decided to use some wrapper to provide virtual table and to keep my components intact.
However I got some errors. I'm looking for a way to print my wrapped POD, as well as to scan POD using the library's methods.

In file included from /home/jack/IdeaProjects/Escape/vendor/ThorsSerializer/ThorSerialize/Serialize.h:425,
                 from /home/jack/IdeaProjects/Escape/vendor/ThorsSerializer/ThorSerialize/JsonParser.h:21,
                 from /home/jack/IdeaProjects/Escape/vendor/ThorsSerializer/ThorSerialize/JsonThor.h:15,
                 from /home/jack/IdeaProjects/Escape/src/serialization.cpp:19:
/home/jack/IdeaProjects/Escape/vendor/ThorsSerializer/ThorSerialize/Serialize.tpp: In instantiation of ‘class ThorsAnvil::Serialize::DeSerializeMember<TerrainData, TerrainType, ThorsAnvil::Serialize::TraitType::Invalid>’:
/home/jack/IdeaProjects/Escape/vendor/ThorsSerializer/ThorSerialize/Serialize.tpp:508:73:   required from ‘bool ThorsAnvil::Serialize::DeSerializer::scanEachMember(const string&, T&, const Members&, std::index_sequence<_Idx ...>&) [with T = TerrainData; Members = std::tuple<std::pair<const char*, TerrainType TerrainData::*>, std::pair<const char*, float TerrainData::*>, std::pair<const char*, float TerrainData::*>, std::pair<const char*, float TerrainData::*>, std::pair<const char*, float TerrainData::*> >; long unsigned int ...Seq = {0, 1, 2, 3, 4}; std::string = std::__cxx11::basic_string<char>; std::index_sequence<_Idx ...> = std::integer_sequence<long unsigned int, 0, 1, 2, 3, 4>]’
/home/jack/IdeaProjects/Escape/vendor/ThorsSerializer/ThorSerialize/Serialize.tpp:515:95:   required from ‘bool ThorsAnvil::Serialize::DeSerializer::scanMembers(const string&, T&, const std::tuple<_Elements ...>&) [with T = TerrainData; Members = {std::pair<const char*, TerrainType TerrainData::*>, std::pair<const char*, float TerrainData::*>, std::pair<const char*, float TerrainData::*>, std::pair<const char*, float TerrainData::*>, std::pair<const char*, float TerrainData::*>}; std::string = std::__cxx11::basic_string<char>]’
/home/jack/IdeaProjects/Escape/vendor/ThorsSerializer/ThorSerialize/Serialize.tpp:531:17:   required from ‘bool ThorsAnvil::Serialize::DeSerializer::scanObjectMembers(const I&, T&) [with T = TerrainData; I = std::__cxx11::basic_string<char>]’
/home/jack/IdeaProjects/Escape/vendor/ThorsSerializer/ThorSerialize/Serialize.tpp:196:21:   required from ‘void ThorsAnvil::Serialize::DeSerializationForBlock<traitType, T>::scanObject(T&) [with ThorsAnvil::Serialize::TraitType traitType = ThorsAnvil::Serialize::TraitType::Map; T = TerrainData]’
/home/jack/IdeaProjects/Escape/vendor/ThorsSerializer/ThorSerialize/Serialize.tpp:541:9:   required from ‘void ThorsAnvil::Serialize::DeSerializer::parse(T&) [with T = TerrainData]’
/home/jack/IdeaProjects/Escape/vendor/ThorsSerializer/ThorSerialize/Serialize.tpp:456:9:   [ skipping 3 instantiation contexts, use -ftemplate-backtrace-limit=0 to disable ]
/home/jack/IdeaProjects/Escape/vendor/ThorsSerializer/ThorSerialize/Serialize.tpp:515:95:   required from ‘bool ThorsAnvil::Serialize::DeSerializer::scanMembers(const string&, T&, const std::tuple<_Elements ...>&) [with T = Wrapper<TerrainData>; Members = {std::pair<const char*, TerrainData Wrapper<TerrainData>::*>}; std::string = std::__cxx11::basic_string<char>]’
/home/jack/IdeaProjects/Escape/vendor/ThorsSerializer/ThorSerialize/Serialize.tpp:531:17:   required from ‘bool ThorsAnvil::Serialize::DeSerializer::scanObjectMembers(const I&, T&) [with T = Wrapper<TerrainData>; I = std::__cxx11::basic_string<char>]’
/home/jack/IdeaProjects/Escape/vendor/ThorsSerializer/ThorSerialize/Serialize.tpp:196:21:   required from ‘void ThorsAnvil::Serialize::DeSerializationForBlock<traitType, T>::scanObject(T&) [with ThorsAnvil::Serialize::TraitType traitType = ThorsAnvil::Serialize::TraitType::Parent; T = Wrapper<TerrainData>]’
/home/jack/IdeaProjects/Escape/vendor/ThorsSerializer/ThorSerialize/Serialize.tpp:345:5:   required from ‘void ThorsAnvil::Serialize::parsePolyMorphicObject(ThorsAnvil::Serialize::DeSerializer&, ThorsAnvil::Serialize::ParserInterface&, T&) [with T = Wrapper<TerrainData>]’
/home/jack/IdeaProjects/Escape/src/serialization.cpp:68:5:   required from ‘void Wrapper<T>::parsePolyMorphicObject(ThorsAnvil::Serialize::DeSerializer&, ThorsAnvil::Serialize::ParserInterface&) [with T = TerrainData]’
/home/jack/IdeaProjects/Escape/src/serialization.cpp:68:5:   required from here
/home/jack/IdeaProjects/Escape/vendor/ThorsSerializer/ThorSerialize/Serialize.tpp:484:7: error: invalid use of incomplete type ‘struct ThorsAnvil::Serialize::TraitsInfo<TerrainData, TerrainType, ThorsAnvil::Serialize::TraitType::Invalid>’
  484 | class DeSerializeMember: public TraitsInfo<T, M, Type>::DeSerializeMember
      |       ^~~~~~~~~~~~~~~~~
In file included from /home/jack/IdeaProjects/Escape/vendor/ThorsSerializer/ThorSerialize/JsonParser.h:21,
                 from /home/jack/IdeaProjects/Escape/vendor/ThorsSerializer/ThorSerialize/JsonThor.h:15,
                 from /home/jack/IdeaProjects/Escape/src/serialization.cpp:19:
/home/jack/IdeaProjects/Escape/vendor/ThorsSerializer/ThorSerialize/Serialize.h:301:8: note: declaration of ‘struct ThorsAnvil::Serialize::TraitsInfo<TerrainData, TerrainType, ThorsAnvil::Serialize::TraitType::Invalid>’
  301 | struct TraitsInfo;
      |        ^~~~~~~~~~
In file included from /home/jack/IdeaProjects/Escape/vendor/ThorsSerializer/ThorSerialize/Serialize.h:425,
                 from /home/jack/IdeaProjects/Escape/vendor/ThorsSerializer/ThorSerialize/JsonParser.h:21,
                 from /home/jack/IdeaProjects/Escape/vendor/ThorsSerializer/ThorSerialize/JsonThor.h:15,
                 from /home/jack/IdeaProjects/Escape/src/serialization.cpp:19:
/home/jack/IdeaProjects/Escape/vendor/ThorsSerializer/ThorSerialize/Serialize.tpp:486:11: error: invalid use of incomplete type ‘struct ThorsAnvil::Serialize::TraitsInfo<TerrainData, TerrainType, ThorsAnvil::Serialize::TraitType::Invalid>’
  486 |     using Parent = typename TraitsInfo<T, M, Type>::DeSerializeMember;
      |           ^~~~~~
In file included from /home/jack/IdeaProjects/Escape/vendor/ThorsSerializer/ThorSerialize/JsonParser.h:21,
                 from /home/jack/IdeaProjects/Escape/vendor/ThorsSerializer/ThorSerialize/JsonThor.h:15,
                 from /home/jack/IdeaProjects/Escape/src/serialization.cpp:19:
/home/jack/IdeaProjects/Escape/vendor/ThorsSerializer/ThorSerialize/Serialize.h:301:8: note: declaration of ‘struct ThorsAnvil::Serialize::TraitsInfo<TerrainData, TerrainType, ThorsAnvil::Serialize::TraitType::Invalid>’
  301 | struct TraitsInfo;
      |        ^~~~~~~~~~
In file included from /home/jack/IdeaProjects/Escape/vendor/ThorsSerializer/ThorSerialize/Serialize.h:425,
                 from /home/jack/IdeaProjects/Escape/vendor/ThorsSerializer/ThorSerialize/JsonParser.h:21,
                 from /home/jack/IdeaProjects/Escape/vendor/ThorsSerializer/ThorSerialize/JsonThor.h:15,
                 from /home/jack/IdeaProjects/Escape/src/serialization.cpp:19:
/home/jack/IdeaProjects/Escape/vendor/ThorsSerializer/ThorSerialize/Serialize.tpp:488:23: error: using-declaration for non-member at class scope
  488 |         using Parent::Parent;
      |                       ^~~~~~
/home/jack/IdeaProjects/Escape/vendor/ThorsSerializer/ThorSerialize/Serialize.tpp: In instantiation of ‘bool ThorsAnvil::Serialize::DeSerializer::scanEachMember(const string&, T&, const Members&, std::index_sequence<_Idx ...>&) [with T = TerrainData; Members = std::tuple<std::pair<const char*, TerrainType TerrainData::*>, std::pair<const char*, float TerrainData::*>, std::pair<const char*, float TerrainData::*>, std::pair<const char*, float TerrainData::*>, std::pair<const char*, float TerrainData::*> >; long unsigned int ...Seq = {0, 1, 2, 3, 4}; std::string = std::__cxx11::basic_string<char>; std::index_sequence<_Idx ...> = std::integer_sequence<long unsigned int, 0, 1, 2, 3, 4>]’:
/home/jack/IdeaProjects/Escape/vendor/ThorsSerializer/ThorSerialize/Serialize.tpp:515:95:   required from ‘bool ThorsAnvil::Serialize::DeSerializer::scanMembers(const string&, T&, const std::tuple<_Elements ...>&) [with T = TerrainData; Members = {std::pair<const char*, TerrainType TerrainData::*>, std::pair<const char*, float TerrainData::*>, std::pair<const char*, float TerrainData::*>, std::pair<const char*, float TerrainData::*>, std::pair<const char*, float TerrainData::*>}; std::string = std::__cxx11::basic_string<char>]’
/home/jack/IdeaProjects/Escape/vendor/ThorsSerializer/ThorSerialize/Serialize.tpp:531:17:   required from ‘bool ThorsAnvil::Serialize::DeSerializer::scanObjectMembers(const I&, T&) [with T = TerrainData; I = std::__cxx11::basic_string<char>]’
/home/jack/IdeaProjects/Escape/vendor/ThorsSerializer/ThorSerialize/Serialize.tpp:196:21:   required from ‘void ThorsAnvil::Serialize::DeSerializationForBlock<traitType, T>::scanObject(T&) [with ThorsAnvil::Serialize::TraitType traitType = ThorsAnvil::Serialize::TraitType::Map; T = TerrainData]’
/home/jack/IdeaProjects/Escape/vendor/ThorsSerializer/ThorSerialize/Serialize.tpp:541:9:   required from ‘void ThorsAnvil::Serialize::DeSerializer::parse(T&) [with T = TerrainData]’
/home/jack/IdeaProjects/Escape/vendor/ThorsSerializer/ThorSerialize/Serialize.tpp:456:9:   required from ‘ThorsAnvil::Serialize::DeSerializeMemberContainer<T, M>::DeSerializeMemberContainer(ThorsAnvil::Serialize::DeSerializer&, ThorsAnvil::Serialize::ParserInterface&, const string&, T&, const std::pair<const char*, M T::*>&) [with T = Wrapper<TerrainData>; M = TerrainData; std::string = std::__cxx11::basic_string<char>]’
/home/jack/IdeaProjects/Escape/vendor/ThorsSerializer/ThorSerialize/Serialize.tpp:488:23:   [ skipping 2 instantiation contexts, use -ftemplate-backtrace-limit=0 to disable ]
/home/jack/IdeaProjects/Escape/vendor/ThorsSerializer/ThorSerialize/Serialize.tpp:515:95:   required from ‘bool ThorsAnvil::Serialize::DeSerializer::scanMembers(const string&, T&, const std::tuple<_Elements ...>&) [with T = Wrapper<TerrainData>; Members = {std::pair<const char*, TerrainData Wrapper<TerrainData>::*>}; std::string = std::__cxx11::basic_string<char>]’
/home/jack/IdeaProjects/Escape/vendor/ThorsSerializer/ThorSerialize/Serialize.tpp:531:17:   required from ‘bool ThorsAnvil::Serialize::DeSerializer::scanObjectMembers(const I&, T&) [with T = Wrapper<TerrainData>; I = std::__cxx11::basic_string<char>]’
/home/jack/IdeaProjects/Escape/vendor/ThorsSerializer/ThorSerialize/Serialize.tpp:196:21:   required from ‘void ThorsAnvil::Serialize::DeSerializationForBlock<traitType, T>::scanObject(T&) [with ThorsAnvil::Serialize::TraitType traitType = ThorsAnvil::Serialize::TraitType::Parent; T = Wrapper<TerrainData>]’
/home/jack/IdeaProjects/Escape/vendor/ThorsSerializer/ThorSerialize/Serialize.tpp:345:5:   required from ‘void ThorsAnvil::Serialize::parsePolyMorphicObject(ThorsAnvil::Serialize::DeSerializer&, ThorsAnvil::Serialize::ParserInterface&, T&) [with T = Wrapper<TerrainData>]’
/home/jack/IdeaProjects/Escape/src/serialization.cpp:68:5:   required from ‘void Wrapper<T>::parsePolyMorphicObject(ThorsAnvil::Serialize::DeSerializer&, ThorsAnvil::Serialize::ParserInterface&) [with T = TerrainData]’
/home/jack/IdeaProjects/Escape/src/serialization.cpp:68:5:   required from here
/home/jack/IdeaProjects/Escape/vendor/ThorsSerializer/ThorSerialize/Serialize.tpp:508:33: error: invalid static_cast from type ‘ThorsAnvil::Serialize::DeSerializeMember<TerrainData, TerrainType, ThorsAnvil::Serialize::TraitType::Invalid>’ to type ‘bool’
  508 |     CheckMembers memberCheck = {static_cast<bool>(make_DeSerializeMember(*this, parser, key, object, std::get<Seq>(member)))...};
      |                                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/jack/IdeaProjects/Escape/vendor/ThorsSerializer/ThorSerialize/Serialize.tpp:508:18: error: could not convert ‘{<expression error>}’ from ‘<brace-enclosed initializer list>’ to ‘CheckMembers’ {aka ‘std::initializer_list<bool>’}
  508 |     CheckMembers memberCheck = {static_cast<bool>(make_DeSerializeMember(*this, parser, key, object, std::get<Seq>(member)))...};
      |                  ^~~~~~~~~~~
      |                  |
      |                  <brace-enclosed initializer list>
enum class TerrainType {
    BOX,
    CIRCLE
};

struct TerrainData {
    TerrainType type;
    float argument_1;
    float argument_2;
    float argument_3;
    float argument_4;
};

ThorsAnvil_MakeTrait(TerrainData, type, argument_1, argument_2, argument_3, argument_4);

struct WrapperBase {
    virtual ~WrapperBase() {};

    virtual void *getData() { return 0; };

    ThorsAnvil_PolyMorphicSerializer(WrapperBase);
};

template<typename T>
struct Wrapper : public WrapperBase {
    Wrapper() : data() {}

    Wrapper(const Wrapper<T> &wrapper) : data(wrapper.data) {}
    Wrapper(const T &d) : data(d) {}
    Wrapper(T &&d) : data(std::move(d)) {}
    T data;
    Wrapper &operator=(const Wrapper &wrapper) {
        data = wrapper.data;
        return *this;
    }

    void *getData() {
        return &data;
    }
// The next line will not let the compiler go
    ThorsAnvil_PolyMorphicSerializer(Wrapper<T>);


};
ThorsAnvil_MakeTrait(WrapperBase);
ThorsAnvil_Template_ExpandTrait(1, WrapperBase, Wrapper , data);

MakeSimple fails

My compiler does not support the "-Wno-c++11-extensions" flag. Upon removing it I get errors pertaining to C++11 support missing.

So I edited line 5 of MakeSimple from this to this....

CXXFLAGS += -Wno-c++11-extensions

to

CXXFLAGS += -std=c++0x

now make -f MakeSimple works. Figured I'd share the issue.... Below the build output is my system details.

$ make -f MakeSimple yacc -o Json/ParserShiftReduce.tab.cpp -d Json/ParserShiftReduce.y
g++ -c Json/ParserRecursive.cpp -o Json/ParserRecursive.o -I. -Ibuild/include -Ibuild/include3rd -Wno-c++11-extensions
In file included from Json/ParserInterface.h:5:0,
from Json/ParserRecursive.h:5,
from Json/ParserRecursive.cpp:3:
Json/JsonDom.h:51:19: error: ‘unique_ptr’ is not a member of ‘std’
Json/JsonDom.h:51:19: error: ‘unique_ptr’ is not a member of ‘std’
Json/JsonDom.h:51:46: error: wrong number of template arguments (1, should be 2)
/usr/lib/gcc/x86_64-pc-linux-gnu/4.6.3/include/g++-v4/bits/stl_pair.h:87:12: error: provided for ‘template<class T1, class T2> struct std::pair’
Json/JsonDom.h:51:47: error: expected unqualified-id before ‘,’ token
Json/JsonDom.h:51:63: error: expected initializer before ‘<’ token
Json/JsonDom.h:120:5: error: ‘unique_ptr’ in namespace ‘std’ does not name a type
Json/JsonDom.h:121:35: error: expected ‘)’ before ‘<’ token
Json/JsonDom.h: In member function ‘virtual void ThorsAnvil::Json::JsonStringItem::print(std::ostream&) const’:
Json/JsonDom.h:123:75: error: ‘value’ was not declared in this scope
Json/JsonDom.h: In member function ‘virtual void ThorsAnvil::Json::JsonStringItem::setValue(std::string&) const’:
Json/JsonDom.h:125:70: error: ‘value’ was not declared in this scope
Json/JsonDom.h: At global scope:
Json/JsonDom.h:129:5: error: ‘unique_ptr’ in namespace ‘std’ does not name a type
Json/JsonDom.h:130:35: error: expected ‘)’ before ‘<’ token
Json/JsonDom.h: In member function ‘virtual void ThorsAnvil::Json::JsonNumberItem::print(std::ostream&) const’:
Json/JsonDom.h:132:68: error: ‘value’ was not declared in this scope
Json/JsonDom.h: In member function ‘virtual void ThorsAnvil::Json::JsonNumberItem::setValue(long int&) const’:
Json/JsonDom.h:134:74: error: ‘value’ was not declared in this scope
Json/JsonDom.h: In member function ‘virtual void ThorsAnvil::Json::JsonNumberItem::setValue(double&) const’:
Json/JsonDom.h:135:74: error: ‘value’ was not declared in this scope
Json/JsonDom.h: At global scope:
Json/JsonDom.h:157:5: error: ‘unique_ptr’ in namespace ‘std’ does not name a type
Json/JsonDom.h:158:32: error: expected ‘)’ before ‘<’ token
Json/JsonDom.h: In member function ‘virtual void ThorsAnvil::Json::JsonMapItem::print(std::ostream&) const’:
Json/JsonDom.h:160:68: error: ‘value’ was not declared in this scope
Json/JsonDom.h: At global scope:
Json/JsonDom.h:165:5: error: ‘unique_ptr’ in namespace ‘std’ does not name a type
Json/JsonDom.h:166:34: error: expected ‘)’ before ‘<’ token
Json/JsonDom.h: In member function ‘virtual void ThorsAnvil::Json::JsonArrayItem::print(std::ostream&) const’:
Json/JsonDom.h:168:68: error: ‘value’ was not declared in this scope
In file included from Json/ParserRecursive.h:5:0,
from Json/ParserRecursive.cpp:3:
Json/ParserInterface.h: At global scope:
Json/ParserInterface.h:55:39: error: ‘mapCreate’ declared as a ‘virtual’ field
Json/ParserInterface.h:55:29: error: expected ‘;’ at end of member declaration
Json/ParserInterface.h:55:39: error: declaration of ‘ThorsAnvil::Json::JsonMap* ThorsAnvil::Json::ParserInterface::mapCreate’
Json/ParserInterface.h:54:29: error: conflicts with previous declaration ‘virtual ThorsAnvil::Json::JsonMap* ThorsAnvil::Json::ParserInterface::mapCreate()’
Json/ParserInterface.h:55:51: error: expected ‘)’ before ‘
’ token
Json/ParserInterface.h:56:53: error: ‘JsonMapValue’ has not been declared
Json/ParserInterface.h:57:13: error: ‘JsonMapValue’ does not name a type
In file included from Json/ParserRecursive.h:5:0,
from Json/ParserRecursive.cpp:3:
Json/ParserInterface.h:84:39: error: ‘mapCreate’ declared as a ‘virtual’ field
Json/ParserInterface.h:84:29: error: expected ‘;’ at end of member declaration
Json/ParserInterface.h:84:39: error: declaration of ‘ThorsAnvil::Json::JsonMap
ThorsAnvil::Json::ParseLogInterface::mapCreate’
Json/ParserInterface.h:83:29: error: conflicts with previous declaration ‘virtual ThorsAnvil::Json::JsonMap* ThorsAnvil::Json::ParseLogInterface::mapCreate()’
Json/ParserInterface.h:84:51: error: expected ‘)’ before ‘’ token
Json/ParserInterface.h:85:49: error: ‘JsonMapValue’ has not been declared
Json/ParserInterface.h:86:13: error: ‘JsonMapValue’ does not name a type
Json/ParserInterface.h:113:39: error: ‘mapCreate’ declared as a ‘virtual’ field
Json/ParserInterface.h:113:29: error: expected ‘;’ at end of member declaration
Json/ParserInterface.h:113:39: error: declaration of ‘ThorsAnvil::Json::JsonMap
ThorsAnvil::Json::ParserCleanInterface::mapCreate’
Json/ParserInterface.h:112:29: error: conflicts with previous declaration ‘virtual ThorsAnvil::Json::JsonMap* ThorsAnvil::Json::ParserCleanInterface::mapCreate()’
Json/ParserInterface.h:113:51: error: expected ‘)’ before ‘’ token
Json/ParserInterface.h:114:53: error: ‘JsonMapValue’ has not been declared
Json/ParserInterface.h:115:13: error: ‘JsonMapValue’ does not name a type
Json/ParserInterface.h: In member function ‘virtual ThorsAnvil::Json::JsonMap
ThorsAnvil::Json::ParserCleanInterface::mapAppend(ThorsAnvil::Json::JsonMap_, int_)’:
Json/ParserInterface.h:114:83: error: ‘unique_ptr’ is not a member of ‘std’
Json/ParserInterface.h:114:99: error: ‘JsonMapValue’ was not declared in this scope
Json/ParserInterface.h:114:121: error: ‘aval’ was not declared in this scope
Json/ParserInterface.h: In member function ‘virtual ThorsAnvil::Json::JsonArray* ThorsAnvil::Json::ParserCleanInterface::arrayAppend(ThorsAnvil::Json::JsonArray_, ThorsAnvil::Json::JsonValue_)’:
Json/ParserInterface.h:121:83: error: ‘unique_ptr’ is not a member of ‘std’
Json/ParserInterface.h:121:108: error: expected primary-expression before ‘>’ token
Json/ParserInterface.h:121:118: error: ‘aarr’ was not declared in this scope
Json/ParserInterface.h: At global scope:
Json/ParserInterface.h:137:39: error: ‘mapCreate’ declared as a ‘virtual’ field
Json/ParserInterface.h:137:29: error: expected ‘;’ at end of member declaration
Json/ParserInterface.h:137:39: error: declaration of ‘ThorsAnvil::Json::JsonMap* ThorsAnvil::Json::ParserDomInterface::mapCreate’
Json/ParserInterface.h:136:29: error: conflicts with previous declaration ‘virtual ThorsAnvil::Json::JsonMap* ThorsAnvil::Json::ParserDomInterface::mapCreate()’
Json/ParserInterface.h:137:51: error: expected ‘)’ before ‘’ token
Json/ParserInterface.h:138:53: error: ‘JsonMapValue’ has not been declared
Json/ParserInterface.h:139:13: error: ‘JsonMapValue’ does not name a type
Json/ParserInterface.h: In member function ‘virtual ThorsAnvil::Json::JsonMap
ThorsAnvil::Json::ParserDomInterface::mapAppend(ThorsAnvil::Json::JsonMap_, int_)’:
Json/ParserInterface.h:138:83: error: ‘unique_ptr’ is not a member of ‘std’
Json/ParserInterface.h:138:99: error: ‘JsonMapValue’ was not declared in this scope
Json/ParserInterface.h:138:120: error: ‘aval’ was not declared in this scope
Json/ParserInterface.h:138:122: error: ‘unique_ptr’ is not a member of ‘std’
Json/ParserInterface.h:138:145: error: expected primary-expression before ‘>’ token
Json/ParserInterface.h:138:155: error: ‘amap’ was not declared in this scope
Json/ParserInterface.h: In member function ‘virtual ThorsAnvil::Json::JsonArray* ThorsAnvil::Json::ParserDomInterface::arrayCreate(ThorsAnvil::Json::JsonValue_)’:
Json/ParserInterface.h:145:83: error: ‘unique_ptr’ is not a member of ‘std’
Json/ParserInterface.h:145:108: error: expected primary-expression before ‘>’ token
Json/ParserInterface.h:145:119: error: ‘aval’ was not declared in this scope
Json/ParserInterface.h:145:121: error: ‘unique_ptr’ is not a member of ‘std’
Json/ParserInterface.h:145:146: error: expected primary-expression before ‘>’ token
Json/ParserInterface.h:145:170: error: ‘aarr’ was not declared in this scope
Json/ParserInterface.h: In member function ‘virtual ThorsAnvil::Json::JsonArray_ ThorsAnvil::Json::ParserDomInterface::arrayAppend(ThorsAnvil::Json::JsonArray_, ThorsAnvil::Json::JsonValue_)’:
Json/ParserInterface.h:146:83: error: ‘unique_ptr’ is not a member of ‘std’
Json/ParserInterface.h:146:108: error: expected primary-expression before ‘>’ token
Json/ParserInterface.h:146:119: error: ‘aval’ was not declared in this scope
Json/ParserInterface.h:146:121: error: ‘unique_ptr’ is not a member of ‘std’
Json/ParserInterface.h:146:146: error: expected primary-expression before ‘>’ token
Json/ParserInterface.h:146:158: error: ‘aarr’ was not declared in this scope
Json/ParserInterface.h: In member function ‘virtual ThorsAnvil::Json::JsonValue* ThorsAnvil::Json::ParserDomInterface::arrayCreateElement(ThorsAnvil::Json::JsonValue_)’:
Json/ParserInterface.h:148:83: error: ‘unique_ptr’ is not a member of ‘std’
Json/ParserInterface.h:148:108: error: expected primary-expression before ‘>’ token
Json/ParserInterface.h:148:119: error: ‘aval’ was not declared in this scope
Json/ParserInterface.h: In member function ‘virtual ThorsAnvil::Json::JsonValue_ ThorsAnvil::Json::ParserDomInterface::valueParseMap(ThorsAnvil::Json::JsonMap_)’:
Json/ParserInterface.h:150:83: error: ‘unique_ptr’ is not a member of ‘std’
Json/ParserInterface.h:150:106: error: expected primary-expression before ‘>’ token
Json/ParserInterface.h:150:120: error: ‘amap’ was not declared in this scope
Json/ParserInterface.h: In member function ‘virtual ThorsAnvil::Json::JsonValue_ ThorsAnvil::Json::ParserDomInterface::valueParseArray(ThorsAnvil::Json::JsonArray_)’:
Json/ParserInterface.h:151:83: error: ‘unique_ptr’ is not a member of ‘std’
Json/ParserInterface.h:151:108: error: expected primary-expression before ‘>’ token
Json/ParserInterface.h:151:120: error: ‘aarr’ was not declared in this scope
Json/ParserInterface.h: In member function ‘virtual ThorsAnvil::Json::JsonValue_ ThorsAnvil::Json::ParserDomInterface::valueParseString(std::string_)’:
Json/ParserInterface.h:152:83: error: ‘unique_ptr’ is not a member of ‘std’
Json/ParserInterface.h:152:110: error: expected primary-expression before ‘>’ token
Json/ParserInterface.h:152:120: error: ‘astr’ was not declared in this scope
Json/ParserInterface.h: In member function ‘virtual ThorsAnvil::Json::JsonValue_ ThorsAnvil::Json::ParserDomInterface::valueParseNumber(std::string_)’:
Json/ParserInterface.h:153:83: error: ‘unique_ptr’ is not a member of ‘std’
Json/ParserInterface.h:153:110: error: expected primary-expression before ‘>’ token
Json/ParserInterface.h:153:120: error: ‘anum’ was not declared in this scope
In file included from Json/ParserRecursive.cpp:3:0:
Json/ParserRecursive.h: At global scope:
Json/ParserRecursive.h:21:42: error: ‘std::unique_ptr’ has not been declared
Json/ParserRecursive.h:21:52: error: expected ‘,’ or ‘...’ before ‘<’ token
Json/ParserRecursive.h:22:49: error: ‘std::unique_ptr’ has not been declared
Json/ParserRecursive.h:22:59: error: expected ‘,’ or ‘...’ before ‘<’ token
Json/ParserRecursive.h:23:51: error: ‘std::unique_ptr’ has not been declared
Json/ParserRecursive.h:23:61: error: expected ‘,’ or ‘...’ before ‘<’ token
Json/ParserRecursive.h:24:40: error: ‘std::unique_ptr’ has not been declared
Json/ParserRecursive.h:24:50: error: expected ‘,’ or ‘...’ before ‘<’ token
Json/ParserRecursive.h:25:42: error: ‘std::unique_ptr’ has not been declared
Json/ParserRecursive.h:25:52: error: expected ‘,’ or ‘...’ before ‘<’ token
In file included from Json/ParserRecursive.cpp:4:0:
Json/ParserShiftReduce.h:12:25: error: ‘ThorsAnvil::Json::JsonMapValue’ has not been declared
In file included from Json/ParserShiftReduce.h:23:0,
from Json/ParserRecursive.cpp:4:
Json/ParserShiftReduce.y:33:5: error: ‘JsonMapValue’ does not name a type
Json/ParserRecursive.cpp:13:51: error: ‘std::unique_ptr’ has not been declared
Json/ParserRecursive.cpp:13:61: error: expected ‘,’ or ‘...’ before ‘<’ token
Json/ParserRecursive.cpp: In member function ‘int ThorsAnvil::Json::ParserRecursive::JsonValueParse(int, int)’:
Json/ParserRecursive.cpp:18:61: error: ‘unique_ptr’ is not a member of ‘std’
Json/ParserRecursive.cpp:18:84: error: expected primary-expression before ‘>’ token
Json/ParserRecursive.cpp:18:91: error: ‘map’ was not declared in this scope
Json/ParserRecursive.cpp:18:91: note: suggested alternative:
/usr/lib/gcc/x86_64-pc-linux-gnu/4.6.3/include/g++-v4/bits/stl_map.h:88:11: note: ‘std::map’
Json/ParserRecursive.cpp:21:65: error: ‘value’ was not declared in this scope
Json/ParserRecursive.cpp:26:61: error: ‘unique_ptr’ is not a member of ‘std’
Json/ParserRecursive.cpp:26:86: error: expected primary-expression before ‘>’ token
Json/ParserRecursive.cpp:26:91: error: ‘array’ was not declared in this scope
Json/ParserRecursive.cpp:29:65: error: ‘value’ was not declared in this scope
Json/ParserRecursive.cpp:33:57: error: ‘value’ was not declared in this scope
Json/ParserRecursive.cpp: At global scope:
Json/ParserRecursive.cpp:42:58: error: ‘std::unique_ptr’ has not been declared
Json/ParserRecursive.cpp:42:68: error: expected ‘,’ or ‘...’ before ‘<’ token
Json/ParserRecursive.cpp: In member function ‘int ThorsAnvil::Json::ParserRecursive::JsonMapValueListParse(int, int)’:
Json/ParserRecursive.cpp:46:9: error: ‘unique_ptr’ is not a member of ‘std’
Json/ParserRecursive.cpp:46:36: error: expected primary-expression before ‘>’ token
Json/ParserRecursive.cpp:46:67: error: ‘key’ was not declared in this scope
Json/ParserRecursive.cpp:50:13: error: ‘unique_ptr’ is not a member of ‘std’
Json/ParserRecursive.cpp:50:38: error: expected primary-expression before ‘>’ token
Json/ParserRecursive.cpp:50:43: error: ‘value’ was not declared in this scope
Json/ParserRecursive.cpp:53:17: error: ‘unique_ptr’ is not a member of ‘std’
Json/ParserRecursive.cpp:53:33: error: ‘JsonMapValue’ was not declared in this scope
Json/ParserRecursive.cpp:53:61: error: ‘struct ThorsAnvil::Json::ParserInterface’ has no member named ‘mapCreateElement’
Json/ParserRecursive.cpp:53:109: error: ‘mapValue’ was not declared in this scope
Json/ParserRecursive.cpp:54:21: error: ‘map’ was not declared in this scope
Json/ParserRecursive.cpp:54:21: note: suggested alternative:
/usr/lib/gcc/x86_64-pc-linux-gnu/4.6.3/include/g++-v4/bits/stl_map.h:88:11: note: ‘std::map’
Json/ParserRecursive.cpp:66:71: error: ‘map’ was not declared in this scope
Json/ParserRecursive.cpp:66:71: note: suggested alternative:
/usr/lib/gcc/x86_64-pc-linux-gnu/4.6.3/include/g++-v4/bits/stl_map.h:88:11: note: ‘std::map’
Json/ParserRecursive.cpp: At global scope:
Json/ParserRecursive.cpp:75:60: error: ‘std::unique_ptr’ has not been declared
Json/ParserRecursive.cpp:75:70: error: expected ‘,’ or ‘...’ before ‘<’ token
Json/ParserRecursive.cpp: In member function ‘int ThorsAnvil::Json::ParserRecursive::JsonArrayValueListParse(int, int)’:
Json/ParserRecursive.cpp:77:5: error: ‘unique_ptr’ is not a member of ‘std’
Json/ParserRecursive.cpp:77:30: error: expected primary-expression before ‘>’ token
Json/ParserRecursive.cpp:77:35: error: ‘value’ was not declared in this scope
Json/ParserRecursive.cpp:81:13: error: ‘array’ was not declared in this scope
Json/ParserRecursive.cpp:93:25: error: ‘array’ was not declared in this scope
Json/ParserRecursive.cpp: At global scope:
Json/ParserRecursive.cpp:99:49: error: ‘std::unique_ptr’ has not been declared
Json/ParserRecursive.cpp:99:59: error: expected ‘,’ or ‘...’ before ‘<’ token
Json/ParserRecursive.cpp: In member function ‘int ThorsAnvil::Json::ParserRecursive::JsonMapParse(int, int)’:
Json/ParserRecursive.cpp:105:9: error: ‘map’ was not declared in this scope
Json/ParserRecursive.cpp:105:9: note: suggested alternative:
/usr/lib/gcc/x86_64-pc-linux-gnu/4.6.3/include/g++-v4/bits/stl_map.h:88:11: note: ‘std::map’
Json/ParserRecursive.cpp:110:45: error: ‘map’ was not declared in this scope
Json/ParserRecursive.cpp:110:45: note: suggested alternative:
/usr/lib/gcc/x86_64-pc-linux-gnu/4.6.3/include/g++-v4/bits/stl_map.h:88:11: note: ‘std::map’
Json/ParserRecursive.cpp: At global scope:
Json/ParserRecursive.cpp:115:51: error: ‘std::unique_ptr’ has not been declared
Json/ParserRecursive.cpp:115:61: error: expected ‘,’ or ‘...’ before ‘<’ token
Json/ParserRecursive.cpp: In member function ‘int ThorsAnvil::Json::ParserRecursive::JsonArrayParse(int, int)’:
Json/ParserRecursive.cpp:121:9: error: ‘array’ was not declared in this scope
Json/ParserRecursive.cpp:126:47: error: ‘array’ was not declared in this scope
Json/ParserRecursive.cpp: In member function ‘int ThorsAnvil::Json::ParserRecursive::parseJosnObject(int)’:
Json/ParserRecursive.cpp:134:5: error: ‘unique_ptr’ is not a member of ‘std’
Json/ParserRecursive.cpp:134:28: error: expected primary-expression before ‘>’ token
Json/ParserRecursive.cpp:134:35: error: ‘map’ was not declared in this scope
Json/ParserRecursive.cpp:134:35: note: suggested alternative:
/usr/lib/gcc/x86_64-pc-linux-gnu/4.6.3/include/g++-v4/bits/stl_map.h:88:11: note: ‘std::map’
Json/ParserRecursive.cpp:135:5: error: ‘unique_ptr’ is not a member of ‘std’
Json/ParserRecursive.cpp:135:30: error: expected primary-expression before ‘>’ token
Json/ParserRecursive.cpp:135:35: error: ‘array’ was not declared in this scope
At global scope:
cc1plus: warning: unrecognized command line option "-Wno-c++11-extensions" [enabled by default]
make: *_* [Json/ParserRecursive.o] Error 1

========== FIXED OUTPUT ============

make -f MakeSimple g++ -c Json/ParserRecursive.cpp -o Json/ParserRecursive.o -I. -Ibuild/include -Ibuild/include3rd -std=c++0x
g++ -c Json/ParserShiftReduce.tab.cpp -o Json/ParserShiftReduce.tab.o -I. -Ibuild/include -Ibuild/include3rd -std=c++0x
g++ -c Json/ScannerSax.cpp -o Json/ScannerSax.o -I. -Ibuild/include -Ibuild/include3rd -std=c++0x
g++ -c Json/LexerJson.cpp -o Json/LexerJson.o -I. -Ibuild/include -Ibuild/include3rd -std=c++0x
g++ -c Json/JsonUtil.cpp -o Json/JsonUtil.o -I. -Ibuild/include -Ibuild/include3rd -std=c++0x
g++ -c Json/ScannerDom.cpp -o Json/ScannerDom.o -I. -Ibuild/include -Ibuild/include3rd -std=c++0x
g++ -c Json/ParserInterface.cpp -o Json/ParserInterface.o -I. -Ibuild/include -Ibuild/include3rd -std=c++0x
g++ -c Serialize/JsonSerializer.cpp -o Serialize/JsonSerializer.o -I. -Ibuild/include -Ibuild/include3rd -std=c++0x
ar rv serialize.a Json/ParserRecursive.o Json/ParserShiftReduce.tab.o Json/ScannerSax.o Json/LexerJson.o Json/JsonUtil.o Json/ScannerDom.o Json/ParserInterface.o Serialize/JsonSerializer.o
ar: creating serialize.a
a - Json/ParserRecursive.o
a - Json/ParserShiftReduce.tab.o
a - Json/ScannerSax.o
a - Json/LexerJson.o
a - Json/JsonUtil.o
a - Json/ScannerDom.o
a - Json/ParserInterface.o
a - Serialize/JsonSerializer.o

========== SYSTEM DETAILS ===========
$ make -v
GNU Make 3.82
Built for x86_64-pc-linux-gnu
Copyright (C) 2010 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later http://gnu.org/licenses/gpl.html
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

$ gcc -v
Using built-in specs.
COLLECT_GCC=/usr/x86_64-pc-linux-gnu/gcc-bin/4.6.3/gcc
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-pc-linux-gnu/4.6.3/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: /var/tmp/portage/sys-devel/gcc-4.6.3/work/gcc-4.6.3/configure --prefix=/usr --bindir=/usr/x86_64-pc-linux-gnu/gcc-bin/4.6.3 --includedir=/usr/lib/gcc/x86_64-pc-linux-gnu/4.6.3/include --datadir=/usr/share/gcc-data/x86_64-pc-linux-gnu/4.6.3 --mandir=/usr/share/gcc-data/x86_64-pc-linux-gnu/4.6.3/man --infodir=/usr/share/gcc-data/x86_64-pc-linux-gnu/4.6.3/info --with-gxx-include-dir=/usr/lib/gcc/x86_64-pc-linux-gnu/4.6.3/include/g++-v4 --host=x86_64-pc-linux-gnu --build=x86_64-pc-linux-gnu --disable-altivec --disable-fixed-point --without-cloog --without-ppl --disable-lto --enable-nls --without-included-gettext --with-system-zlib --enable-obsolete --disable-werror --enable-secureplt --enable-multilib --enable-libmudflap --disable-libssp --enable-esp --enable-libgomp --with-python-dir=/share/gcc-data/x86_64-pc-linux-gnu/4.6.3/python --enable-checking=release --disable-libgcj --enable-libstdcxx-time --disable-libquadmath --enable-languages=c,c++ --enable-shared --enable-threads=posix --enable-__cxa_atexit --enable-clocale=gnu --enable-targets=all --with-bugurl=http://bugs.gentoo.org/ --with-pkgversion='Gentoo Hardened 4.6.3 p1.13, pie-0.5.2'
Thread model: posix
gcc version 4.6.3 (Gentoo Hardened 4.6.3 p1.13, pie-0.5.2)

$ uname -a
Linux SilkRouteLaptop 3.8.13-gentoo #6 SMP Mon Dec 9 16:55:07 EST 2013 x86_64 AMD A10-4600M APU with Radeon(tm) HD Graphics AuthenticAMD GNU/Linux

Serialization Issues

Using this struct:

struct Manifest {
    std::string bucket;  // The bucket, if any associated with it
    std::string kind;    // The type of manifest 
    std::map<std::string, std::string> localToRemoteFilenames;
};

I'm getting

terminate called after throwing an instance of 'ThorsAnvil::Json::ParsingError'
  what():  Invalid Character in Lexer
Aborted

I'm going to try to track down which character, but this is the input:

{
    "localToRemoteFilenames": {
        "sample.authority.lzoc" : "sample.10/sample.authority.lzoc",
        "sample.crawlrank.lzoc" : "sample.10/sample.crawlrank.lzoc",
        "sample.externalmozrank.lzoc" : "sample.10/sample.externalmozrank.lzoc",
        "sample.http.varint.lzoc" : "sample.10/sample.http.varint.lzoc",
        "sample.lastcrawl.varint.lzoc" : "sample.10/sample.lastcrawl.varint.lzoc",
        "sample.lzoc" : "sample.10/sample.lzoc",
        "sample.rank.lzoc" : "sample.10/sample.rank.lzoc",
        "sample.urlschema.varint.lzoc" : "sample.10/sample.urlschema.varint.lzoc"
    }
}

issue with making configuration for build

I'm installing ThorsSerializer and I've run into this issue when going through the installation process. When I type 'make' after getting the library and entering './configure --disable-binary' I get the error messages as shown below.

Buiding src Start
make -C src install PREFIX=/home/mark/ThorsSerializer/build CXXSTDVER=17
make[1]: Entering directory '/home/mark/ThorsSerializer/src'
Buiding Serialize Start
make -C Serialize install PREFIX=/home/mark/ThorsSerializer/build CXXSTDVER=17
make[2]: Entering directory '/home/mark/ThorsSerializer/src/Serialize'
Building Objects for Testing and Coverage
make[3]: Entering directory '/home/mark/ThorsSerializer/src/Serialize'
ERROR
g++ -c JsonLexer.lex.cpp -o coverage/JsonLexer.lex.o -I/usr/local/include -fPIC -Wall -Wextra -Wstrict-aliasing -pedantic -Werror -Wunreachable-code -Wno-long-long -Wno-deprecated-register -Wno-sign-compare -I/home/mark/ThorsSerializer/build/include -isystem /home/mark/ThorsSerializer/build/include3rd -DCOVERAGE_Serialize -g -fprofile-arcs -ftest-coverage -DCOVERAGE_TEST -Wno-unused-private-field -Wno-unreachable-code -DTHOR_USE_CPLUSPLUS17 -std=c++17

JsonLexer.lex.cpp:1:1: error: ‘flex’ does not name a type
flex -t JsonLexer.l
^
cc1plus: error: unrecognized command line option ‘-Wno-unused-private-field’ [-Werror]
cc1plus: error: unrecognized command line option ‘-Wno-deprecated-register’ [-Werror]
cc1plus: all warnings being treated as errors
/home/mark/ThorsSerializer/build/tools/Makefile:560: recipe for target 'coverage/JsonLexer.lex.o' failed
make[3]: *** [coverage/JsonLexer.lex.o] Error 1
make[3]: *** Waiting for unfinished jobs....
g++ -c Serialize.cpp -DCOVERAGE_Serialize OK
make[3]: *** wait: No child processes. Stop.
/home/mark/ThorsSerializer/build/tools/Makefile:343: recipe for target 'run_test' failed
make[2]: *** [run_test] Error 2
make[2]: Leaving directory '/home/mark/ThorsSerializer/src/Serialize'
/home/mark/ThorsSerializer/build/tools/Project.Makefile:33: recipe for target 'Serialize.dir' failed
make[1]: *** [Serialize.dir] Error 2
make[1]: Leaving directory '/home/mark/ThorsSerializer/src'
/home/mark/ThorsSerializer/build/tools/Project.Makefile:33: recipe for target 'src.dir' failed
make: *** [src.dir] Error 2

Please help! It looks like a type name is missing from JsonLexer.lex.cpp.

Serializing does not compile if class has static member variables

Hello

I noticed, that if you have a static member in a class and try to serialize it, the program will not compile.

Is this expected?
Cheers,
Florian Luetticke
Compiler:
gcc version 4.9.1 20140922 (Red Hat 4.9.1-10) (GCC)

Minimal example:

#include "thorsSerializer/Serialize/Traits.h"
#include "thorsSerializer/Serialize/SerUtil.h"
#include "thorsSerializer/Serialize/JsonThor.h"
#include <iostream>
class test{
    static int member;
public:
    test(){}
    friend struct ThorsAnvil::Serialize::Traits<test>;
};
int test::member=3;

int main(int argc, char **argv) {
    test t1;
    using ThorsAnvil::Serialize::jsonExport;
    std::cout << jsonExport(t1) << "\n";
}

Compile error in the file.
error.txt

Unable to configure: no Tcl_Init in -ltcl

Describe the bug
Can not complete configure. Complains that there is no Tcl_Init in -ltcl

checking for Tcl_Init in -ltcl... no
configure: error: The build tools needs libtcl. Please install it.

Yet tcl and libtcl are installed

output of sudo apt-get install libtcl8.6:
libtcl8.6 is already the newest version (8.6.8+dfsg-3)

A description of how to build and run the code

$ ./configure --disable-binary

Expected behavior
To be able to complete the config script so I can make

Environment:

  • OS: Linux Mint 19.3

uname -a
Linux kiosk-dev 5.0.0-32-generic #34~18.04.2-Ubuntu SMP Thu Oct 10 10:36:02 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux

  • Compiler and Version
    $ g++ --version
    g++ (Ubuntu 7.4.0-1ubuntu1~18.04.1) 7.4.0

$ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/7/lto-wrapper
OFFLOAD_TARGET_NAMES=nvptx-none
OFFLOAD_TARGET_DEFAULT=1
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu 7.4.0-1ubuntu118.04.1' --with-bugurl=file:///usr/share/doc/gcc-7/README.Bugs --enable-languages=c,ada,c++,go,brig,d,fortran,objc,obj-c++ --prefix=/usr --with-gcc-major-version-only --program-suffix=-7 --program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-libmpx --enable-plugin --enable-default-pie --with-system-zlib --with-target-system-zlib --enable-objc-gc=auto --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-offload-targets=nvptx-none --without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 7.4.0 (Ubuntu 7.4.0-1ubuntu1
18.04.1)

Issue with ALT_REP_OF_NN in traits.h

I haven't actually used this software, but inspecting traits.h, it looks to me that the TEMPLATE macros won't work for more than 1 template parameter. You have on master

#define ALT_REP_OF_10(Act, E, P, S)     P ALT_EXPAND(Act, E, 10), ALT_REP_OF_09(Act, E,  , S)
#define ALT_REP_OF_9(Act, E, P, S)      P ALT_EXPAND(Act, E, 9), ALT_REP_OF_08(Act, E,  , S)
#define ALT_REP_OF_8(Act, E, P, S)      P ALT_EXPAND(Act, E, 8), ALT_REP_OF_07(Act, E,  , S)
#define ALT_REP_OF_7(Act, E, P, S)      P ALT_EXPAND(Act, E, 7), ALT_REP_OF_06(Act, E,  , S)
#define ALT_REP_OF_6(Act, E, P, S)      P ALT_EXPAND(Act, E, 6), ALT_REP_OF_05(Act, E,  , S)
#define ALT_REP_OF_5(Act, E, P, S)      P ALT_EXPAND(Act, E, 5), ALT_REP_OF_04(Act, E,  , S)
#define ALT_REP_OF_4(Act, E, P, S)      P ALT_EXPAND(Act, E, 4), ALT_REP_OF_03(Act, E,  , S)
#define ALT_REP_OF_3(Act, E, P, S)      P ALT_EXPAND(Act, E, 3), ALT_REP_OF_02(Act, E,  , S)
#define ALT_REP_OF_2(Act, E, P, S)      P ALT_EXPAND(Act, E, 2), ALT_REP_OF_01(Act, E,  , S)
#define ALT_REP_OF_1(Act, E, P, S)      P ALT_EXPAND(Act, E, 1) S

I believe that should be

#define ALT_REP_OF_10(Act, E, P, S)     P ALT_EXPAND(Act, E, 10), ALT_REP_OF_9(Act, E,  , S)
#define ALT_REP_OF_9(Act, E, P, S)      P ALT_EXPAND(Act, E, 9), ALT_REP_OF_8(Act, E,  , S)
#define ALT_REP_OF_8(Act, E, P, S)      P ALT_EXPAND(Act, E, 8), ALT_REP_OF_7(Act, E,  , S)
#define ALT_REP_OF_7(Act, E, P, S)      P ALT_EXPAND(Act, E, 7), ALT_REP_OF_6(Act, E,  , S)
#define ALT_REP_OF_6(Act, E, P, S)      P ALT_EXPAND(Act, E, 6), ALT_REP_OF_5(Act, E,  , S)
#define ALT_REP_OF_5(Act, E, P, S)      P ALT_EXPAND(Act, E, 5), ALT_REP_OF_4(Act, E,  , S)
#define ALT_REP_OF_4(Act, E, P, S)      P ALT_EXPAND(Act, E, 4), ALT_REP_OF_3(Act, E,  , S)
#define ALT_REP_OF_3(Act, E, P, S)      P ALT_EXPAND(Act, E, 3), ALT_REP_OF_2(Act, E,  , S)
#define ALT_REP_OF_2(Act, E, P, S)      P ALT_EXPAND(Act, E, 2), ALT_REP_OF_1(Act, E,  , S)
#define ALT_REP_OF_1(Act, E, P, S)      P ALT_EXPAND(Act, E, 1) S

Best regards,
Daniel

Heavy usage of unique_ptr introduces problem

Hi, as almost all properties of the JSON body I get within a REST webservice are optional I heavily use unique_ptr. This results in a compiler error. I guess because the line

object = PolyMorphicRegistry::getNamedTypeConvertedTo<BaseType>(className);

within tryParsePolyMorphicObject tries to copy a unique_ptr where it should move it instead.

Here is an example:

#include <iostream>

#include <ThorSerialize/JsonThor.h>
#include <ThorSerialize/SerUtil.h>

using namespace ThorsAnvil::Serialize;
using namespace std;

struct Quantities {
    std::vector<int>* quantities;

    ~Quantities()
    {
        delete quantities;
    }
};

ThorsAnvil_MakeTrait(Quantities, quantities);

struct AbstractTourResult {
    std::unique_ptr<Quantities> maxQuantities { nullptr };
    virtual ~AbstractTourResult() = default;
    ThorsAnvil_PolyMorphicSerializer(AbstractTourResult);
};
ThorsAnvil_MakeTrait(AbstractTourResult, maxQuantities);

struct TourResult : public AbstractTourResult {
    ~TourResult() override = default;
    ThorsAnvil_PolyMorphicSerializer(TourResult);
};
ThorsAnvil_ExpandTrait(AbstractTourResult, TourResult);

struct Tour {
    std::unique_ptr<TourResult> result { nullptr };
};
ThorsAnvil_MakeTrait(Tour, result);

int main()
{
    Tour t {};
    string str {};
    istringstream(str) >> ThorsAnvil::Serialize::jsonImport(t);

    return 0;
}

Error:

In file included from /Users/ivhedtke/CLionProjects/testthor/main.cpp:3:
In file included from /usr/local/Cellar/thors-serializer/1.10.1/include/ThorSerialize/JsonThor.h:14:
In file included from /usr/local/Cellar/thors-serializer/1.10.1/include/ThorSerialize/JsonParser.h:20:
In file included from /usr/local/Cellar/thors-serializer/1.10.1/include/ThorSerialize/Serialize.h:393:
/usr/local/Cellar/thors-serializer/1.10.1/include/ThorSerialize/Serialize.tpp:251:12: error: no viable overloaded '='
    object = PolyMorphicRegistry::getNamedTypeConvertedTo<BaseType>(className);
    ~~~~~~ ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/local/Cellar/thors-serializer/1.10.1/include/ThorSerialize/Serialize.tpp:304:13: note: in instantiation of function template specialization 'ThorsAnvil::Serialize::tryParsePolyMorphicObject<std::__1::unique_ptr<TourResult, std::__1::default_delete<TourResult> > >' requested here
            tryParsePolyMorphicObject(parent, parser, object, 0);
            ^
/usr/local/Cellar/thors-serializer/1.10.1/include/ThorSerialize/Serialize.tpp:412:22: note: in instantiation of member function 'ThorsAnvil::Serialize::DeSerializationForBlock<ThorsAnvil::Serialize::TraitType::Pointer, std::__1::unique_ptr<TourResult, std::__1::default_delete<TourResult> > >::scanObject' requested here
        deserializer.scanObject(object);
                     ^
/usr/local/Cellar/thors-serializer/1.10.1/include/ThorSerialize/Serialize.tpp:396:5: note: in instantiation of member function 'ThorsAnvil::Serialize::DeSerializeMemberValue<Tour, std::__1::unique_ptr<TourResult, std::__1::default_delete<TourResult> >, ThorsAnvil::Serialize::TraitType::Pointer>::init' requested here
    init(parent, parser, key, memberInfo.first, object.*(memberInfo.second));
    ^
/usr/local/Cellar/thors-serializer/1.10.1/include/ThorSerialize/Serialize.tpp:433:12: note: in instantiation of member function 'ThorsAnvil::Serialize::DeSerializeMemberValue<Tour, std::__1::unique_ptr<TourResult, std::__1::default_delete<TourResult> >, ThorsAnvil::Serialize::TraitType::Pointer>::DeSerializeMemberValue' requested here
    return DeSerializeMember<T, M>(parent, parser, key, object, memberInfo);
           ^
/usr/local/Cellar/thors-serializer/1.10.1/include/ThorSerialize/Serialize.tpp:441:51: note: in instantiation of function template specialization 'ThorsAnvil::Serialize::make_DeSerializeMember<Tour, std::__1::unique_ptr<TourResult, std::__1::default_delete<TourResult> > >' requested here
    CheckMembers memberCheck = {static_cast<bool>(make_DeSerializeMember(*this, parser, key, object, std::get<Seq>(member)))...};
                                                  ^
/usr/local/Cellar/thors-serializer/1.10.1/include/ThorSerialize/Serialize.tpp:448:12: note: (skipping 2 contexts in backtrace; use -ftemplate-backtrace-limit=0 to see all)
    return scanEachMember(key, object, members, std::make_index_sequence<sizeof...(Members)>());
           ^
/usr/local/Cellar/thors-serializer/1.10.1/include/ThorSerialize/Serialize.tpp:146:29: note: in instantiation of function template specialization 'ThorsAnvil::Serialize::DeSerializer::scanObjectMembers<Tour, std::__1::basic_string<char> >' requested here
                if (!parent.scanObjectMembers(key, object))
                            ^
/usr/local/Cellar/thors-serializer/1.10.1/include/ThorSerialize/Serialize.tpp:474:15: note: in instantiation of member function 'ThorsAnvil::Serialize::DeSerializationForBlock<ThorsAnvil::Serialize::TraitType::Map, Tour>::scanObject' requested here
        block.scanObject(object);
              ^
/usr/local/Cellar/thors-serializer/1.10.1/include/ThorSerialize/Importer.h:34:30: note: in instantiation of function template specialization 'ThorsAnvil::Serialize::DeSerializer::parse<Tour>' requested here
                deSerializer.parse(data.value);
                             ^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/istream:1440:10: note: in instantiation of member function 'ThorsAnvil::Serialize::operator>>' requested here
    __is >> _VSTD::forward<_Tp>(__x);
         ^
/Users/ivhedtke/CLionProjects/testthor/main.cpp:42:24: note: in instantiation of function template specialization 'std::__1::operator>><char, std::__1::char_traits<char>, ThorsAnvil::Serialize::Importer<ThorsAnvil::Serialize::Json, Tour> >' requested here
    istringstream(str) >> ThorsAnvil::Serialize::jsonImport(t);
                       ^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/memory:2347:28: note: candidate function (the implicit copy assignment operator) not viable: no known conversion from 'std::__1::unique_ptr<TourResult, std::__1::default_delete<TourResult> > *' to 'const std::__1::unique_ptr<TourResult, std::__1::default_delete<TourResult> >' for 1st argument; dereference the argument with *
class _LIBCPP_TEMPLATE_VIS unique_ptr {
                           ^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/memory:2463:15: note: candidate function not viable: no known conversion from 'std::__1::unique_ptr<TourResult, std::__1::default_delete<TourResult> > *' to 'std::__1::unique_ptr<TourResult, std::__1::default_delete<TourResult> >' for 1st argument; dereference the argument with *
  unique_ptr& operator=(unique_ptr&& __u) _NOEXCEPT {
              ^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/memory:2555:15: note: candidate function not viable: no known conversion from 'std::__1::unique_ptr<TourResult, std::__1::default_delete<TourResult> > *' to 'std::nullptr_t' (aka 'nullptr_t') for 1st argument
  unique_ptr& operator=(nullptr_t) _NOEXCEPT {
              ^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/memory:2474:15: note: candidate template ignored: could not match 'unique_ptr<type-parameter-0-0, type-parameter-0-1>' against 'std::__1::unique_ptr<TourResult, std::__1::default_delete<TourResult> > *'
  unique_ptr& operator=(unique_ptr<_Up, _Ep>&& __u) _NOEXCEPT {
              ^
In file included from /Users/ivhedtke/CLionProjects/testthor/main.cpp:3:
In file included from /usr/local/Cellar/thors-serializer/1.10.1/include/ThorSerialize/JsonThor.h:14:
In file included from /usr/local/Cellar/thors-serializer/1.10.1/include/ThorSerialize/JsonParser.h:20:
In file included from /usr/local/Cellar/thors-serializer/1.10.1/include/ThorSerialize/Serialize.h:34:
/usr/local/Cellar/thors-serializer/1.10.1/include/ThorSerialize/Traits.h:445:46: error: no type named 'Root' in 'ThorsAnvil::Serialize::Traits<std::__1::unique_ptr<TourResult, std::__1::default_delete<TourResult> > >'
            using Root = typename Traits<T>::Root;
                         ~~~~~~~~~~~~~~~~~~~~^~~~
/usr/local/Cellar/thors-serializer/1.10.1/include/ThorSerialize/Serialize.tpp:251:35: note: in instantiation of function template specialization 'ThorsAnvil::Serialize::PolyMorphicRegistry::getNamedTypeConvertedTo<std::__1::unique_ptr<TourResult, std::__1::default_delete<TourResult> > >' requested here
    object = PolyMorphicRegistry::getNamedTypeConvertedTo<BaseType>(className);
                                  ^
/usr/local/Cellar/thors-serializer/1.10.1/include/ThorSerialize/Serialize.tpp:304:13: note: in instantiation of function template specialization 'ThorsAnvil::Serialize::tryParsePolyMorphicObject<std::__1::unique_ptr<TourResult, std::__1::default_delete<TourResult> > >' requested here
            tryParsePolyMorphicObject(parent, parser, object, 0);
            ^
/usr/local/Cellar/thors-serializer/1.10.1/include/ThorSerialize/Serialize.tpp:412:22: note: in instantiation of member function 'ThorsAnvil::Serialize::DeSerializationForBlock<ThorsAnvil::Serialize::TraitType::Pointer, std::__1::unique_ptr<TourResult, std::__1::default_delete<TourResult> > >::scanObject' requested here
        deserializer.scanObject(object);
                     ^
/usr/local/Cellar/thors-serializer/1.10.1/include/ThorSerialize/Serialize.tpp:396:5: note: in instantiation of member function 'ThorsAnvil::Serialize::DeSerializeMemberValue<Tour, std::__1::unique_ptr<TourResult, std::__1::default_delete<TourResult> >, ThorsAnvil::Serialize::TraitType::Pointer>::init' requested here
    init(parent, parser, key, memberInfo.first, object.*(memberInfo.second));
    ^
/usr/local/Cellar/thors-serializer/1.10.1/include/ThorSerialize/Serialize.tpp:433:12: note: in instantiation of member function 'ThorsAnvil::Serialize::DeSerializeMemberValue<Tour, std::__1::unique_ptr<TourResult, std::__1::default_delete<TourResult> >, ThorsAnvil::Serialize::TraitType::Pointer>::DeSerializeMemberValue' requested here
    return DeSerializeMember<T, M>(parent, parser, key, object, memberInfo);
           ^
/usr/local/Cellar/thors-serializer/1.10.1/include/ThorSerialize/Serialize.tpp:441:51: note: (skipping 3 contexts in backtrace; use -ftemplate-backtrace-limit=0 to see all)
    CheckMembers memberCheck = {static_cast<bool>(make_DeSerializeMember(*this, parser, key, object, std::get<Seq>(member)))...};
                                                  ^
/usr/local/Cellar/thors-serializer/1.10.1/include/ThorSerialize/Serialize.tpp:146:29: note: in instantiation of function template specialization 'ThorsAnvil::Serialize::DeSerializer::scanObjectMembers<Tour, std::__1::basic_string<char> >' requested here
                if (!parent.scanObjectMembers(key, object))
                            ^
/usr/local/Cellar/thors-serializer/1.10.1/include/ThorSerialize/Serialize.tpp:474:15: note: in instantiation of member function 'ThorsAnvil::Serialize::DeSerializationForBlock<ThorsAnvil::Serialize::TraitType::Map, Tour>::scanObject' requested here
        block.scanObject(object);
              ^
/usr/local/Cellar/thors-serializer/1.10.1/include/ThorSerialize/Importer.h:34:30: note: in instantiation of function template specialization 'ThorsAnvil::Serialize::DeSerializer::parse<Tour>' requested here
                deSerializer.parse(data.value);
                             ^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/istream:1440:10: note: in instantiation of member function 'ThorsAnvil::Serialize::operator>>' requested here
    __is >> _VSTD::forward<_Tp>(__x);
         ^
/Users/ivhedtke/CLionProjects/testthor/main.cpp:42:24: note: in instantiation of function template specialization 'std::__1::operator>><char, std::__1::char_traits<char>, ThorsAnvil::Serialize::Importer<ThorsAnvil::Serialize::Json, Tour> >' requested here
    istringstream(str) >> ThorsAnvil::Serialize::jsonImport(t);
                       ^
In file included from /Users/ivhedtke/CLionProjects/testthor/main.cpp:3:
In file included from /usr/local/Cellar/thors-serializer/1.10.1/include/ThorSerialize/JsonThor.h:14:
In file included from /usr/local/Cellar/thors-serializer/1.10.1/include/ThorSerialize/JsonParser.h:20:
In file included from /usr/local/Cellar/thors-serializer/1.10.1/include/ThorSerialize/Serialize.h:34:
/usr/local/Cellar/thors-serializer/1.10.1/include/ThorSerialize/Traits.h:455:20: error: 'int' is not a class
            return dynamic_cast<T*>(dataBase);
                   ^                ~~~~~~~~
2 warnings and 3 errors generated.

So far, as a work around I use plain pointers instead of unique_ptr.

vector of unique_ptr of polymorphic type fails

The following code crashes with version 1.10.2:

#include <iostream>
#include <ThorSerialize/JsonThor.h>
#include <ThorSerialize/SerUtil.h>

using namespace ThorsAnvil::Serialize;
using namespace std;

struct BaseVehicle {
    std::unique_ptr<bool> isPreloaded { nullptr };
    virtual ~BaseVehicle() = default;
    ThorsAnvil_PolyMorphicSerializer(BaseVehicle);
};
ThorsAnvil_MakeTrait(BaseVehicle, isPreloaded);

struct Vehicle : public BaseVehicle {
    std::unique_ptr<int> id { nullptr };
    ~Vehicle() override = default;
    ThorsAnvil_PolyMorphicSerializer(Vehicle);
};
ThorsAnvil_ExpandTrait(BaseVehicle, Vehicle, id);

struct Fleet {
    //! The list of vehicles.
    std::unique_ptr<std::vector<std::unique_ptr<Vehicle>>> vehicles { nullptr };
};
ThorsAnvil_MakeTrait(Fleet, vehicles);

int main()
{
    Fleet t {};
    string str = R"( {"vehicles":[
         {
            "__type": "Vehicle",
            "id":0
         }
      ]})";
    istringstream stream(str);
    stream >> ThorsAnvil::Serialize::jsonImport(t);

    return 0;
}

I get a EXC_BAD_ACCESS in line 280 of Serialize.tpp: https://github.com/Loki-Astari/ThorsSerializer/blob/master/src/Serialize/Serialize.tpp#L280

    object->parsePolyMorphicObject(parent, parser);

Std:array not working on header only version

Describe the bug

A minimal compilable example of that features the bug.

#include <fstream>
#include "ThorSerialize/JsonThor.h"
#include "ThorSerialize/SerUtil.h"

struct TestClass
{
  std::array<uint8_t, 16> testField;
};

ThorsAnvil_MakeTrait(TestClass, testField);

using ThorsAnvil::Serialize::jsonExport;
using ThorsAnvil::Serialize::jsonImport;
int main(int argc, char* argv[])
{
  std::fstream fileStream;
  TestClass entity;
  fileStream >> jsonImport(entity);
  fileStream << jsonExport(entity);
  return 0;
}

A description of how to build and run the code. I use header-only version

g++ -std=c++14 -I/usr/local/include  main.cpp

Expected behavior

compile OK

Environment:

  • OS:

uname -a
Linux gladijos-desktop 5.3.0-51-generic #44~18.04.2-Ubuntu SMP Thu Apr 23 14:27:18 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux

  • Compiler and Version

g++ --version
g++ (Ubuntu 7.5.0-3ubuntu1~18.04) 7.5.0
Copyright (C) 2017 Free Software Foundation, Inc.

Additional context

I got compile-time error

base-path-to-3rd-party-libraries/ThorsSerializer/ThorSerialize/Serialize.tpp: In instantiation of ‘class ThorsAnvil::Serialize::SerializerForBlock<(ThorsAnvil::Serialize::TraitType)0, unsigned char>’:
base-path-to-3rd-party-libraries/ThorsSerializer/ThorSerialize/Serialize.tpp:807:48: required from ‘void ThorsAnvil::Serialize::Serializer::print(const T&) [with T = unsigned char]’
base-path-to-3rd-party-libraries/ThorsSerializer/ThorSerialize/SerUtil.h:105:13: required from ‘void ThorsAnvil::Serialize::PutValueType<V, type>::putValue(const V&) [with V = unsigned char; ThorsAnvil::Serialize::TraitType type = (ThorsAnvil::Serialize::TraitType)0]’
base-path-to-3rd-party-libraries/ThorsSerializer/ThorSerialize/SerUtil.h:190:17: required from ‘void ThorsAnvil::Serialize::ContainerMemberExtractorEmplacer<C, V>::operator()(ThorsAnvil::Serialize::PrinterInterface&, const C&) const [with C = std::array<unsigned char, 16>; V = unsigned char]’
base-path-to-3rd-party-libraries/ThorsSerializer/ThorSerialize/Serialize.tpp:801:11: required from ‘void ThorsAnvil::Serialize::Serializer::printMembers(const T&, Action) [with T = std::array<unsigned char, 16>; Action = ThorsAnvil::Serialize::ContainerMemberExtractorEmplacer<std::array<unsigned char, 16>, unsigned char>]’
base-path-to-3rd-party-libraries/ThorsSerializer/ThorSerialize/Serialize.tpp:839:5: required from ‘void ThorsAnvil::Serialize::Serializer::printObjectMembers(const T&) [with T = std::array<unsigned char, 16>]’
base-path-to-3rd-party-libraries/ThorsSerializer/ThorSerialize/Serialize.tpp:729:13: [ skipping 5 instantiation contexts, use -ftemplate-backtrace-limit=0 to disable ]
base-path-to-3rd-party-libraries/ThorsSerializer/ThorSerialize/Serialize.tpp:795:5: required from ‘void ThorsAnvil::Serialize::Serializer::printMembers(const T&, const std::tuple<_Elements ...>&) [with T = TestClass; Members = {std::pair<const char*, std::array<unsigned char, 16> TestClass::*>}]’
base-path-to-3rd-party-libraries/ThorsSerializer/ThorSerialize/Serialize.tpp:839:5: required from ‘void ThorsAnvil::Serialize::Serializer::printObjectMembers(const T&) [with T = TestClass]’
base-path-to-3rd-party-libraries/ThorsSerializer/ThorSerialize/Serialize.tpp:577:13: required from ‘void ThorsAnvil::Serialize::SerializerForBlock<traitType, T>::printMembers() [with ThorsAnvil::Serialize::TraitType traitType = (ThorsAnvil::Serialize::TraitType)3; T = TestClass]’
base-path-to-3rd-party-libraries/ThorsSerializer/ThorSerialize/Serialize.tpp:808:5: required from ‘void ThorsAnvil::Serialize::Serializer::print(const T&) [with T = TestClass]’
base-path-to-3rd-party-libraries/ThorsSerializer/ThorSerialize/Exporter.h:35:17: required from ‘std::ostream& ThorsAnvil::Serialize::operator<<(std::ostream&, const ThorsAnvil::Serialize::Exporter<ThorsAnvil::Serialize::Json, TestClass>&)’
./main.cpp:22:38: required from here
base-path-to-3rd-party-libraries/ThorsSerializer/ThorSerialize/Serialize.tpp:555:5: error: static assertion failed: Invalid Serialize Trait

CMake support

Could you please add CMake support so I can build it on various platforms like MSVC (Windows Visual Studio)?

Can't build with g++ 6.3.0 on Ubuntu 17.04

Hi, following the build instructions I get the following errors:

alberto@0X4 ~/R/ThorsSerializer> make
Buiding src Start
make -C src build PREFIX=/home/alberto/Repos/ThorsSerializer/build CXXSTDVER=17
make[1]: Entering directory '/home/alberto/Repos/ThorsSerializer/src'
Buiding Serialize Start
make -C Serialize build PREFIX=/home/alberto/Repos/ThorsSerializer/build CXXSTDVER=17
make[2]: Entering directory '/home/alberto/Repos/ThorsSerializer/src/Serialize'
Building Objects for Testing and Coverage
make[3]: Entering directory '/home/alberto/Repos/ThorsSerializer/src/Serialize'
ERROR
g++ -c BinaryTHash.cpp -o coverage/BinaryTHash.o -I/usr/local/include -fPIC -Wall -Wextra -Wstrict-aliasing -pedantic -Werror -Wunreachable-code -Wno-long-long -Wno-deprecated-register -I/home/alberto/Repos/ThorsSerializer/build/include -isystem /home/alberto/Repos/ThorsSerializer/build/include3rd -DCOVERAGE_Serialize -g -fprofile-arcs -ftest-coverage -DCOVERAGE_TEST -Wno-unused-private-field -Wno-unreachable-code -DTHOR_USE_CPLUSPLUS17 -std=c++17
========================================
In file included from test/../SerUtil.h:5:0,
                 from test/BinaryParserTest.h:6,
                 from BinaryTHash.cpp:10:
test/../Serialize.h: In destructor ‘ThorsAnvil::Serialize::DeSerializer::~DeSerializer()’:
test/../Serialize.h:280:108: error: throw will always call terminate() [-Werror=terminate]
         {   throw std::runtime_error("ThorsAnvil::Serialize::DeSerializer::~DeSerializer: Expected Doc End");
                                                                                                            ^
test/../Serialize.h:280:108: note: in C++11 destructors default to noexcept
At global scope:
cc1plus: error: unrecognized command line option ‘-Wno-unused-private-field’ [-Werror]
cc1plus: error: unrecognized command line option ‘-Wno-deprecated-register’ [-Werror]
cc1plus: all warnings being treated as errors
/home/alberto/Repos/ThorsSerializer/build/tools/Makefile:560: recipe for target 'coverage/BinaryTHash.o' failed
make[3]: *** [coverage/BinaryTHash.o] Error 1
make[3]: Leaving directory '/home/alberto/Repos/ThorsSerializer/src/Serialize'
/home/alberto/Repos/ThorsSerializer/build/tools/Makefile:343: recipe for target 'run_test' failed
make[2]: *** [run_test] Error 2
make[2]: Leaving directory '/home/alberto/Repos/ThorsSerializer/src/Serialize'
/home/alberto/Repos/ThorsSerializer/build/tools/Project.Makefile:33: recipe for target 'Serialize.dir' failed
make[1]: *** [Serialize.dir] Error 2
make[1]: Leaving directory '/home/alberto/Repos/ThorsSerializer/src'
/home/alberto/Repos/ThorsSerializer/build/tools/Project.Makefile:33: recipe for target 'src.dir' failed
make: *** [src.dir] Error 2

AFAIK all dependencies are solved and ./configure --disable-binary shows no errors.

MakeSimple failed

I had MakeSimple run on my OSX and got this

c++ -c Serialize/JsonSerializer.cpp -o Serialize/JsonSerializer.o -I.  -Ibuild/include -Ibuild/include3rd -Wno-c++11-extensions
In file included from Serialize/JsonSerializer.cpp:1:
Serialize/JsonSerializer.h:632:16: error: calling a private constructor of class
      'std::__1::unique_ptr<ThorsAnvil::Json::SaxAction,
      std::__1::default_delete<ThorsAnvil::Json::SaxAction> >'
        return action;
               ^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/memory:2464:5: note: 
      declared private here
    unique_ptr(unique_ptr&);
    ^
1 error generated.
make: *** [Serialize/JsonSerializer.o] Error 1

It's said that we can't return action because of its private copy constructor inside Xcode lib.

Different OpenAPI Discriminator

Is your feature request related to a problem? Please describe.
I am re-implementing an external API, they use $type instead of __type as the discriminator for polymorphic types.

Describe the solution you'd like
Make it possible to change the discriminator.

Describe alternatives you've considered
Maybe in a Header-only version of the lib would be enough if it requires too many changes otherwise.

Thank you.

Support use of shared_ptr (for polymorphic types)

Is your feature request related to a problem? Please describe.
Currently when using polymorphic types, only unique_ptr's work. The documentation on https://lokiastari.com/ThorsSerializer/#Pointers also states that they are not supported. I think currently they already work, just not in combination with polymoprhic types.

Sometimes they are convenient though.

Describe the solution you'd like
Support shared_ptr's, like unique_ptr.

Describe alternatives you've considered
Not support them?:) Support seems already (partly) there in the code? So I'm not sure if they are intentionally left out, or just never really needed so far?

Additional context
By adding the two missing template specializations for shared_ptr in Traits.h, line 488 and in Serialize.tpp line 281 it seems to work. (Using the header only branch)

How can I build static library ?

I see an option --enable-static in .configure. I want to build static library for ThorsSerializer. I've set the flag, but nothing happen. It still build dynamic library for me.

Does ThorsSerializer support making static library?

Derived class without new members

I implement the webservice for a given API and I am forced to have a derived class with no new members in it (the external API wants that). But ThorsAnvil_ExpandTrait expects to give a list of members.

So this code

struct Derived : public Base {
    ~Derived() override = default;
    ThorsAnvil_PolyMorphicSerializer(Derived);
};

ThorsAnvil_ExpandTrait(Base, Derived);

does not compile:

error: expected unqualified-id
ThorsAnvil_ExpandTrait(Base, Derived);
^
/usr/local/include/ThorSerialize/Traits.h:277:5: note: expanded from macro 'ThorsAnvil_ExpandTrait'
    ThorsAnvil_MakeTrait_Base(ThorsAnvil_Parent(0, ParentType, DataType, __VA_ARGS__, 1), Parent, 0, DataType, __VA_ARGS__, 1); \

Member limit

There appears to be a limit of 20 members on trait definitions.
Is there any way to increase this number?

Cannot open serializeConfig.h

Hey,
I included the library in my code, and when I try to build I get the following error:
"Cannot open include files:'SerializeConfig.h':No such file or directory.'
When I search the folder I find this file, only it ends with h.in .
What am I doing wrong?
I'm running on Windows, VS2012.

Thanks.

Deserializing to existing object with vectors/pointers?

This is more of a question than a bug. Hopefully it makes sense.

If I have a pre-existing object instance which includes a nested tree of vectors and pointers (see my previous issue), can I deserialize to this existing object when some of the vector sizes and pointer locations must change because the serialized data is different than the existing object?

For example, the existing object before deserialization has a member vector of size 2, but the incoming deserialization requires this vector to grow to size 4. In my preliminary tests, this isn’t working, and the existing vector stays at size 2. Others values (ints) are updating correctly.

EDIT: OK, now I'm not even sure how to deserialize to an object if it is new. I don't see any examples for deserialization of objects in the docs.

Using the code from my previous example:

class level8_cont
{
public:
	std::array<int, 3> array9 = { 1, 2, 3 };
};
class level7
{
public:
	level7()
	{
		levels8.emplace_back();
	}
	std::vector<level8_cont> levels8;
};
class level6_cont
{
public:
	level6_cont()
	{
		nextLevel7 = new level7();
	}
	level7 *nextLevel7;
};
class level5
{
public:
	level5()
	{
		levels6.emplace_back();
	}
	std::vector<level6_cont> levels6;
};
class level4_cont
{
public:
	level4_cont()
	{
		nextLevel5 = new level5();
	}
	level5 *nextLevel5;
};
class level3
{
public:
	level3()
	{
		levels4.emplace_back();
	}
	std::vector<level4_cont> levels4;
};
class level2_cont
{
public:
	level2_cont()
	{
		nextLevel3 = new level3();
	}
	level3 *nextLevel3;
};
class level1
{
public:
	level1()
	{
		levels2.emplace_back();
	}

	std::vector<level2_cont> levels2;
};

ThorsAnvil_MakeTrait(level1, levels2);
ThorsAnvil_MakeTrait(level2_cont, nextLevel3);
ThorsAnvil_MakeTrait(level3, levels4);
ThorsAnvil_MakeTrait(level4_cont, nextLevel5);
ThorsAnvil_MakeTrait(level5, levels6);
ThorsAnvil_MakeTrait(level6_cont, nextLevel7);
ThorsAnvil_MakeTrait(level7, levels8);
ThorsAnvil_MakeTrait(level8_cont, array9);

using ThorsAnvil::Serialize::jsonExport;
using ThorsAnvil::Serialize::jsonImport;

// Use the export function to serialize
level1* levelTest;
levelTest = new level1();
std::cout << jsonExport(*levelTest) << "\n";

Assuming the incoming deserialized object does not have the same vector sizes as the existing object, should the deserialize for this object look like this? (Also assume the destructors of the classes existed to delete the objects pointed to by member pointers)

delete levelTest;
inputStream >> jsonImport(*levelTest);

Also, I want say a huge Thank You! for this library, it has been exactly what I needed.

C++ Array Support to ThorsAnvil_MakeTrait class

#include <iostream>

#include <sstream>

#include <vector>
 //Including Thor Serialize Library
#include "ThorSerialize/Traits.h"

#include "ThorSerialize/JsonThor.h"

#include "ThorSerialize\SerUtil.h"

struct Shirt {
  public: int red;
  int green;
  int blue;
};
class TeamMember {

  public:
    std::string name = "Empty";
  int score = 0;
  int damage = 0;
  Shirt team[3]; 
  TeamMember() {};
  // Define the trait as a friend to get accesses to private
  // Members.
  //friend class ThorsAnvil::Serialize::Traits<TeamMember>;
};

// Declare the traits.
// Specifying what members need to be serialized.

ThorsAnvil_MakeTrait(Shirt, red, green, blue);
ThorsAnvil_MakeTrait(TeamMember, name, score, damage, team);

int main() {
  using ThorsAnvil::Serialize::jsonExport;

  TeamMember john; // setting Default value 0 for all class members
  std::cout << "-----------------Before---------------" << "\n";
  std::cout << jsonExport(john) << "\n"; //Printing all the member data
  std::stringstream input(R "({" name ": "John ","score ": 100,"team ":{"red ": 1,"green ": 2,"blue ": 3}})");//json string
  input >> jsonImport(john); //Assigning JSON data to class members 
  std::cout << "-----------------After----------------" << "\n";
  std::cout << jsonExport(john) << "\n"; //Printing all the member data after assigning JSON data
  std::cout << "--------------------------------------" << "\n";
}

Does library support c style array inside of the class to serialize the data?

Library throws error shown in error.txt file
error.txt

Unit test fail during make

Hi,
I'm trying to build the ThorLibrary on a cluster (ie User Space, no root access).

When I run make, a unit test creates an error and stops the process. How can I process in that case?

This is how I ran configure:
/configure --disable-binary --disable-vera --disable-yaml --prefix=$HOME/Thor/

Here is the log (for some reason the formatting is off):

\033[1;30mg++ -o coverage/unittest.app -DCOVERAGE_Serialize \033[0m \033[0;31mERROR\033[0m
g++ -o coverage/unittest.app -L/afs/crc.nd.edu/x86_64_linux/t/tcltk/8.6.4/gcc/4.8.5/lib coverage/SerSetTest.o coverage/YamlPrinterTest.o coverage/IgnoreUneededData.o coverage/SerVectorTest.o coverage/UnicodeIteratorTest.o coverage/SerDequeTest.o coverage/SerializeTest.o coverage/SerUnorderedSetTest.o coverage/SerMultiMapTest.o coverage/SerUnorderedMultiSetTest.o coverage/SerTuppleTest.o coverage/SerUnorderedMultiMap.o coverage/BinaryPrinterTest.o coverage/SerMultiSetTest.o coverage/THashTest.o coverage/JsonPrinterTest.o coverage/TemplateTypeTest.o coverage/SerMapTest.o coverage/YamlParserTest.o coverage/SerMemoryTest.o coverage/SerInitializerList.o coverage/RoundTripTest.o coverage/StaticMemberTest.o coverage/SerUnorderedMapTest.o coverage/SerListTest.o coverage/BinaryParserTest.o coverage/ParserInterfaceTest.o coverage/SerializeEnum.o coverage/JsonParserTest.o coverage/JsonLexerTest.o coverage/SerArrayTest.o coverage/unittest.o -L../coverage -L/afs/crc.nd.edu/user/m/mimre/workspace/ThorsSerializer/build/lib -lobject -lgtest -fprofile-arcs -ftest-coverage -lpthread -L/afs/crc.nd.edu/user/m/mimre/workspace/ThorsSerializer/build/lib

coverage/SerSetTest.o: In function ThorsAnvil::Serialize::operator>>(std::istream&, ThorsAnvil::Serialize::Importer<ThorsAnvil::Serialize::Json, std::set<int, std::less<int>, std::allocator<int> > > const&)': /afs/crc.nd.edu/user/m/mimre/workspace/ThorsSerializer/src/Serialize/test/../Importer.h:25: undefined reference to ThorsAnvil::Serialize::JsonParser::JsonParser(std::istream&)'
coverage/SerVectorTest.o: In function ThorsAnvil::Serialize::operator>>(std::istream&, ThorsAnvil::Serialize::Importer<ThorsAnvil::Serialize::Json, std::vector<int, std::allocator<int> > > const&)': /afs/crc.nd.edu/user/m/mimre/workspace/ThorsSerializer/src/Serialize/test/../Importer.h:25: undefined reference to ThorsAnvil::Serialize::JsonParser::JsonParser(std::istream&)'
coverage/SerDequeTest.o: In function ThorsAnvil::Serialize::operator>>(std::istream&, ThorsAnvil::Serialize::Importer<ThorsAnvil::Serialize::Json, std::deque<int, std::allocator<int> > > const&)': /afs/crc.nd.edu/user/m/mimre/workspace/ThorsSerializer/src/Serialize/test/../Importer.h:25: undefined reference to ThorsAnvil::Serialize::JsonParser::JsonParser(std::istream&)'
coverage/SerializeTest.o: In function SerializeTest_DeSerializeStructureOfValue_Test::TestBody()': /afs/crc.nd.edu/user/m/mimre/workspace/ThorsSerializer/src/Serialize/test/SerializeTest.cpp:37: undefined reference to ThorsAnvil::Serialize::JsonParser::JsonParser(std::istream&)'
coverage/SerializeTest.o: In function SerializeTest_DeSerializeStructureOfValueAndParent_Test::TestBody()': /afs/crc.nd.edu/user/m/mimre/workspace/ThorsSerializer/src/Serialize/test/SerializeTest.cpp:68: undefined reference to ThorsAnvil::Serialize::JsonParser::JsonParser(std::istream&)'
coverage/SerializeTest.o:/afs/crc.nd.edu/user/m/mimre/workspace/ThorsSerializer/src/Serialize/test/SerializeTest.cpp:101: more undefined references to ThorsAnvil::Serialize::JsonParser::JsonParser(std::istream&)' follow collect2: error: ld returned 1 exit status make[3]: *** [coverage/unittest.app] Error 1 rm coverage/unittest.o make[3]: Leaving directory /afs/crc.nd.edu/user/m/mimre/workspace/ThorsSerializer/src/Serialize/test'
make[2]: *** [run_test] Error 2
make[2]: Leaving directory /afs/crc.nd.edu/user/m/mimre/workspace/ThorsSerializer/src/Serialize' make[1]: *** [Serialize.dir] Error 2 make[1]: Leaving directory /afs/crc.nd.edu/user/m/mimre/workspace/ThorsSerializer/src'
make: *** [src.dir] Error 2

Support for single quotes

Single quotes are not allowed by JSON spec but are supported by other parsers.

I am not a flex expert, but this patch should work (sorry for non pull-request):

diff --git a/Json/Lexer.l b/Json/Lexer.l
index a6fdfd1..216408f 100644
--- a/Json/Lexer.l
+++ b/Json/Lexer.l
@@ -22,7 +22,9 @@ NUMBER -?{FLOAT}{EXP}?
UNICODE \\u[A-Fa-f0-9]{4}
ESCAPECHAR \\["\\/bfnrt]
CHAR [^"\\]|{ESCAPECHAR}|{UNICODE}
-STRING \"{CHAR}*\"
+SQESCAPECHAR \\['\\/bfnrt]
+SQCHAR [^'\\]|{SQESCAPECHAR}|{UNICODE}
+STRING \"{CHAR}*\"|'{SQCHAR}*'
WHITESPACE [ \t\n]

No compile enum with 8 and more element

#include "../../external/ThorsSerializer/ThorSerialize/Traits.h"

enum TypeToken {
    KEYWORD, NAME, STRING,
    NUMBER, BEGIN_LINE, BEGIN_BLOCK, OPERATOR,
    ENDMARKER
};


ThorsAnvil_MakeEnum(TypeToken, KEYWORD, NAME, STRING,
                    NUMBER, BEGIN_LINE, BEGIN_BLOCK, OPERATOR, ENDMARKER);

int main() {
    return 0;
}

g++ --std=c++17 main.cpp

main.cpp:92:1: error: invalid digit '8' in octal constant
ThorsAnvil_MakeEnum(TypeToken, KEYWORD, NAME, STRING,
^
./../../external/ThorsSerializer/ThorSerialize/Traits.h:304:20: note: expanded from macro 'ThorsAnvil_MakeEnum'
            return NUM_ARGS(__VA_ARGS__, 1);                            \
                   ^
./../../external/ThorsSerializer/ThorSerialize/Traits.h:34:199: note: expanded from macro 'NUM_ARGS'
  ...40, 39, 38, 37, 36, 35, 34, 33, 32, 31, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 09, 08, 07, 06, 05, 04, 03, 02, 01, 00, Ignore)
                                                                                                                                      ^
1 error generated.

Environment:

  • OS: Mac OS 10.15.4

uname -a
Darwin RD.local 19.4.0 Darwin Kernel Version 19.4.0: Wed Mar 4 22:28:40 PST 2020; root:xnu-6153.101.6~15/RELEASE_X86_64 x86_64

  • Compiler and Version

g++ --version
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/4.2.1
Apple clang version 11.0.0 (clang-1100.0.33.17)
Target: x86_64-apple-darwin19.4.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin

Multiple Inheritance support

Hello. I was wondering if multiple inheritance is somehow supported. I have been using ThorsAnvil_ExpandTrait so far, but it only allows to specify one parent class, and it cannot be called twice for the same child class. If is not supported, any ideas on a workaround are really appreciated. Thanks.

Problem with Serialize Import of a string

Hello I'm having some issues to map a JSON file to a c++ object.
I've simplifed the code I'm using to only show you the part of the object that has an issue being mapped to c++.

#include "ThorSerialize/Serialize.h"
#include "ThorSerialize/Serialize.tpp"
#include "ThorSerialize/Traits.h"
#include "ThorSerialize/JsonThor.h"
#include <string>
#include <sstream>
#include <iostream>
#include <vector>

using namespace std;

class ValhallaLeg {
	friend class ThorsAnvil::Serialize::Traits<ValhallaLeg>;
	private:
		string shape;
	public:
		ValhallaLeg(){};
		~ValhallaLeg(){};
};

ThorsAnvil_MakeTrait(ValhallaLeg, shape);


int main()
{
	using ThorsAnvil::Serialize::jsonExport;
	using ThorsAnvil::Serialize::PrinterInterface;
	ValhallaLeg* result = nullptr;
	cin >> ThorsAnvil::Serialize::jsonImport(result);
	cout << ThorsAnvil::Serialize::jsonExport(result) << endl;

	return EXIT_SUCCESS;
}

Here is the json that I'm inputing in the console (and in my real code for the shape part of the json):
{"shape": "offavAdqtekCsAcFhb@yW|SiMhH{AjLzAfb@lJld@jK~g@jLhScbCvRy~BxRu`C~Hk_A~Hi`AxRg_C~Rw`ChRi~Bh\\i|DpCo]|h@jBxRjAtYjApRvCrcBn]pBMlEz@tYrFdd@zK`h@pRbe@pRpf@b[re@~]dd@~]de@l_@ng@rd@zo@lj@vg@`f@hRtPnS`Rjf@fc@fh@dd@|h@be@ba@n^~a@j_@lcA~|@lo@xk@~g@td@fSkrBlZ|^vb@ng@vjBzsB`]rZ`b@xWveBdy@faAre@lvBvaArdAfb@fdDziAxQdFh`AhVts@bRpRrEtn@dPvDya@fD{_@bUrFbWbG`Gag@dF{Ath@bQti@bPf^nIbp@lJ|D^vNeFdK]lE?lYzApGxBxRvN`HhB`v@zAdELlZjA`q@nJ~g@fCz_AfDhu@|@bViMtP{AnS\\vX`Rf|@uDxdByLz~@iW~r@oThC]tEl@~BjA~C?~XaHnIeEvIsFpGiCvDN|Yfm@lOxVrPxCtZ_@p[{Jj\\mKfDkAf]kL~HwCp\\wMze@yMtd@sPpLeEhl@cR~w@iVrZmJ|O}@`XiBlOL~HrGt_@~H|OtEfItD~CxBlOlKbcBpyAvr@dn@dPvNn{@ls@vx@`r@zt@bo@fb@p]pa@p\\ze@ha@fgAl~@hW|S`xCpdCdo@|h@fh@vb@jKnIld@~]`g@|^ld@hXbe@hW|d@zUdi@~Sj`@fM`Cl@zA^vMdD|i@hN|}@jUfCl@jLvCtJxBgD`I~Cz@rQtEvw@pR~zAn]rtA`]vHvCrAdEvCdE|EvDhHbFlc@p\\hMrG`RdOxRrP~C|@dFhCvCdEfCxBlAzAdE|S~CdEtExCzU~HpQfN|UfNlE|@dE}@rK}IzFkAnDlIpBhCrPfOfIlIzFdFpBfD|@fD`BxBz[|SrQfEtDhBtOdOvDlAvRbFtK|JrFtDtTnI|N|J`CjArKbGzL`HfMfCjGhC~NtObK|IxHdFdT`HdELdJyAnDLfItEdErFNNhHfNfDvCnCxBlKtEzJjAlEjAfEvDpLdPro@vb@tOrPfN~HlFzAdEO~CkAvIiMxGyBzK`Iz@hBNhB_EjWNtDjAhCnYdObFdEbAxBNxBe@`IOtD^dEr@xBdAlAvCj@dE?|E]pByBnCcFjByBbFkBvIMjFxAzj@nT|hApf@pQhMnTjKtx@de@zEz@|JzAlEhBzZvXvTzLnRpQlPpHrFm@lJsFtEjAtEtEr@lT`IpRzJnIlOhM|d@lTfYj`@zPjUzPpHtYzV|OvMxa@fXxL]rKkA|ExBfDfDpG~HnIpGhRnIjPtE`IdEtc@hM~HhCxpAz`@jPzJh]b[dEzAjVkAtTzAfc@tEfh@rFtc@fN|JkAhGiCxC|@hBpG|EdEjFdEhHNfDkB|DlAfDz@pBdEzFvDbGm@zA\\|NvDvNpGrFdEdUpHdYbGhNxAhVfDfJ]xGl@bFvClEdF~DxArE^|O?lJxAbGhCtJvD~CvCxBrFp{@fvAjAjA~DlAvCtDzcA~|@jV~SxBsG`MzKdPfNbFdFrBzAjAz@~CvCdJ~InYvXri@pf@~CvC~c@l_@jV~SjKjKz@l@tJ~Ij[b[zAzAhWdYlJfNtJtOhW~]FN~HlJzPtOrAjAfYzV~XjU~MxL~w@pq@nChCbVlTlU|Td@{Ad@kAf^ecA~R{j@zFaGzFgO|@|@nCcG`HuYbAsGt@eEvDuNrAoJj@aHpC}StD{Ll@wCrGsZbAgDl@kBxW}qA~CeZnIqg@xB{J|h@zUj`@dP`{Atn@|IdEvb@~R`MrFdAl@\\NbnAzt@ld@rPlEjAzA^|^lJpb@zJtNfEtUdEvHl@bu@?dE?jBOfh@iC|bAoRfNgEn^sPzy@oItE^xBpGhB_JjAyArA?xRj@|DNhC|@zAjAth@zApk@xBlELnD{@dFkB~CgDd@{KT_It@wCbBkBbA]z@?jBNvCxB`CxBN\\DzAFdENzA\\z@bA^|@?pf@`Hhg@lItrA|TrAjBl@tEtDzi@FvDbAhl@t@fl@|@vc@tJl@`BiCF{U\\wCzA}@jLzAry@nHjFdFhRdd@l@zAdE`GhCxBjLjW~Wro@bBnIhB~Hf^`{@zAlJLl@jAdFvIjUnNb\\n^n{@`\\pq@|D~SNl@Nl@~BhLNjAt@hCdi@pfArAxAl@^`BLrBM~RgD|@\\j@jA|@fD|EbQjZvl@t@zAnIrQ~HfXpBrFpCrFl@hC~ChL`C~I`BtD|@lAz@LdAm@z@kA\\{@NkAm@wDm@gD]iB?{AT}@jQmTfIxBvIbQ`ChBdExBfDvDrKpRpWpf@zKnSp{@|hAlZdY~\\hl@lO~Rx`AroAMbGWzK\\rEb\\fc@`Cl@fCOdKiBhCOpBl@zAzAlN`SfJdOts@l~@v]dc@jAlAfN~HbGhBhBxBbLbQ|D~HzAfElJbFhH|IdP|UpRlTxGpG`RbRpGpQfh@bf@vm@xk@hq@tn@ld@ha@vSrP|DjBfIz@z@N`DhBvChC`MhM|EdErt@pq@`BhBvNdPfNtO|EdEdEhBpBtEfEzKzZfn@pLlT~N`]n]x_AfY|}@jAlK]hWfChLtE~InNxV`X`g@lJ|^bGxb@vMpeAzKx`A|Jpp@pW~r@dYj_ApHpQ~Wxa@{JfNePlUt@jAbAzArFdOxR|^pk@vaAtJ~S~Nb[r_@rdAzQ|i@n]tlA`g@bzArUvv@lJro@xHzVxa@j~AtNnr@rB|Sb[txA`Mzi@jUfmAjLlh@~M~^hMpf@rFrZdKtZzKb[tItc@nJ~]xQ|i@bL~SjFtNnD~S~C|JpBjKlElJxGpHfDtOpMdO~HtOlUzu@tOre@tOha@dZls@|Xxk@p_BrlClUhXvNvWvl@`fAfTl_@v\\l_@bLlJxeAl~@n|@vaA|i@n|@dZnr@jj@f`Bvw@`nCpg@`oB|]dxA~]tlAp]ngArd@pzAfh@lfB`Ihl@lJ`SnRzt@t@zAxBj@jBkAl@]lTuO]cG_@wC^m@j@]t@l@NhBr@vDbLz_@jQbf@li@dmAzVnr@jd@fbAnTha@vzA`bDzKtZ~Shk@bQhl@fDvNrFbPd@fEGfCe@hC?jA\\xB|@jAxBjAjAlAbAhBtEtOdFzVfCbPfIzVzGzUpp@xiBvHfN|EdOvCdF|EvCt@|@xAxAbGhMpCxC|ItDnDrFnDlJnSli@vCbQpBzVtJ|SlEjLdKfYfNdn@xLjVbFvNnIxVfTpq@z@rFdA`HyM{AqLNyGhBe@NcL`H}EpGOhBe@fEMxBGxBl@rEjFxWbBvNrAhMfHhl@rF|h@NfDbAlTt@jBtErE|DtEbB`HFxBxAvN|@dEhCdFpBbFTzAEhBu@jBeFbF{@jB]hByBxL?rGxBrZsA~zAhGflAFfDl@zK?|J{F`g@u@fD{AtDs@hCkBzUoChv@qC`HsE|UGtD}@fN{Ux`Ae@dE\\~IMrFyCpQuIdo@uEz_@yBnSyBxBGdPqCjL]nIbBnH]`g@r@`HjArPeErGjAjKs@jAsKpR{A]u@}@eK}IwC?_DbF_DdFsAjAqBOeE]iC?cAjAe@bFeFd[FxB?xBWtDoH~S]vCDxBNfD|@bGd@fCfCfOdAlJ}@bFU|@gD`HwD|JUbQbAnS`CvWTfDs@vD_DfCmAfD?dFxC~RtEbQTjB`C`R~CvXbAjAl@OjBm@jFgN`B{@jB\\zKhMjArFjAvMu@nr@M`SWdP?fCFhCjBbF\\nILjLs@fN?xV?p{@kAlJ}PtnAyLvb@gNbe@yWn}@wCjKaRpq@WrEVpHFvC_@hCeD`HwNvl@aHhb@W~SlFpz@G~IeK|s@qGn|@}@n]cAhM?rF`CrQyBn]OrPpBpRE|JaMha@wXz_AmPnq@uErQyBdEs@xBe@`Hm@jLdEb[hGre@d@n]sFn{AeJngA}Jl_@mJtN}^d[oN`GgYxk@eEbf@wC`]cBdmAyBdP_DhLkPlUiChMGzJl@vaAm@hXyLbF}DtOsFrQwDbGyRrZuN~RcQnT}EpG}I~Su@xBqC~HeEdO_D~]cA`|@?dEm@tZG`\\aBxrCcf@`HeZ{@hH||Ad@`RjAx`@|Eb{@bFrdAjFrmArGboAhB~h@d@li@gC~fAkBfkA{@to@eAro@UnHwClsA{BnpAs@n^m@n]{Afm@{Ah`AUlKaCjsAUtEe@vX{AlhAWpHUlJaCx_AsA~g@OpHqBlhA?bGkAbo@O`HqBpeAG`Hm@vb@?fc@FdEbB~{ANnIr@~q@V|ThBp{@VtEr@bp@|@rz@bAlgAbAhv@rAb{@vDb`Dhl@iLti@mKDnh@wCdP{e@~zAaBjVz@dn@rLn{AhBtO?`IiBzKql@|pBwHfOeK|Iom@vNmOvCkGfDeDfDsa@zj@ur@zhA{Vre@gb@l~@qMlToIrQwg@|qAkLja@oH`\\sAxL}@xMu@jLsApQsAzKaB|JyLnh@q]zrA_Ide@qHxk@e@vCs@lKG`G?vDz@~H`HfXt@dFNtEGdEm@zKsAhLmOnqAkAnTm@|IqB`g@OvNTrPt@ju@O|^yAry@LjLl@lJbB|JnC|IdKlUjFvNvCbPxC|^xAxMrB~HlExLnIlU~BxLzA|JjArFvYnqArEfN`HjLdFfC|NNjVwC~Hl@fJz@jVpGnRhMhMfNxLjWhHrZlJvb@nN`g@{uCbz@oIqGwS|JiR~HcALkVlAkLz@{A\\~CfE|@dEbAdExWhjA~CdPzAbGlEnSb[`zArUngAtcAjcFpRfbAfm@v~CbFfXjQhaA~Nvw@fNvv@rKxl@u@rExG~]gDyBl@vD`N`{@rPrdAbBwNlEhX`p@vrD`XbyAxWpzAd@fC`k@x}CbR~fAtOj_AkBzU|J~HfuBnyLrz@r_Fbo@tsDrFb\\wHnHTzAxHvb@fIre@{t@hW}~@xWrGjj@ms@pSiCxB?rFhCjUx`@pxCapAz`@ck@tOwl@pQwI{_@ye@dOi{Avc@i\\hL"}

I get an error that says

what(): ThorsAnvil::Serialize::UnicodeWrapperIterator::checkBuffer: input character can not be smaller than 0x20

I've tried removing some part of the string and inputing this smaller chunk of my shape in the console :
{"shape": "offavAdqtekCsAcFhb@yW|SiMhH{AjLzAfb@lJld@jK~g@jLhScbCvRy~BxRu`C~Hk_A~Hi`AxRg_C~Rw`ChRi~Bh\\i|DpCo]|h@jBxRjAtYjApRvCrcBn]pBMlEz@tYrFdd@zK`h@pRbe@pRpf@b[re@~]dd@~]de@l_@ng@rd@zo@lj@vg@`f@hRtPnS`Rjf@fc@fh@dd@|h@be@ba@n^~a@j_@lcA~|@lo@xk@~g@td@fSkrBlZ|^vb@ng@vjBzsB`]rZ`b@xWveBdy@faAre@lvBvaArdAfb@fdDziAxQdFh`AhVts@bRpRrEtn@dPvDya@fD{_@bUrFbWbG`Gag@dF{Ath@bQti@bPf^nIbp@lJ|D^vNeFdK]lE?lYzApGxBxRvN`HhB`v@zAdELlZjA`q@nJ~g@fCz_AfDhu@|@bViMtP{AnS\\vX`Rf|@uDxdByLz~@iW~r@oThC]tEl@~BjA~C?~XaHnIeEvIsFpGiCvDN|Yfm@lOxVrPxCtZ_@p[{Jj\\mKfDkAf]kL~HwCp\\wMze@yMtd@sPpLeEhl@cR~w@iVrZmJ|O}@`XiBlOL~HrGt_@~H|OtEfItD~CxBlOlKbcBpyAvr@dn@dPvNn{@ls@vx@`r@zt@bo@fb@p]pa@p\\ze@ha@fgAl~@hW|S`xCpdCdo@|h@fh@vb@jKnIld@~]`g@|^ld@hXbe@hW|d@zUdi@~Sj`@fM`Cl@zA^vMdD|i@hN|}@jUfCl@jLvCtJxBgD`I~Cz@rQtEvw@pR~zAn]rtA`]vHvCrAdEvCdE|EvDhHbFlc@p\\hMrG`RdOxRrP~C|@dFhCvCdEfCxBlAzAdE|S~CdEtExCzU~HpQfN|UfNlE|@dE}@rK}IzFkAnDlIpBhCrPfOfIlIzFdFpBfD|@fD`BxBz[|SrQfEtDhBtOdOvDlAvRbFtK|JrFtDtTnI|N|J`CjArKbGzL`HfMfCjGhC~NtObK|IxHdFdT`HdELdJyAnDLfItEdErFNNhHfNfDvCnCxBlKtEzJjAlEjAfEvDpLdPro@vb@tOrPfN~HlFzAdEO~CkAvIiMxGyBzK`Iz@hBNhB_EjWNtDjAhCnYdObFdEbAxBNxBe@`IOtD^dEr@xBdAlAvCj@dE?|E]pByBnCcFjByBbFkBvIMjFxAzj@nT|hApf@pQhMnTjKtx@de@zEz@|JzAlEhBzZvXvTzLnRpQlPpHrFm@lJsFtEjAtEtEr@lT`IpRzJnIlOhM|d@lTfYj`@zPjUzPpHtYzV|OvMxa@fXxL]rKkA|ExBfDfDpG~HnIpGhRnIjPtE`IdEtc@hM~HhCxpAz`@jPzJh]b[dEzAjVkAtTzAfc@tEfh@rFtc@fN|JkAhGiCxC|@hBpG|EdEjFdEhHNfDkB|DlAfDz@pBdEzFvDbGm@zA\\|NvDvNpGrFdEdUpHdYbGhNxAhVfDfJ]xGl@bFvClEdF~DxArE^|O?lJxAbGhCtJvD~CvCxBrFp{@fvAjAjA~DlAvCtDzcA~|@jV~SxBsG`MzKdPfNbFdFrBzAjAz@~CvCdJ~InYvXri@pf@~CvC~c@l_@jV~SjKjKz@l@tJ~Ij[b[zAzAhWdYlJfNtJtOhW~]FN~HlJzPtOrAjAfYzV~XjU~MxL~w@pq@nChCbVlTlU|Td@{Ad@kAf^ecA~R{j@zFaGzFgO|@|@nCcG`HuYbAsGt@eEvDuNrAoJj@aHpC}StD{Ll@wCrGsZbAgDl@kBxW}qA~CeZnIqg@xB{J|h@zUj`@dP`{Atn@|IdEvb@~R`MrFdAl@\\NbnAzt@ld@rPlEjAzA^|^lJpb@zJtNfEtUdEvHl@bu@?dE?jBOfh@iC|bAoRfNgEn^sPzy@oItE^xBpGhB_JjAyArA?xRj@|DNhC|@zAjAth@zApk@xBlELnD{@dFkB~CgDd@{KT_It@wCbBkBbA]z@?jBNvCxB`CxBN\\DzAFdENzA\\z@bA^|@?pf@`Hhg@lItrA|TrAjBl@tEtDzi@FvDbAhl@t@fl@|@vc@tJl@`BiCF{U\\wCzA}@jLzAry@nHjFdFhRdd@l@zAdE`GhCxBjLjW~Wro@bBnIhB~Hf^`{@zAlJLl@jAdFvIjUnNb\\n^n{@`\\pq@|D~SNl@Nl@~BhLNjAt@hCdi@pfArAxAl@^`BLrBM~RgD|@\\j@jA|@fD|EbQjZvl@t@zAnIrQ~HfXpBrFpCrFl@hC~ChL`C~I`BtD|@lAz@LdAm@z@kA\\{@NkAm@wDm@gD]iB?{AT}@jQmTfIxBvIbQ`ChBdExBfDvDrKpRpWpf@zKnSp{@|hAlZdY~\\hl@lO~Rx`AroAMbGWzK\\rEb\\fc@`Cl@fCOdKiBhCOpBl@zAzAlN`SfJdOts@l~@v]dc@jAlAfN~HbGhBhBxBbLbQ|D~HzAfElJbFhH|IdP|UpRlTxGpG`RbRpGpQfh@bf@vm@xk@hq@tn@ld@ha@vSrP|DjBfIz@z@N`DhBvChC`MhM|EdErt@pq@`BhBvNdPfNtO|EdEdEhBpBtEfEzKzZfn@pLlT~N`]n]x_AfY|}@jAlK]hWfChLtE~InNxV`X`g@lJ|^bGxb@vMpeAzKx`A|Jpp@pW~r@dYj_ApHpQ~Wxa@{JfNePlUt@jAbAzArFdOxR|^pk@vaAtJ~S~Nb[r_@rdAzQ|i@n]tlA`g@bzArUvv@lJro@xHzVxa@j~AtNnr@rB|Sb[txA`Mzi@jUfmAjLlh@~M~^hMpf@rFrZdKtZzKb[tItc@nJ~]xQ|i@bL~SjFtNnD~S~C|JpBjKlElJxGpHfDtOpMdO~HtOlUzu@tOre@tOha@dZls@|Xxk@p_BrlClUhXvNvWvl@`fAfTl_@v\\l_@bLlJxeAl~@n|@vaA|i@n|@dZnr@jj@f`Bvw@`nCpg@`oB|]dxA~]tlAp]ngArd@pzAfh@lfB`Ihl@lJ`SnRzt@t@zAxBj@jBkAl@]lTuO]cG_@wC^m@j@]t@l@NhBr@vDbLz_@jQbf@li@dmAzVnr@jd@fbAnTha@vzA`bDzKtZ~Shk@bQhl@fDvNrFbPd@fEGfCe@hC?jA\\xB|@jAxBjAjAlAbAhBtEtOdFzVfCbPfIzVzGzUpp@xiBvHfN|EdOvCdF|EvCt@|@xAxAbGhMpCxC|ItDnDrFnDlJnSli@vCbQpBzVtJ|SlEjLdKfYfNdn@xLjVbFvNnIxVfTpq@z@rFdA`HyM{AqLNyGhBe@NcL`H}EpGOhBe@fEMxBGxBl@rEjFxWbBvNrAhMfHhl@rF|h@NfDbAlTt@jBtErE|DtEbB`HFxBxAvN|@dEhCdFpBbFTzAEhBu@jBeFbF{@jB]hByBxL?rGxBrZsA~zAhGflAFfDl@zK?|J{F`g@u@fD{AtDs@hCkBzUoChv@qC`HsE|UGtD}@fN{Ux`Ae@dE\\~IMrFyCpQuIdo@uEz_@yBnSyBxBGdPqCjL]nIbBnH]`g@r@`HjArPeErGjAjKs@jAsKpR{A]u@}@eK}IwC?_DbF_DdFsAjAqBOeE]iC?cAjAe@bFeFd[FxB?xBWtDoH~S]vCDxBNfD|@bGd@fCfCfOdAlJ}@bFU|@gD`HwD|JUbQbAnS`CvWTfDs@vD_DfCmAfD?dFxC~RtEbQTjB`C`R~CvXbAjAl@OjBm@jFgN`B{@jB\\zKhMjArFjAvMu@nr@M`SWdP?fCFhCjBbF\\nILjLs@fN?xV?p{@kAlJ}PtnAyLvb@gNbe@yWn}@wCjKaRpq@WrEVpHFvC_@hCeD`HwNvl@aHhb@W~SlFpz@G~IeK|s@qGn|@}@n]cAhM?rF`CrQyBn]OrPpBpRE|JaMha@wXz_AmPnq@uErQyBdEs@xBe@`Hm@jLdEb[hGre@d@n]sFn{AeJngA}Jl_@mJtN}^d[oN`GgYxk@eEbf@wC`]cBdmAyBdP_DhLkPlUiChMGzJl@vaAm@hXyLbF}DtOsFrQwDbGyRrZuN~RcQnT}EpG}I~Su@xBqC~HeEdO_D~]cA`|@?dEm@tZG`\\aBxrCcf@`HeZ{@hH||Ad@`RjAx`@|Eb{@bFrdAjFrmArGboAhB~h@d@li@gC~fAkBfkA{@to@eAro"}

And no error is thrown and I can see the output on the console of the Export in json of the object.

I need help figuring out what's happening when I input the entire string of my shape.
I've checked with a JSON lint and it says my json is valid.

Thank you!
`

Polymorphism support

Nowhere in the documentation is there any indication of inheritance so I wondered if there is any support for that?

MakeSimple fails

"make -f MakeSimple" fails in current master (2b3010d).

Complains about missing portability.h.

$ make -f MakeSimple
g++ -c Json/JsonUtil.cpp -o Json/JsonUtil.o -I. -Ibuild/include -Ibuild/include3rd -Wno-c++11-extensions
In file included from Json/JsonUtil.h:5:0,
from Json/JsonUtil.cpp:2:
Json/JsonDom.h:5:25: fatal error: portability.h: No such file or directory
compilation terminated.
make: *** [Json/JsonUtil.o] Error 1

New to the project, not sure if it's something I missed.

Unrecognised data causes jsonImport to generate exception instead of being ignored

Version 1 would ignore extra data in jsonImport, but current version throws std::runtime_error in DeSerializationForBlock::hasMoreValue ("ThorsAnvil::Serialize::DeSerializationForBlock::hasMoreValue: Expecting key token").

Test program:

#include <fstream>
#include <string>

//#define VERSION_1

#ifdef VERSION_1
#include <Serialize/JsonSerializer.h>
#include <Serialize/json.h>
#define MAKE_TRAIT2(a,b) JsonSerializeTraits_MAKE(void,a,b);
#define MAKE_TRAIT3(a,b,c) JsonSerializeTraits_MAKE(void,a,b,c);
#define JSON_EXPORT(obj) ThorsAnvil::Serialize::jsonExport(obj)
#define JSON_FILE "/tmp/testOld.dat"
#else
#include <ThorSerialize/Traits.h>
#include <ThorSerialize/SerUtil.h>
#include <ThorSerialize/JsonThor.h>
#define MAKE_TRAIT2(a,b) ThorsAnvil_MakeTrait(a,b)
#define MAKE_TRAIT3(a,b,c) ThorsAnvil_MakeTrait(a,b,c)
#define JSON_EXPORT(obj) ThorsAnvil::Serialize::jsonExport(obj,ThorsAnvil::Serialize::PrinterInterface::OutputType::Stream)
#define JSON_FILE "/tmp/testNew.dat"
#endif


class Thing
{
public:
    Thing(): version(3) {}
    long version;
    std::string name;
};

class ThingVersion
{
public:
    ThingVersion(): version(0) {}
    long version;
};


MAKE_TRAIT2(ThingVersion, version);
MAKE_TRAIT3(Thing, name, version);


int main(int argc, const char * argv[]) {
    Thing obj;
    obj.name = "Test";
    {
        std::ofstream out(JSON_FILE);
        out << JSON_EXPORT(obj);
    }
    {
        std::ifstream in(JSON_FILE);
        ThingVersion objver;
        in >> ThorsAnvil::Serialize::jsonImport(objver);
        std::cout << "Version " << objver.version << std::endl;
    }
    return 0;
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.