-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
26 changed files
with
930 additions
and
85 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,6 @@ | ||
[submodule "External/Mustache"] | ||
path = External/Mustache | ||
url = https://github.com/kainjow/Mustache.git | ||
[submodule "External/rapidjson"] | ||
path = External/rapidjson | ||
url = https://github.com/Tencent/rapidjson.git |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,58 @@ | ||
#include <MetaCPP/Storage.hpp> | ||
#include <iostream> | ||
|
||
#include "test.hpp" | ||
|
||
#include <iostream> | ||
#include <MetaCPP/Storage.hpp> | ||
#include <MetaCPP/Runtime.hpp> | ||
#include <MetaCPP/TypeInfo.hpp> | ||
#include <MetaCPP/JsonSerializer.hpp> | ||
|
||
int main() { | ||
metacpp::generated::Load(metacpp::Runtime::GetStorage()); | ||
|
||
metacpp::Storage* storage = metacpp::Runtime::GetStorage(); | ||
//storage->dump(); | ||
|
||
Entity e; | ||
e.name = "Tank"; | ||
e.health = 199; | ||
|
||
e.m_Position.x = 3.3; | ||
e.m_Position.y = 4.4; | ||
e.m_Velocity.x = -4; | ||
e.m_Velocity.y = -2; | ||
|
||
Target* t = new Target(); | ||
t->attack = true; | ||
t->targetPosition.x = -99; | ||
t->targetPosition.y = 99; | ||
|
||
t->vics = { {1,2},{3,4},{5,6} }; | ||
t->tgts = { t,t,t }; | ||
|
||
e.m_TargetA = t; | ||
e.m_TargetB = t; | ||
|
||
e.m_TargetA->target = t; | ||
|
||
e.m_B = new Base(); | ||
e.m_D = new Derived(); | ||
|
||
e.list = { 5, 6, 7 }; | ||
e.two_dim = { {0,1,2},{3,4,5},{6,7,8} }; | ||
|
||
metacpp::JsonSerializer serializer = metacpp::JsonSerializer(storage, true); | ||
|
||
std::string json = serializer.Serialize(&e, true); | ||
std::cout << json.length() << std::endl; | ||
std::cout << json << std::endl; | ||
|
||
std::cout << "---------------------------------------------" << std::endl; | ||
|
||
Entity* e2 = serializer.DeSerialize<Entity>(json); | ||
std::cout << serializer.Serialize(e2, true) << std::endl; | ||
|
||
system("pause"); | ||
|
||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,81 +1,56 @@ | ||
// This is a dumb file | ||
|
||
//#include <vector> | ||
#include <string> | ||
#include <vector> | ||
|
||
namespace N5 { | ||
enum AnEnum { | ||
AnEnumElement, | ||
AnotherEnumElement, | ||
YetAnotherEnumElement | ||
}; | ||
} | ||
|
||
namespace N1 { | ||
struct Point { | ||
struct WhyNot { | ||
protected: | ||
int whynotint; | ||
}; | ||
double x, y; | ||
WhyNot wn; | ||
int WhyNot; | ||
}; | ||
} | ||
template<typename T> | ||
struct Vector { | ||
T x, y; | ||
}; | ||
|
||
typedef Vector<int> Vectori; | ||
typedef Vector<float> Vectorf; | ||
|
||
class Base { | ||
protected: | ||
int a; | ||
double b; | ||
N5::AnEnum daenum; | ||
struct Target { | ||
public: | ||
float method(short c) { | ||
return a + c; | ||
Target() { | ||
|
||
} | ||
|
||
bool attack; | ||
Vectorf targetPosition; | ||
|
||
Target* target; | ||
std::vector<Vectori> vics; | ||
std::vector<Target*> tgts; | ||
}; | ||
|
||
namespace N4 { | ||
template<typename T> | ||
class ExampleT { | ||
public: | ||
ExampleT() {}; | ||
class Base { | ||
public: | ||
virtual ~Base() {}; | ||
|
||
private: | ||
int a; | ||
T var; | ||
char c; | ||
}; | ||
} | ||
int base_int = 3; | ||
}; | ||
|
||
class Derived : public Base { | ||
public: | ||
long method(int d) { | ||
return a + b + d; | ||
} | ||
protected: | ||
N1::Point derived_point; | ||
char c; | ||
int e, f; | ||
int derived_int = 4; | ||
}; | ||
|
||
N4::ExampleT<float> specified3; | ||
N4::ExampleT<double> specified4; | ||
N4::ExampleT<int> specified5; | ||
N4::ExampleT<N1::Point> specified6; | ||
struct Entity { | ||
std::string name; | ||
int health; | ||
|
||
//std::vector<int> vecints; | ||
}; | ||
Vectorf m_Position; | ||
Vectori m_Velocity; | ||
|
||
namespace N2 { | ||
typedef N4::ExampleT<int> ExampleTSpecified; | ||
typedef int defint; | ||
} | ||
std::vector<int> list; | ||
std::vector<std::vector<int>> two_dim; | ||
|
||
namespace N3 { | ||
class Specified2 : public N4::ExampleT<N1::Point> { | ||
public: | ||
int jj; | ||
N2::defint kk; | ||
N4::ExampleT<Derived> test; | ||
}; | ||
Target* m_TargetA; | ||
Target* m_TargetB; | ||
Target** m_Targets; | ||
|
||
} | ||
Base* m_B; | ||
Base* m_D; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#ifndef METACPP_CONTAINER_HPP | ||
#define METACPP_CONTAINER_HPP | ||
|
||
namespace metacpp { | ||
class Container { | ||
|
||
}; | ||
} | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.