Name

Command — The base class for the actions performed on the document.

Synopsis

class Command
  :  : public RefCountedWrappedObjectSernaApi::RefCountedWrappedObject
 {
public:
  // construct/copy/destruct
  Command();
  Command(SernaApiBase *);
  ~Command();

  // public member functions

  void execute() ;
  void unexecute() ;
  bool isExecuted() const;
  SString info(unsigned int) const;
  unsigned short getUdata() const;
  void setUdata(unsigned) ;
  GroveCommand asGroveCommand() const;
  Command firstChild() const;
  Command lastChild() const;
  Command getChild(int) const;
  int countChildren() const;
  void appendChild(const Command &) ;
  void removeAllChildren() ;
  Command nextSibling() const;
  Command prevSibling() const;
  Command parent() const;
  Command root() const;
  void remove() ;
  void insertBefore(const Command &) ;
  void insertAfter(const Command &) ;
  void removeGroup(const Command &) ;
  int siblingIndex() const;
  SString getTreelocString(const Command & = Command()) const;
  Command getByTreelocString(const SString &) const;
  void doExecute() ;
  void doUnexecute() ;
};

Description

Command construct/copy/destruct

  1. Command();

    If constructed w/o args, then custom Command is created (user must redefine doExecute()/doUnexecute())


  2. Command(SernaApiBase * );


  3. ~Command();


Command public member functions

  1. void execute() ;

    Execute the command.


  2. void unexecute() ;

    Un-execute (undo) the command.


  3. bool isExecuted() const;

    Returns TRUE if command is already executed.


  4. SString info(unsigned int argIndex) const;

    Additional command info, as seen in undo/redo list. For null value of argIndex the info string itself is returned; non-zero values are used to access optional arguments. When there is no argument for any given index, null string is returned.


  5. unsigned short getUdata() const;

    Get custom user data on the command.


  6. void setUdata(unsigned short) ;

    Set custom user data on the command.


  7. GroveCommand asGroveCommand() const;

    If the current command was created by the GroveEditor, it may be of GroveCommand type. GroveCommands contain some additional information such as current position, etc.


  8. Command firstChild() const;


  9. Command lastChild() const;


  10. Command getChild(int n) const;


  11. int countChildren() const;


  12. void appendChild(const Command & ) ;


  13. void removeAllChildren() ;


  14. Command nextSibling() const;


  15. Command prevSibling() const;


  16. Command parent() const;


  17. Command root() const;


  18. void remove() ;


  19. void insertBefore(const Command & ) ;


  20. void insertAfter(const Command & ) ;


  21. void removeGroup(const Command & ) ;


  22. int siblingIndex() const;


  23. SString getTreelocString(const Command & = Command()) const;


  24. Command getByTreelocString(const SString & ) const;


  25. void doExecute() ;

    Allows to redefine behaviour of original command. Used only when Command was constructed w/o arguments. THESE FUNCTIONS SHOULD NEVER BE CALLED DIRECTLY. USE execute() AND unexecute() INSTEAD.


  26. void doUnexecute() ;

    Allows to redefine behaviour of original command. Used only when Command was constructed w/o arguments. THESE FUNCTIONS SHOULD NEVER BE CALLED DIRECTLY. USE execute() AND unexecute() INSTEAD.