-
Notifications
You must be signed in to change notification settings - Fork 461
Description
#ifndef PSDLAYER_H_
#define PSDLAYER_H_
#include "rttr/registration"
class PSDLayer
{
public:
PSDLayer();
virtual ~PSDLayer();
public:
int left;
int top;
int right;
int bottom;
RTTR_ENABLE()
};
#endif //PSDLAYER_H_
#include "core/psdlayer.h"
PSDLayer::PSDLayer():left(0),top(0),right(0),bottom(0){}
PSDLayer::~PSDLayer(){}
RTTR_REGISTRATION
{
rttr::registration::class_("PSDLayer")
.property("left", &PSDLayer::left)
.property("top", &PSDLayer::top)
.property("right", &PSDLayer::right)
.property("bottom", &PSDLayer::bottom)
;
}
#ifndef PSDTYPELAYER_H_
#define PSDTYPELAYER_H_
#include
#include "core/psdlayer.h"
class PSDTypeLayer : public PSDLayer
{
public:
PSDTypeLayer();
~PSDTypeLayer();
public:
RTTR_ENABLE(PSDLayer)
public:
std::string vips_text;
};
#endif // PSDTYPELAYER_H_
#include "core/psdtypelayer.h"
PSDTypeLayer::PSDTypeLayer()
{
}
PSDTypeLayer::~PSDTypeLayer()
{
}
RTTR_REGISTRATION
{
rttr::registration::class_("PSDTypeLayer")
.property("vips_text", &PSDTypeLayer::vips_text)
;
}
#ifndef PSDLAYERVECTOR_H_
#define PSDLAYERVECTOR_H_
#include
#include "core/psdlayer.h"
class PSDLayerVector
{
public:
PSDLayerVector();
~PSDLayerVector();
RTTR_ENABLE()
public:
std::vector<std::shared_ptr> layers;
};
#endif //PSDLAYERVECTOR_H_
#include "core/psdlayervector.h"
PSDLayerVector::PSDLayerVector()
{
}
PSDLayerVector::~PSDLayerVector()
{
}
RTTR_REGISTRATION
{
rttr::registration::class_("PSDLayerVector")
.property("layers", &PSDLayerVector::layers)
;
}
int main(int argc, char** argv)
{
PSDLayerVector layers;
auto p1 = std::make_shared<PSDLayer>();
p1->left = 100;
auto p2 = std::make_shared<PSDTypeLayer>();
p2->vips_text = "hello world";
layers.layers.push_back(p1);
layers.layers.push_back(p2);
std::string json_string;
json_string = io::to_json(layers);
std::cout << json_string << std::endl;
PSDLayerVector objlayers;
io::from_json(json_string, objlayers);
return 0;
}