mirror of
https://github.com/amyinspace/MagicSetEditor2.git
synced 2026-06-10 21:06:59 -04:00
start with implementing fields
git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@12 0fc631ac-6414-0410-93d0-97cfa31319b6
This commit is contained in:
+4
-4
@@ -7,15 +7,15 @@
|
||||
#ifndef HEADER_UTIL_ERROR
|
||||
#define HEADER_UTIL_ERROR
|
||||
|
||||
// ----------------------------------------------------------------------------- : Includes
|
||||
|
||||
#include <util/prec.hpp>
|
||||
|
||||
/** @file util/error.hpp
|
||||
*
|
||||
* @brief Classes and functions for handling errors/exceptions.
|
||||
*/
|
||||
|
||||
// ----------------------------------------------------------------------------- : Includes
|
||||
|
||||
#include <util/prec.hpp>
|
||||
|
||||
// ----------------------------------------------------------------------------- : Error types
|
||||
|
||||
/// Our own exception class
|
||||
|
||||
+10
-1
@@ -99,6 +99,15 @@ class Reader {
|
||||
|
||||
// ----------------------------------------------------------------------------- : Container types
|
||||
|
||||
/// Construct a new type, possibly reading something in the process.
|
||||
/** By default just creates a new object.
|
||||
* This function can be overloaded to provide different behaviour
|
||||
*/
|
||||
template <typename T>
|
||||
shared_ptr<T> read_new(Reader& reader) {
|
||||
return new_shared<T>();
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
void Reader::handle(vector<T>& vector) {
|
||||
String vectorKey = key;
|
||||
@@ -111,7 +120,7 @@ void Reader::handle(vector<T>& vector) {
|
||||
|
||||
template <typename T>
|
||||
void Reader::handle(shared_ptr<T>& pointer) {
|
||||
if (!pointer) pointer.reset(new T);
|
||||
if (!pointer) pointer = read_new<T>(*this);
|
||||
handle(*pointer);
|
||||
}
|
||||
|
||||
|
||||
@@ -7,6 +7,11 @@
|
||||
#ifndef HEADER_UTIL_REAL_POINT
|
||||
#define HEADER_UTIL_REAL_POINT
|
||||
|
||||
/** @file util/real_point.hpp
|
||||
*
|
||||
* @brief Points and sizes with floating point (real) coordinates.
|
||||
*/
|
||||
|
||||
// ----------------------------------------------------------------------------- : Includes
|
||||
|
||||
#include <util/prec.hpp>
|
||||
|
||||
Reference in New Issue
Block a user