mirror of
https://github.com/amyinspace/MagicSetEditor2.git
synced 2026-06-11 05:07:00 -04:00
improved the doxygen documentation
git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@4 0fc631ac-6414-0410-93d0-97cfa31319b6
This commit is contained in:
@@ -26,16 +26,19 @@ class Action {
|
||||
virtual String getName(bool toUndo) const = 0;
|
||||
|
||||
/// Perform the action
|
||||
/// Must be implemented in derived class
|
||||
/** Perform will only ever be called alternatingly with toUndo = true/false,
|
||||
/** @param toUndo if true, undo the action instead of doing it
|
||||
*
|
||||
* Must be implemented in derived class.
|
||||
*
|
||||
* Perform will only ever be called alternatingly with toUndo = true/false,
|
||||
* the first time with toUndo = false
|
||||
*/
|
||||
/// @param toUndo if true, undo the action instead of doing it
|
||||
virtual void perform(bool toUndo) = 0;
|
||||
|
||||
/// Try to merge another action to the end of this action.
|
||||
/// Either: return false and do nothing
|
||||
/// Or: return true and change this action to incorporate both actions
|
||||
/** Either: return false and do nothing
|
||||
* Or: return true and change this action to incorporate both actions
|
||||
*/
|
||||
virtual bool merge(const Action* action) { return false; }
|
||||
};
|
||||
|
||||
|
||||
+4
-4
@@ -13,7 +13,7 @@
|
||||
|
||||
/** @file util/error.hpp
|
||||
*
|
||||
* Classes and functions for handling errors/exceptions
|
||||
* @brief Classes and functions for handling errors/exceptions.
|
||||
*/
|
||||
|
||||
// ----------------------------------------------------------------------------- : Error types
|
||||
@@ -28,7 +28,7 @@ class Error {
|
||||
virtual String what() const;
|
||||
|
||||
private:
|
||||
String message; //^ The error message
|
||||
String message; ///< The error message
|
||||
};
|
||||
|
||||
|
||||
@@ -42,7 +42,7 @@ class InternalError : public Error {
|
||||
|
||||
// ----------------------------------------------------------------------------- : File errors
|
||||
|
||||
// Errors related to packages
|
||||
/// Errors related to packages
|
||||
class PackageError : public Error {
|
||||
public:
|
||||
inline PackageError(const String& str) : Error(str) {}
|
||||
@@ -50,7 +50,7 @@ class PackageError : public Error {
|
||||
|
||||
// ----------------------------------------------------------------------------- : Parse errors
|
||||
|
||||
// Parse errors
|
||||
/// Parse errors
|
||||
class ParseError : public Error {
|
||||
public:
|
||||
inline ParseError(const String& str) : Error(str) {}
|
||||
|
||||
+26
-17
@@ -9,7 +9,8 @@
|
||||
|
||||
/** @file util/for_each.hpp
|
||||
*
|
||||
* Macros to simplify looping over collections.
|
||||
* @brief Macros to simplify looping over collections.
|
||||
*
|
||||
* This header contains some evil template and macro hackery.
|
||||
*/
|
||||
|
||||
@@ -80,26 +81,30 @@
|
||||
// ----------------------------------------------------------------------------- : Looping macros with iterators
|
||||
|
||||
/// Iterate over a collection, using an iterator it of type Type
|
||||
/// Usage: FOR_EACH_IT_T(Type,it,collect) { body-of-loop }
|
||||
/** Usage: FOR_EACH_IT_T(Type,it,collect) { body-of-loop }
|
||||
*/
|
||||
#define FOR_EACH_IT_T(Type,Iterator,Collection) \
|
||||
for(Type Iterator = Collection.begin() ; \
|
||||
Iterator != Collection.end() ; \
|
||||
++Iterator)
|
||||
|
||||
/// Iterate over a collection whos type must be declared with DECLARE_TYPEOF
|
||||
/// Usage: FOR_EACH_IT(it,collect) { body-of-loop }
|
||||
/** Usage: FOR_EACH_IT(it,collect) { body-of-loop }
|
||||
*/
|
||||
#define FOR_EACH_IT(Iterator,Collection) \
|
||||
FOR_EACH_IT_T(TYPEOF_IT(Collection), Iterator, Collection)
|
||||
|
||||
/// Iterate over a collection whos type must be declared with DECLARE_TYPEOF
|
||||
/// Uses a const_iterator
|
||||
/// Usage: FOR_EACH_IT(it,collect) { body-of-loop }
|
||||
/** Uses a const_iterator
|
||||
* Usage: FOR_EACH_IT(it,collect) { body-of-loop }
|
||||
*/
|
||||
#define FOR_EACH_CONST_IT(Iterator,Collection) \
|
||||
FOR_EACH_IT_T(TYPEOF_CIT(Collection), Iterator, Collection)
|
||||
|
||||
/// Iterate over a collection in whos type must be declared with DECLARE_TYPEOF
|
||||
/// Iterates using a reverse_iterator
|
||||
/// Usage: FOR_EACH_REVERSE_IT(it,collect) { body-of-loop }
|
||||
/** Iterates using a reverse_iterator
|
||||
* Usage: FOR_EACH_REVERSE_IT(it,collect) { body-of-loop }
|
||||
*/
|
||||
#define FOR_EACH_REVERSE_IT(Iterator,Collection) \
|
||||
for(TYPEOF_RIT(Collection) \
|
||||
Iterator = Collection.rbegin() ; \
|
||||
@@ -109,8 +114,9 @@
|
||||
// ----------------------------------------------------------------------------- : Looping macros
|
||||
|
||||
/// Iterate over a collection, with an iterator of type TypeIt, and elements of type TypeElem
|
||||
/// Usage: FOR_EACH_T(TypeIt,TypeElem,e,collect) { body-of-loop }
|
||||
/** We need a hack to be able to declare a local variable without needing braces.
|
||||
/** Usage: FOR_EACH_T(TypeIt,TypeElem,e,collect) { body-of-loop }
|
||||
*
|
||||
* We need a hack to be able to declare a local variable without needing braces.
|
||||
* To do this we use a nested for loop that is only executed once, and which is optimized away.
|
||||
* To terminate this loop we need an extra bool, which we set to false after the first iteration.
|
||||
*/
|
||||
@@ -123,13 +129,15 @@
|
||||
Elem##_IT.second = false)
|
||||
|
||||
/// Iterate over a collection whos type must be declared with DECLARE_TYPEOF
|
||||
/// Usage: FOR_EACH(e,collect) { body-of-loop }
|
||||
/** Usage: FOR_EACH(e,collect) { body-of-loop }
|
||||
*/
|
||||
#define FOR_EACH(Elem,Collection) \
|
||||
FOR_EACH_T(TYPEOF_IT(Collection), TYPEOF_REF(Collection), Elem, Collection)
|
||||
|
||||
/// Iterate over a collection whos type must be declared with DECLARE_TYPEOF
|
||||
/// Iterates using a reverse_iterator
|
||||
/// Usage: FOR_EACH_REVERSE(e,collect) { body-of-loop }
|
||||
/** Iterates using a reverse_iterator
|
||||
* Usage: FOR_EACH_REVERSE(e,collect) { body-of-loop }
|
||||
*/
|
||||
#define FOR_EACH_REVERSE(Elem,Collection) \
|
||||
for(std::pair<TYPEOF_RIT(Collection),bool> Elem##_IT(Collection.rbegin(), true) ; \
|
||||
Elem##_IT.first != Collection.rend() ; \
|
||||
@@ -139,8 +147,9 @@
|
||||
Elem##_IT.second = false)
|
||||
|
||||
/// Iterate over two collection in parallel
|
||||
/// Usage: FOR_EACH_2_T(TypeIt1,TypeElem1,e1,collect1,TypeIt2,TypeElem2,e2,collect2) { body-of-loop }
|
||||
/** Note: This has got to be one of the craziest pieces of code I have ever written :)
|
||||
/** Usage: FOR_EACH_2_T(TypeIt1,TypeElem1,e1,collect1,TypeIt2,TypeElem2,e2,collect2) { body-of-loop }
|
||||
*
|
||||
* Note: This has got to be one of the craziest pieces of code I have ever written :)
|
||||
* It is just an extension of the idea of FOR_EACH_T.
|
||||
*/
|
||||
#define FOR_EACH_2_T(TypeIt1,TypeElem1,Elem1,Coll1,TypeIt2,TypeElem2,Elem2,Coll2) \
|
||||
@@ -157,9 +166,9 @@
|
||||
Elem1##_IT.second ; \
|
||||
Elem1##_IT.second = false)
|
||||
|
||||
/// Iterate over two collections in parallel,
|
||||
/// their type must be declared with DECLARE_TYPEOF.
|
||||
/// Usage: FOR_EACH_2(e1,collect1, e2,collect2) { body-of-loop }
|
||||
/// Iterate over two collections in parallel, their type must be declared with DECLARE_TYPEOF.
|
||||
/** Usage: FOR_EACH_2(e1,collect1, e2,collect2) { body-of-loop }
|
||||
*/
|
||||
#define FOR_EACH_2(Elem1,Collection1, Elem2,Collection2) \
|
||||
FOR_EACH_2_T(TYPEOF_IT(Collection1), TYPEOF_REF(Collection1), Elem1, Collection1, \
|
||||
TYPEOF_IT(Collection2), TYPEOF_REF(Collection2), Elem2, Collection2)
|
||||
|
||||
@@ -156,9 +156,9 @@ class EnumReader {
|
||||
inline bool isDone() const { return done; }
|
||||
|
||||
private:
|
||||
String read; //^ The string to match to a value name
|
||||
bool first; //^ Has the first (default) value been matched?
|
||||
bool done; //^ Was anything matched?
|
||||
String read; ///< The string to match to a value name
|
||||
bool first; ///< Has the first (default) value been matched?
|
||||
bool done; ///< Was anything matched?
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------- : EOF
|
||||
|
||||
@@ -124,7 +124,7 @@ class EnumWriter {
|
||||
}
|
||||
|
||||
private:
|
||||
Writer& writer; //^ The writer to write output to
|
||||
Writer& writer; ///< The writer to write output to
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------- : EOF
|
||||
|
||||
+11
-11
@@ -9,7 +9,7 @@
|
||||
|
||||
/** @file util/reflect.hpp
|
||||
*
|
||||
* Reflection of classes, currently reflection is used for (de)serialization.
|
||||
* @brief Reflection of classes, currently reflection is used for (de)serialization.
|
||||
*/
|
||||
|
||||
// ----------------------------------------------------------------------------- : Includes
|
||||
@@ -41,18 +41,18 @@
|
||||
// ----------------------------------------------------------------------------- : Implementing reflection
|
||||
|
||||
/// Implement the refelection of a class type Cls
|
||||
/// Reflection allows the member variables of a class to be inspected at runtime.
|
||||
///
|
||||
/// Currently creates the methods:
|
||||
/// - Reader::handle(Cls&)
|
||||
/// - Writer::handle(Cls&)
|
||||
/** Usage:
|
||||
* \begincode
|
||||
/** Reflection allows the member variables of a class to be inspected at runtime.
|
||||
*
|
||||
* Currently creates the methods:
|
||||
* - Reader::handle(Cls&)
|
||||
* - Writer::handle(Cls&)
|
||||
* Usage:
|
||||
* @code
|
||||
* IMPLEMENT_REFLECTION(MyClass) {
|
||||
* REFLECT(a_variable_in_my_class);
|
||||
* REFLECT(another_variable_in_my_class);
|
||||
* }
|
||||
* \endcode
|
||||
* @endcode
|
||||
*/
|
||||
#define IMPLEMENT_REFLECTION(Cls) \
|
||||
REFLECT_OBJECT_READER(Cls) \
|
||||
@@ -80,12 +80,12 @@
|
||||
|
||||
/// Implement the refelection of a enumeration type Enum
|
||||
/** Usage:
|
||||
* \begincode
|
||||
* @code
|
||||
* IMPLEMENT_REFLECTION_ENUM(MyEnum) {
|
||||
* VALUE(value_of_enum_1);
|
||||
* VALUE(value_of_enum_2);
|
||||
* }
|
||||
* \endcode
|
||||
* @endcode
|
||||
*
|
||||
* When reading the first value declared is the default value
|
||||
*
|
||||
|
||||
@@ -53,10 +53,10 @@ class Rotation {
|
||||
RealPoint trInv(const RealPoint& p) const;
|
||||
|
||||
private:
|
||||
int angle; //^ The angle of rotation in degrees (counterclockwise)
|
||||
RealSize size; //^ Size of the rectangle, in external coordinates
|
||||
RealPoint origin; //^ tr(0,0)
|
||||
double zoom; //^ Zoom factor, zoom = 2.0 means that 1 internal = 2 external
|
||||
int angle; ///< The angle of rotation in degrees (counterclockwise)
|
||||
RealSize size; ///< Size of the rectangle, in external coordinates
|
||||
RealPoint origin; ///< tr(0,0)
|
||||
double zoom; ///< Zoom factor, zoom = 2.0 means that 1 internal = 2 external
|
||||
|
||||
/// Is the rotation sideways (90 or 270 degrees)?
|
||||
// Note: angle & 2 == 0 for angle in {0, 180} and != 0 for angle in {90, 270)
|
||||
@@ -75,11 +75,11 @@ class Rotation {
|
||||
|
||||
/// An object that changes a rotation RIIA style
|
||||
/** Usage:
|
||||
* \begincode
|
||||
* @code
|
||||
* Rotation a, b;
|
||||
* Rotater(a,b);
|
||||
* a.tr(x) // now acts as a.tr(b.tr(x))
|
||||
* \endcode
|
||||
* @endcode
|
||||
*/
|
||||
class Rotater {
|
||||
/// Compose a rotation by onto the rotation rot
|
||||
|
||||
@@ -7,9 +7,9 @@
|
||||
#ifndef HEADER_UTIL_SMART_PTR
|
||||
#define HEADER_UTIL_SMART_PTR
|
||||
|
||||
/** @file util/shared_ptr.hpp
|
||||
/** @file util/smart_ptr.hpp
|
||||
*
|
||||
* Utilities related to boost smart pointers
|
||||
* @brief Utilities related to boost smart pointers
|
||||
*/
|
||||
|
||||
// ----------------------------------------------------------------------------- : Includes
|
||||
|
||||
@@ -14,7 +14,6 @@
|
||||
|
||||
// ----------------------------------------------------------------------------- : Includes
|
||||
|
||||
#include "prec.hpp"
|
||||
#include "for_each.hpp"
|
||||
#include <ctype.h>
|
||||
#include <boost/preprocessor/cat.hpp>
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
//+----------------------------------------------------------------------------+
|
||||
//| Description: Magic Set Editor - Program to make Magic (tm) cards |
|
||||
//| Copyright: (C) 2001 - 2006 Twan van Laarhoven |
|
||||
//| License: GNU General Public License 2 or later (see file COPYING) |
|
||||
//+----------------------------------------------------------------------------+
|
||||
|
||||
// ----------------------------------------------------------------------------- : Includes
|
||||
|
||||
#include <vector2d.hpp>
|
||||
#include "for_each.hpp"
|
||||
|
||||
// ----------------------------------------------------------------------------- : IO
|
||||
Reference in New Issue
Block a user