/** \mainpage
This is the documentation of the Magic Set Editor (MSE) source code, automatically generated using doxygen.
Structure
The MSE source code is subdivided into several directories, with the following meaning:
- util: Utility functions and classes, stuff that would work equally well in another project
- gfx: Graphics related functions, again mostly independent of MSE.
This directory contains algorithms for image blending, scaling, and bezier curve functions.
- data: Data structures, like sets, cards, symbols, etc.
These data structures are documented in the 'Extending MSE' section of the official documentation.
- data/action: Actions that can be applied to those data structures.
- gui: Graphical User Interface
- resource: Resource files used (icons, cursors, etc.)
Libraries/dependencies
MSE depends on the following libraries:
- wxWidgets for the GUI.
- boost, just for shared_ptr and some preprocessor tricks.
Additional tools (not needed for building MSE) also depend on:
- doxygen for generating the documentation.
- Perl for small utility scripts
Coding style
MSE uses the following coding style:
@code
class ClassName {
public:
void someFunction();
private:
int someMember;
};
@endcode
The exception to this rule are wxWidgets functions, which LookLikeThis; and classes, which look like wxSomeClass.
As well as standard library functions.
Macro and template tricks
The source code uses several macro/preprocessor and template tricks to make the code more readable.
Smart pointers
MSE makes extensive use of boost::shared_ptr. To make the code more readable there are typedefs for these pointer types, using a suffix P.
These are defined using a macro:
@code
DECLARE_POINTER_TYPE(MyClass);
MyClassP someObject; // the same as boost::shared_ptr someObject
@endcode
To create new shared_ptrs the function new_shared# can be used (where # is the number of arguments):
@code
MyClassP someObject;
someObject = new_shared2(arg1, arg2);
@endcode
Implemented in: util/smart_ptr.hpp
Iterating
To iterate over containers the FOR_EACH macro is used:
@code
vector cards;
FOR_EACH(card, cards) {
doSomething(card);
}
@endcode
Is equivalent to:
@code
vector cards;
for(vector::iterator it = cards.begin() ; it != cards.end() ; ++it) {
CardP& card = *it;
doSomething(card);
}
@endcode
The iterators are completely hidden!
There are several veriations to this macro, for using const iterators (FOR_EACH_CONST), iterating in reverse (FOR_EACH_REVERSE),
for iterating over two collections in parallel (FOR_EACH_2), and for getting access to the iterator (FOR_EACH_IT).
Each of these macros require that the collection type has been declared using:
@code
DECLARE_COLLECTION_TYPE(CardP);
@endcode
This allows the calling of TYPEOF(cards) to evaluate to vector.
Implemented in: util/for_each.hpp
Reflection
The io (input/output) system is based on reflection.
For a class to support reflection the following must be declared:
@code
class SomeClass {
int member1, member2;
DECLARE_REFLECTION();
};
@endcode
Then in a source file the members of the class have to be specified:
@code
IMPLEMENT_REFLECTION(SomeClass) {
REFLECT(member1);
REFLECT_N("another_name", member2);
}
@endcode
Simlairly for enumerations (a declaration is not necessary):
@code
IMPLEMENT_REFLECTION_ENUM(MyEnum) {
VALUE(value_of_enum_1); // the default value
VALUE(value_of_enum_2);
}
@endcode
Implemented in: util/reflect.hpp
*/