Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/Actions/Action.hpp

    r10fa1d re4afb4  
    1111#include <string>
    1212#include <boost/shared_ptr.hpp>
     13
     14/** Used in .def files in paramdefaults define to set that no default value exists.
     15 * We define NODEFAULT here, as it is used in .def files and needs to be present
     16 * before these are included.
     17 */
     18#define NODEFAULT std::string()
    1319
    1420// forward declaration
     
    1723class ActionSequence;
    1824class Dialog;
     25
     26#include "Actions/ActionTraits.hpp"
    1927
    2028/**
     
    294302 */
    295303
     304
    296305/**
    297306 * Base class for all actions.
     
    319328   * be registered with the ActionRegistry. If the Action is registered the name of the
    320329   * Action needs to be unique for all Actions that are registered.
    321    */
    322   Action(std::string _name,bool _doRegister=true);
     330   *
     331   * \note NO reference for \a _Traits as we do have to copy it, otherwise _Traits would have
     332   * to be present throughout the program's run.
     333   *
     334   * \param Traits information class to this action
     335   * \param _doRegister whether to register with ActionRegistry
     336   */
     337  Action(const ActionTraits &_Traits, bool _doRegister=true);
    323338  virtual ~Action();
    324339
     
    363378   * Returns the name of the Action.
    364379   */
    365   virtual const std::string getName();
     380  const std::string getName();
     381
     382  /**
     383   * Traits resemble all necessary information that "surrounds" an action, such as
     384   * its name (for ActionRegistry and as ref from string to instance and vice versa),
     385   * which menu, which position, what parameters, their types, if it is itself a
     386   * parameter and so on ...
     387   *
     388   * Note that is important that we do not use a reference here. We want to copy the
     389   * information in the Action's constructor and have it contained herein. Hence, we
     390   * also have our own copy constructor for ActionTraits. Information should be
     391   * encapsulated in the Action, no more references to the outside than absolutely
     392   * necessary.
     393   */
     394  const ActionTraits Traits;
    366395
    367396protected:
     
    440469   */
    441470  virtual state_ptr performRedo(state_ptr)=0;
    442 
    443   std::string name;
    444471};
    445472
Note: See TracChangeset for help on using the changeset viewer.