Skip to content

SubwayRocketTeam/ActiveJson

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 

Repository files navigation

ActiveJson

  • json데이터와 C++클래스간의 ORM 맵핑
  • json데이터 형식 자동 validation

Concept

map.json

{
  "id" : 0,
  "description" : "hello world",
  
  "objects" : [
    {
      "name" : "market",
      "x" : 15, "y" : 20
    },
    {
      "name" : "enemy",
      "x" : 100, "y" : 140
    }
  ]
}

ActiveJson Script_

class Map
  int id;
  string description;
  
  vector<class Object
    string name;
    int x;
    int y;
  end> objects;
end

C++ Usage

Map map;
if(!Map::load("map.json", map)){
  printf("load failed\n");
  return false;
}

printf("id : %d\n", map.id);
printf("desc : %s\n", map.description.c_str());

for(auto object : m.objects){
  printf("obj name : %s\n", object.name.c_str());
  printf("obj x,y : %d, %d\n", object.x, object.y);
}
Map m;

m.id = 1234;
m.decription = "bye";

Map::Object obj;
obj.name = "man";
obj.x = 14; obj.y = 20;

m.objects.push_back(obj);

m.save("output.json");

Usage

active_json source_script

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages