summaryrefslogtreecommitdiff
path: root/slicer/json/serializer.h
blob: a01b83663bfba35b300a2c77ee15cc7d2d500acb (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
#ifndef SLICER_JSON_H
#define SLICER_JSON_H

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

namespace Slicer {
	class Json : 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 JsonFile : public Json {
		public:
			JsonFile(const boost::filesystem::path &);

			virtual void Deserialize(ModelPartPtr) override;
			virtual void Serialize(ModelPartPtr) override;

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

	class JsonValue : public Json {
		public:
			JsonValue(json::Value &);

			virtual void Deserialize(ModelPartPtr) override;
			virtual void Serialize(ModelPartPtr) override;

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

#endif