Warning, /education/labplot/src/backend/lib/commandtemplates.dox is written in an unsupported language. File is not indexed.

0001 /**
0002  * \class TypeSelect
0003  * \brief Template which results in a const reference for non-basic template parameter types.
0004  *
0005  * E.g., "TypeSelect<MyClass>" will expand to "const MyClass &" at compile time while 
0006  * "TypeSelect<int>" will expand to "int".
0007  */
0008 
0009 /**
0010  * \class StandardSetterCmd
0011  * \brief Template for simple setter undo commands.
0012  *
0013  * Use it like this:
0014  * \code
0015 class MyClassSetMyValueCmd: public StandardClassSetterCmd<MyClass::Private, TheValueTypeOrClass> {
0016         public:
0017                 MyClassSetMyValueCmd(MyClass::Private *target, TypeSelect<TheValueOrClasse>::ParamType newValue, const QString &description)
0018                         : StandardSetterCmd<MyClass::Private, TypeSelect<TheValueOrClasse>::ParamType>(target, &MyClass::Private::myValue, newValue, description) {}
0019                 virtual void initialize() { emit m_target->q->myValueAboutToChange(); }
0020                 virtual void finalize() { emit m_target->q->myValueChanged(); }
0021 };
0022  * \endcode
0023  * When instanciating the class, use 
0024  * \code tr("%1: what the command does") \endcode for the description argument. The "%1" will automatically be replaced by 
0025  * the aspect name (the private class must implement "QString name() const").
0026  * Example: \code
0027 class MyClass::Private {
0028         public:
0029                 Private(MyClass *owner) : q(owner) {
0030                 }
0031 
0032                 QString name() const {
0033                         return q->name();
0034                 }
0035 
0036                 int myValue;
0037                 MyClass *const q;
0038 };
0039 
0040 void MyClass::setMyValue(int value) {
0041         exec(new MyClassSetMyValueCmd(d, value, tr("%1: set my value")));
0042 }
0043  * \endcode
0044  */
0045 
0046 /**
0047  * \class StandardSwapMethodSetterCmd
0048  * \brief Template for setter undo commands which require a function call.
0049  *
0050  * This template is very similar to StandardSetterCmd but it takes a method address
0051  * instead of a field address. The method must be a setter function which returns the
0052  * old value. Example: \code
0053 qreal MyClass::Private::setZValue(qreal z) {
0054         qreal oldZ = calculateMyZValue();
0055         myZValue = z;
0056         setZValueForAllChildren(z);
0057         return oldZ;
0058 }
0059  * \endcode
0060  */
0061