Commit 198c01c4 authored by twanvl's avatar twanvl

improved the doxygen documentation

parent 16663f2b
//+----------------------------------------------------------------------------+
//| 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 <util/prec.hpp>
// ----------------------------------------------------------------------------- :
//+----------------------------------------------------------------------------+
//| 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) |
//+----------------------------------------------------------------------------+
#ifndef HEADER_
#define HEADER_
// ----------------------------------------------------------------------------- : Includes
#include <util/prec.hpp>
// ----------------------------------------------------------------------------- :
// ----------------------------------------------------------------------------- : EOF
#endif
......@@ -40,11 +40,11 @@ class SymbolPartMoveAction : public SymbolPartAction {
void move(const Vector2D& delta);
private:
set<SymbolPartP> parts; //^ Parts to move
Vector2D delta; //^ How much to move
Vector2D moved; //^ How much has been moved
set<SymbolPartP> parts; ///< Parts to move
Vector2D delta; ///< How much to move
Vector2D moved; ///< How much has been moved
public:
bool constrain; //^ Constrain movement?
bool constrain; ///< Constrain movement?
};
// ----------------------------------------------------------------------------- : Rotating symbol parts
......@@ -61,8 +61,8 @@ class SymbolPartMatrixAction : public SymbolPartAction {
/// Perform the transformation using the given matrix
void transform(const Vector2D& mx, const Vector2D& my);
set<SymbolPartP> parts; //^ Parts to transform
Vector2D center; //^ Center to transform around
set<SymbolPartP> parts; ///< Parts to transform
Vector2D center; ///< Center to transform around
};
/// Rotate some symbol parts
......@@ -80,9 +80,9 @@ class SymbolPartRotateAction : public SymbolPartMatrixAction {
void rotateBy(double deltaAngle);
private:
double angle; //^ How much to rotate?
double angle; ///< How much to rotate?
public:
bool constrain; //^ Constrain movement?
bool constrain; ///< Constrain movement?
};
......@@ -100,10 +100,10 @@ class SymbolPartShearAction : public SymbolPartMatrixAction {
void move(const Vector2D& deltaShear);
private:
Vector2D shear; //^ Shearing, shear.x == 0 || shear.y == 0
Vector2D shear; ///< Shearing, shear.x == 0 || shear.y == 0
void shearBy(const Vector2D& shear);
public:
bool constrain; //^ Constrain movement?
bool constrain; ///< Constrain movement?
};
......@@ -123,11 +123,11 @@ class SymbolPartScaleAction : public SymbolPartAction {
void update();
private:
set<SymbolPartP> parts; //^ Parts to scale
Vector2D oldMin, oldSize; //^ the original pos/size
Vector2D newRealMin, newRealSize; //^ the target pos/sizevoid shearBy(const Vector2D& shear)
Vector2D newMin, newSize; //^ the target pos/size after applying constrains
int scaleX, scaleY; //^ to what corner are we attached?
set<SymbolPartP> parts; ///< Parts to scale
Vector2D oldMin, oldSize; ///< the original pos/size
Vector2D newRealMin, newRealSize; ///< the target pos/sizevoid shearBy(const Vector2D& shear)
Vector2D newMin, newSize; ///< the target pos/size after applying constrains
int scaleX, scaleY; ///< to what corner are we attached?
/// Transform everything in the parts
void transformAll();
/// Transform a single vector
......@@ -135,7 +135,7 @@ class SymbolPartScaleAction : public SymbolPartAction {
return (v - oldMin).div(oldSize).mul(newSize) + newMin;
}
public:
bool constrain; //^ Constrain movement?
bool constrain; ///< Constrain movement?
};
// ----------------------------------------------------------------------------- : Change combine mode
......@@ -149,7 +149,7 @@ class CombiningModeAction : public SymbolPartListAction {
virtual void perform(bool toUndo);
private:
vector<pair<SymbolPartP,SymbolPartCombine> > parts; //^ Affected parts with new combining modes
vector<pair<SymbolPartP,SymbolPartCombine> > parts; ///< Affected parts with new combining modes
};
// ----------------------------------------------------------------------------- : Change name
......@@ -163,14 +163,13 @@ class SymbolPartNameAction : public SymbolPartListAction {
virtual void perform(bool toUndo);
private:
SymbolPartP part; //^ Affected part
String partName; //^ New name
SymbolPartP part; ///< Affected part
String partName; ///< New name
};
// ----------------------------------------------------------------------------- : Add symbol part
/// Adding a part to a symbol, added at the front of the list
/// front = drawn on top
/// Adding a part to a symbol, added at the front of the list (drawn on top)
class AddSymbolPartAction : public SymbolPartListAction {
public:
AddSymbolPartAction(Symbol& symbol, const SymbolPartP& part);
......@@ -179,8 +178,8 @@ class AddSymbolPartAction : public SymbolPartListAction {
virtual void perform(bool toUndo);
private:
Symbol& symbol; //^ Symbol to add the part to
SymbolPartP part; //^ Part to add
Symbol& symbol; ///< Symbol to add the part to
SymbolPartP part; ///< Part to add
};
// ----------------------------------------------------------------------------- : Remove symbol part
......@@ -221,8 +220,7 @@ class DuplicateSymbolPartsAction : public SymbolPartListAction {
// ----------------------------------------------------------------------------- : Reorder symbol parts
/// Change the position of a part in a symbol.
/// This is done by swapping two parts.
/// Change the position of a part in a symbol, by swapping two parts.
class ReorderSymbolPartsAction : public SymbolPartListAction {
public:
ReorderSymbolPartsAction(Symbol& symbol, size_t partId1, size_t partId2);
......@@ -231,9 +229,9 @@ class ReorderSymbolPartsAction : public SymbolPartListAction {
virtual void perform(bool toUndo);
private:
Symbol& symbol; //^ Symbol to swap the parts in
Symbol& symbol; ///< Symbol to swap the parts in
public:
size_t partId1, partId2; //^ Indeces of parts to swap
size_t partId1, partId2; ///< Indeces of parts to swap
};
......
......@@ -253,8 +253,8 @@ class SinglePointRemoveAction : public Action {
private:
SymbolPartP part;
UInt position;
ControlPointP point; //^ Removed point
ControlPointUpdate point1, point2; //^ Points before/after
ControlPointP point; ///< Removed point
ControlPointUpdate point1, point2; ///< Points before/after
};
SinglePointRemoveAction::SinglePointRemoveAction(const SymbolPartP& part, UInt position)
......@@ -327,9 +327,9 @@ DECLARE_POINTER_TYPE(SinglePointRemoveAction);
DECLARE_TYPEOF_COLLECTION(SinglePointRemoveActionP);
/// Remove a set of points from a symbol part
/// Internally represented as a list of Single Point Remove Actions
/// Not all points mat be removed, at least two points must remain
// Remove a set of points from a symbol part.
// Internally represented as a list of Single Point Remove Actions.
// Not all points mat be removed, at least two points must remain.
class ControlPointRemoveAction : public Action {
public:
ControlPointRemoveAction(const SymbolPartP& part, const set<ControlPointP>& toDelete);
......
......@@ -38,11 +38,11 @@ class ControlPointMoveAction : public Action {
void move(const Vector2D& delta);
private:
set<ControlPointP> points; //^ Points to move
vector<Vector2D> oldValues; //^ Their old positions
Vector2D delta; //^ Amount we moved
set<ControlPointP> points; ///< Points to move
vector<Vector2D> oldValues; ///< Their old positions
Vector2D delta; ///< Amount we moved
public:
bool constrain; //^ Constrain movement?
bool constrain; ///< Constrain movement?
};
// ----------------------------------------------------------------------------- : Move handle
......@@ -59,12 +59,12 @@ class HandleMoveAction : public Action {
void move(const Vector2D& delta);
private:
SelectedHandle handle; //^ The handle to move
Vector2D oldHandle; //^ Old value of this handle
Vector2D oldOther; //^ Old value of other handle, needed for contraints
Vector2D delta; //^ Amount we moved
SelectedHandle handle; ///< The handle to move
Vector2D oldHandle; ///< Old value of this handle
Vector2D oldOther; ///< Old value of other handle, needed for contraints
Vector2D delta; ///< Amount we moved
public:
bool constrain; //^ Constrain movement?
bool constrain; ///< Constrain movement?
};
// ----------------------------------------------------------------------------- : Segment mode
......@@ -108,7 +108,7 @@ class LockModeAction : public Action {
virtual void perform(bool toUndo);
private:
ControlPointUpdate point; //^ The affected point
ControlPointUpdate point; ///< The affected point
};
// ----------------------------------------------------------------------------- : Move curve
......@@ -141,10 +141,10 @@ class ControlPointAddAction : public Action {
inline ControlPointP getNewPoint() const { return newPoint; }
private:
SymbolPartP part; //^ SymbolPart we are in
ControlPointP newPoint; //^ The point to insert
UInt insertAfter; //^ Insert after index .. in the array
ControlPointUpdate point1, point2; //^ Update the points around the new point
SymbolPartP part; ///< SymbolPart we are in
ControlPointP newPoint; ///< The point to insert
UInt insertAfter; ///< Insert after index .. in the array
ControlPointUpdate point1, point2; ///< Update the points around the new point
};
// ----------------------------------------------------------------------------- : Remove control point
......
......@@ -26,9 +26,9 @@ DECLARE_TYPEOF_COLLECTION(SymbolPartP);
/** Specificly: the relation between deltaBefore and deltaAfter
*/
enum LockMode
{ LOCK_FREE //^ no locking
, LOCK_DIR //^ deltaBefore = x * deltaAfter
, LOCK_SIZE //^ deltaBefore = -deltaAfter
{ LOCK_FREE ///< no locking
, LOCK_DIR ///< deltaBefore = x * deltaAfter
, LOCK_SIZE ///< deltaBefore = -deltaAfter
};
/// Is the segment between two ControlPoints a line or a curve?
......@@ -39,7 +39,7 @@ enum SegmentMode
/// To refer to a specific handle of a control point
enum WhichHandle
{ HANDLE_NONE = 0 //^ point is not selected
{ HANDLE_NONE = 0 ///< point is not selected
, HANDLE_MAIN
, HANDLE_BEFORE
, HANDLE_AFTER
......@@ -48,9 +48,9 @@ enum WhichHandle
/// A control point (corner) of a SymbolPart (polygon/bezier-gon)
class ControlPoint {
public:
Vector2D pos; //^ position of the control point itself
Vector2D deltaBefore; //^ delta to bezier control point, for curve before point
Vector2D deltaAfter; //^ delta to bezier control point, for curve after point
Vector2D pos; ///< position of the control point itself
Vector2D deltaBefore; ///< delta to bezier control point, for curve before point
Vector2D deltaAfter; ///< delta to bezier control point, for curve after point
SegmentMode segmentBefore, segmentAfter;
LockMode lock;
......@@ -80,8 +80,8 @@ class ControlPoint {
/// A specific handle of a ControlPoint
class SelectedHandle {
public:
ControlPointP point; //^ the selected point
WhichHandle handle; //^ the selected handle of the point
ControlPointP point; ///< the selected point
WhichHandle handle; ///< the selected handle of the point
// SelectedHandle
SelectedHandle() : handle(HANDLE_NONE) {}
......
......@@ -101,9 +101,9 @@ void drawCombineImage(DC& dc, UInt x, UInt y, const Image& img, ImageCombine com
// ----------------------------------------------------------------------------- : Utility
inline int bot(int x) { return max(0, x); } //^ bottom range check for color values
inline int top(int x) { return min(255, x); } //^ top range check for color values
inline int col(int x) { return top(bot(x)); } //^ top and bottom range check for color values
inline int bot(int x) { return max(0, x); } ///< bottom range check for color values
inline int top(int x) { return min(255, x); } ///< top range check for color values
inline int col(int x) { return top(bot(x)); } ///< top and bottom range check for color values
// ----------------------------------------------------------------------------- : EOF
#endif
//+----------------------------------------------------------------------------+
//| 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 "icon_menu.hpp"
// ----------------------------------------------------------------------------- : generateDisabledImage
// Generate an image to use for the disabled state of menu items
Image generateDisabledImage(const Image& imgIn) {
// Some system colors
Color trans(1,2,3); // mask color used by bitmaps as 'transparent'
Color light = wxSystemSettings::GetColour(wxSYS_COLOUR_3DHIGHLIGHT);
Color shadow = wxSystemSettings::GetColour(wxSYS_COLOUR_3DSHADOW);
// generate disabled bitmap
Image imgOut(16, 16);
imgOut.SetMaskColour(1,2,3);
Byte *in = imgIn.GetData(), *out = imgOut.GetData();
// For each pixel...
for (int y = 0 ; y < 16 ; ++y) {
for (int x = 0 ; x < 16 ; ++x) {
// is the pixel mask color or white?
Color in1 = trans, in2 = trans;
if (x<15 && y<15) in1 = Color(in[0], in[1], in[2]);
// and the pixel to the left+up?
if (x>0 && y>0 ) in2 = Color(in[0 - 3*17], in[1 - 3*17], in[2 - 3*17]);
// determine output color
Color col;
if (in1 != trans && in1 != light) col = shadow;
else if (in2 != trans && in2 != light) col = light;
else col = trans;
out[0] = col.Red();
out[1] = col.Green();
out[2] = col.Blue();
in += 3;
out += 3;
}
}
return imgOut;
}
// ----------------------------------------------------------------------------- : IconMenu
void IconMenu::Append(int id, const String& resource, const String& text, const String& help, int style, wxMenu* submenu) {
// load bitmap
Bitmap bitmap(resource);
bitmap = bitmap.GetSubBitmap(wxRect(0,0,16,16));
Image disabledImage = generateDisabledImage(bitmap.ConvertToImage());
// add menu item
wxMenuItem* item = new wxMenuItem(this, id, text, help, style, submenu);
item->SetBitmaps(bitmap, bitmap);
item->SetDisabledBitmap(disabledImage);
wxMenu::Append(item);
}
void IconMenu::Append(int id, const String& text, const String& help) {
wxMenuItem* item = new wxMenuItem (this, id, text, help);
item->SetBitmap(wxNullBitmap);
wxMenu::Append(item);
}
void IconMenu::Append(int id, const String& text, wxMenu* submenu, const String& help) {
wxMenuItem* item = new wxMenuItem (this, id, text, help, wxITEM_NORMAL, submenu);
item->SetBitmap(wxNullBitmap);
wxMenu::Append(item);
}
void IconMenu::Insert(size_t pos, int id, const String& text, const String& help) {
wxMenuItem* item = new wxMenuItem (this, id, text, help);
item->SetBitmap(wxNullBitmap);
wxMenu::Insert(pos, item);
}
//+----------------------------------------------------------------------------+
//| 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) |
//+----------------------------------------------------------------------------+
#ifndef HEADER_GUI_ICON_MENU
#define HEADER_GUI_ICON_MENU
// ----------------------------------------------------------------------------- : Includes
#include "../util/prec.hpp"
// ----------------------------------------------------------------------------- : IconMenu
/// Helper class for menus with icons
/** This class functions just like a normal wxMenu.
* The difference is that Append takes an extra parameter:
* the resource name of the bitmap to use.
* Bitmaps are resized (cut) to 16x16 pixels.
*/
class IconMenu : public wxMenu {
public:
/// Append a menu item, with an image (loaded from a resource)
void Append(int id, const String& resource, const String& text, const String& help, int style = wxITEM_NORMAL, wxMenu* submenu = nullptr);
/// Append a menu item, without an image
void Append(int id, const String& text, const String& help);
/// Append a menu item, without an image
void Append(int id, const String& text, wxMenu* submenu, const String& help);
/// Insert a menu item, without an image
void Insert(size_t pos, int id, const String& text, const String& help);
};
// ----------------------------------------------------------------------------- : EOF
#endif
......@@ -43,11 +43,11 @@ class SymbolPointEditor : public SymbolEditorBase {
void drawHandleCircle(DC& dc, UInt px, UInt py);
enum WhichPen {
PEN_NORMAL, //^ Pen for normal handles
PEN_HOVER, //^ Pen for hovered handles
PEN_LINE, //^ Pen for the line to handles
PEN_MAIN, //^ Pen for the main handle
PEN_NEW_POINT //^ Pen for the new point
PEN_NORMAL, ///< Pen for normal handles
PEN_HOVER, ///< Pen for hovered handles
PEN_LINE, ///< Pen for the line to handles
PEN_MAIN, ///< Pen for the main handle
PEN_NEW_POINT ///< Pen for the new point
};
/// Retrieve a pen for the drawing of parts of handles
wxPen handlePen(WhichPen p, LockMode lock);
......@@ -91,11 +91,11 @@ class SymbolPointEditor : public SymbolEditorBase {
// Selection
enum Selection {
SELECTED_NONE, //^ no selection
SELECTED_POINTS, //^ some points are selected
SELECTED_HANDLE, //^ a handle is selected
SELECTED_LINE, //^ a line is selected
SELECTED_NEW_POINT //^ a new point on a line (used for hovering)
SELECTED_NONE, ///< no selection
SELECTED_POINTS, ///< some points are selected
SELECTED_HANDLE, ///< a handle is selected
SELECTED_LINE, ///< a line is selected
SELECTED_NEW_POINT ///< a new point on a line (used for hovering)
};
Selection selection;
// points
......
......@@ -32,7 +32,7 @@ class SymbolViewer : public SymbolView {
// --------------------------------------------------- : Point translation
Rotation rotation; //^ Object that handles rotation, scaling and translation
Rotation rotation; ///< Object that handles rotation, scaling and translation
// --------------------------------------------------- : Drawing
......
......@@ -35,8 +35,8 @@ class SymbolWindow : public Frame {
/// Actual initialisation
void init(Window* parent, SymbolP symbol);
SymbolControl* control; //^ The control for editing/displaying the symbol
SymbolPartList* parts; //^ A list of parts in the symbol
SymbolControl* control; ///< The control for editing/displaying the symbol
SymbolPartList* parts; ///< A list of parts in the symbol
// when editing a symbol field
// SymbolValueP value
......@@ -65,7 +65,7 @@ class SymbolWindow : public Frame {
/// Activating a part: open the point editor
void onActivateFromList(wxListEvent& ev);
bool inSelectionEvent; //^ Prevent recursion in onSelect...
bool inSelectionEvent; ///< Prevent recursion in onSelect...
public:
void onSelectFromControl();
......
//+----------------------------------------------------------------------------+
//| 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 "util/prec.hpp"
#include <gui/symbol/window.hpp>
// ----------------------------------------------------------------------------- : Main function/class
/// The application class for MSE.
/** This class is used by wxWidgets as a kind of 'main function'
*/
class MSE : public wxApp {
public:
/// Main startup function of the program
bool OnInit();
/// On exit: write the settings to the config file
int OnExit();
/// On exception: display error message
bool OnExceptionInMainLoop();
};
IMPLEMENT_APP(MSE)
// ----------------------------------------------------------------------------- : Initialization
bool MSE::OnInit() {
wxInitAllImageHandlers();
//initFileFilters()
Window* wnd = new SymbolWindow(0);
wnd->Show();
return true;
}
// ----------------------------------------------------------------------------- : Exit
int MSE::OnExit() {
// settings.write();
return 0;
}
// ----------------------------------------------------------------------------- : Exception handling
bool MSE::OnExceptionInMainLoop() {
return true;
}
......@@ -347,6 +347,12 @@
<Filter
Name="control"
Filter="">
<File
RelativePath=".\gui\control\card_list.cpp">
</File>
<File
RelativePath=".\gui\control\card_list.hpp">
</File>
</Filter>
<Filter
Name="editor"
......
......@@ -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; }
};
......
......@@ -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) {}
......
......@@ -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
......
......@@ -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>
......
//+----------------------------------------------------------------------------+
//| 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
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment