MiltonJSONSceneLoader.cpp File Reference
Scene loader for Milton JSON scene format. More...
#include "MiltonJSONSceneLoader.h"
#include <milton.h>
#include <QtCore>
#include <boost/any.hpp>
#include <iostream>
#include <fstream>
#include <sstream>
Go to the source code of this file.
Defines | |
| #define | PARSE_ERROR(errorStr) |
| #define | PARSE_TYPE_ERROR(obj, typeStr, v) |
| #define | PARSE_CHECK_TYPE_ERROR(obj, typeStr, type_, v) |
| #define | PARSE_ADD_MAP(map, str, val) |
| #define | PARSE_ADD_MAP_OPTIONAL(map, str, val) |
| #define | DECLARE_VARIANT(prim, shape) |
| #define | DECLARE_PRIMITIVE(prim) DECLARE_VARIANT(prim, shape) |
| #define | DECLARE_META(prim) DECLARE_VARIANT(prim, meta) |
Detailed Description
Scene loader for Milton JSON scene format.
- Date:
- Fall 2008
Definition in file MiltonJSONSceneLoader.cpp.
Define Documentation
| #define DECLARE_META | ( | prim | ) | DECLARE_VARIANT(prim, meta) |
Definition at line 1558 of file MiltonJSONSceneLoader.cpp.
| #define DECLARE_PRIMITIVE | ( | prim | ) | DECLARE_VARIANT(prim, shape) |
Definition at line 1405 of file MiltonJSONSceneLoader.cpp.
| #define DECLARE_VARIANT | ( | prim, | |||
| shape | ) |
Value:
bool MiltonJSONSceneLoader::_parse_##prim(const JSONVariant &v, \ JSONParseData &data) const \ { \ PARSE_CHECK_TYPE_ERROR(#prim, "object", JSONObject, v); \ JSONObject obj(boost::any_cast<JSONObject>(*v)); \ obj.insert(std::make_pair(JSONString("type"), \ JSONVariant( \ new boost::any(std::string(#prim))))); \ \ return _parse_##shape(JSONVariant(new boost::any(obj)), data); \ }
Definition at line 1392 of file MiltonJSONSceneLoader.cpp.
| #define PARSE_ADD_MAP | ( | map, | |||
| str, | |||||
| val | ) |
Value:
do { \ if ((map).contains((str))) \ PARSE_ERROR("duplicate key '" + std::string((str)) + "' found"); \ (map)[(str)] = (val); \ } while(0)
Definition at line 41 of file MiltonJSONSceneLoader.cpp.
| #define PARSE_ADD_MAP_OPTIONAL | ( | map, | |||
| str, | |||||
| val | ) |
Value:
do { \ if (!(map).contains((str))) \ (map)[(str)] = (val); \ } while(0)
Definition at line 48 of file MiltonJSONSceneLoader.cpp.
| #define PARSE_CHECK_TYPE_ERROR | ( | obj, | |||
| typeStr, | |||||
| type_, | |||||
| v | ) |
Value:
do { \ if ((v)->type() != typeid(type_)) \ PARSE_TYPE_ERROR(obj, typeStr, v); \ } while(0)
Definition at line 35 of file MiltonJSONSceneLoader.cpp.
| #define PARSE_ERROR | ( | errorStr | ) |
Value:
do { \ std::stringstream s_; \ s_ << std::string(__func__) << " (" << __LINE__ << \ "): " << std::string((errorStr)); \ data.error = s_.str(); \ return false; \ } while(0)
Definition at line 21 of file MiltonJSONSceneLoader.cpp.
| #define PARSE_TYPE_ERROR | ( | obj, | |||
| typeStr, | |||||
| v | ) |
Value:
PARSE_ERROR((((std::string(obj) + " must be of type '") + \ std::string(typeStr) + "', found '") + \ std::string((v)->type().name()) + "'"))
Definition at line 30 of file MiltonJSONSceneLoader.cpp.
Generated on 28 Feb 2009 for Milton by
1.5.6