summaryrefslogtreecommitdiff
path: root/slicer/json/serializer.h
blob: 6e8707101049707199cecdd6e258e2d0586f464f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#ifndef SLICER_JSON_H
#define SLICER_JSON_H

#include <slicer/serializer.h>
#include <jsonpp.h>

namespace Slicer {
	class JsonSerializer : public Serializer {
		protected:
			static void ModelTreeIterate(json::Value *, const std::string &, ModelPartPtr mp);
			static void ModelTreeIterateSeq(json::Value *, ModelPartPtr mp);
			static void ModelTreeIterateRoot(json::Value *, ModelPartPtr mp);
	};

	class JsonFileSerializer : public JsonSerializer {
		public:
			JsonFileSerializer(const boost::filesystem::path &);

			virtual void Serialize(ModelPartPtr) override;

		private:
			const boost::filesystem::path path;
	};

	class JsonValueSerializer : public JsonSerializer {
		public:
			JsonValueSerializer(json::Value &);

			virtual void Serialize(ModelPartPtr) override;

		private:
			json::Value & value;
	};

	class JsonFileDeserializer : public Deserializer {
		public:
			JsonFileDeserializer(const boost::filesystem::path &);

			virtual void Deserialize(ModelPartPtr) override;

		private:
			const boost::filesystem::path path;
	};

	class JsonValueDeserializer : public Deserializer {
		public:
			JsonValueDeserializer(const json::Value &);

			virtual void Deserialize(ModelPartPtr) override;

		private:
			const json::Value & value;
	};
}

#endif