Relacs  0.9.8
Public Types | Public Slots | Public Member Functions | Static Public Member Functions | Static Public Attributes | Friends | List of all members
Macro Class Reference

#include <macros.h>

Inheritance diagram for Macro:
Inheritance graph
[legend]
Collaboration diagram for Macro:
Collaboration graph
[legend]

Public Types

typedef deque< MacroCommand * >
::iterator 
iterator
 

Public Slots

void run (void)
 
void launch (void)
 
void popup (void)
 
void dialog (void)
 
void acceptDialog (void)
 
void dialogAction (int r)
 
void dialogClosed (int r)
 

Public Member Functions

 Macro (void)
 
 Macro (Str name, Macros *mcs)
 
 Macro (const Macro &macro)
 
string name (void) const
 
Optionsvariables (void)
 
string variablesStr (void) const
 
void addParameter (const Str &param)
 
string expandParameter (const Str &params) const
 
int action (void) const
 
void setAction (int action)
 
void delAction (int action)
 
bool button (void) const
 
MacroButtonpushButton (void) const
 
void addButton (const string &keys)
 
bool menu (void) const
 
void addMenu (QMenu *menu, int &num)
 
string menuStr (void) const
 
bool key (void) const
 
string setKey (int &index)
 
void clear (void)
 
bool keep (void) const
 
bool overwrite (void) const
 
int size (void) const
 
MacroCommandcommand (int index)
 
void push (MacroCommand *mc)
 
iterator begin (void)
 
iterator end (void)
 
string load (ifstream &macrostream, string &line, int &linenum, string &warnings)
 
void check (string &warnings)
 
void checkOptions (string &warnings)
 
void setMacroIndices (void)
 
void init (int macronum)
 
void reloadRePro (RePro *repro)
 
void clearButton (void)
 
void setRunButton (void)
 
void setStackButton (bool base)
 

Static Public Member Functions

static void createIcons (int size)
 
static void destroyIcons (void)
 

Static Public Attributes

static const int StartUp = 0x01
 
static const int ShutDown = 0x02
 
static const int FallBack = 0x04
 
static const int ExplicitFallBack = 0x08
 
static const int StartSession = 0x10
 
static const int StopSession = 0x20
 
static const int NoMacro = 0x40
 

Friends

ostream & operator<< (ostream &str, const Macro &macro)
 

Detailed Description

A single Macro.

Member Typedef Documentation

typedef deque<MacroCommand*>::iterator iterator

Iterator used to iterate through the commands.

Constructor & Destructor Documentation

Macro ( void  )

Default constructor.

Macro ( Str  name,
Macros mcs 
)
Macro ( const Macro macro)

Copy constructor.

Member Function Documentation

string name ( void  ) const

The name of the macro.

Referenced by Macro::addMenu(), MacroCommand::check(), and Macro::expandParameter().

Options & variables ( void  )

Returns the macro variables.

Referenced by MacroCommand::dialog(), MacroCommand::run(), and MacroCommand::start().

string variablesStr ( void  ) const

Returns the macro variables as a string.

References Options::save(), and Options::size().

void addParameter ( const Str param)

Add parameter from param to the macros variables.

References Options::load(), and Options::setToDefaults().

Referenced by Macro::Macro().

string expandParameter ( const Str params) const
int action ( void  ) const

The type of action on which this macro is executed.

Referenced by MacroCommand::execute(), relacs::operator<<(), and Macro::setAction().

void setAction ( int  action)

Set the Macro's action flag to action.

References Macro::action().

void delAction ( int  action)

Delete the action flag action from the Macro's action.

bool button ( void  ) const

True if this Macro has a button.

Referenced by relacs::operator<<().

MacroButton * pushButton ( void  ) const

The button of the macro.

void addButton ( const string &  keys)

Add button for the macro and its commands to menu.

References Macro::clearButton(), Macro::launch(), and Macro::popup().

bool menu ( void  ) const

True if this Macro has a menu.

Referenced by relacs::operator<<().

void addMenu ( QMenu *  menu,
int &  num 
)

Add menu for the macro and its commands to menu. num counts the number of macro menus (not each macro gets a menu!).

References Macro::dialog(), Options::empty(), Macro::menuStr(), Macro::name(), and Macro::run().

string menuStr ( void  ) const

Forms a string for the menu consisting of the macro name and its variables.

References Options::FirstOnly, Macros::MenuWidth, Options::save(), and Options::size().

Referenced by Macro::acceptDialog(), and Macro::addMenu().

bool key ( void  ) const

True if this Macro has a shortcut key.

string setKey ( int &  index)

Set a shortcut key for the Macro and return it as a string.

References Macro::FallBack.

void clear ( void  )

Clear menu and button.

bool keep ( void  ) const

True if this Macro is not to be cleared.

bool overwrite ( void  ) const

True if this Macro overwrites existing ones.

int size ( void  ) const

The number of commands the macro owns.

Referenced by MacroCommand::addMenu(), and relacs::operator<<().

MacroCommand * command ( int  index)

The index -th command of this Macro .

void push ( MacroCommand mc)

Add the command mc to the list of commands.

Macro::iterator begin ( void  )

Returns an iterator pointing to the first command pointer.

Macro::iterator end ( void  )

Returns an iterator pointing behind the last command pointer.

string load ( ifstream &  macrostream,
string &  line,
int &  linenum,
string &  warnings 
)

Load commands from a file until a new macro definition is encountered. Returns the stripped line and in line the full line containing the macro definition or macro parameter. linenum holds the current line number and is incremented whenever load() reads a line. Warnings are appended tp warnings .

References MacroCommand::BrowseCom, MacroCommand::command(), MacroCommand::DetectorCom, Str::empty(), MacroCommand::FilterCom, Str::find(), relacs::line(), MacroCommand::MessageCom, MacroCommand::name(), MacroCommand::parameter(), MacroCommand::setReProCommand(), MacroCommand::ShellCom, MacroCommand::ShutdownCom, MacroCommand::StartSessionCom, MacroCommand::StopSessionCom, Str::strip(), MacroCommand::SwitchCom, MacroCommand::UnknownCom, and Str::WhiteSpace.

void check ( string &  warnings)

Check and expand commands. Warnings are appended tp warnings .

References Str::find(), Str::findBracket(), Str::mid(), Str::replace(), MacroCommand::ReProCom, and MacroCommand::setParameter().

void checkOptions ( string &  warnings)

Check options for repros. Warnings are appended tp warnings .

void setMacroIndices ( void  )

Set the indices of macro commands.

References Macros::index(), and MacroCommand::MacroCom.

void init ( int  macronum)

Initialize the number of this macro and the command numbers.

void reloadRePro ( RePro repro)

Update the macro for the reloaded repro repro.

void clearButton ( void  )

Unset running or stack icons.

References Macro::StartSession.

Referenced by Macro::addButton().

void setRunButton ( void  )

Set the icon indicating a running macro.

void setStackButton ( bool  base)

Set the icon indicating the stack position.

void createIcons ( int  size)
static

Generates some icons.

See Also
destroyIcons()

Referenced by Macros::Macros().

void destroyIcons ( void  )
static

Frees the icons.

See Also
createIcons()

Referenced by Macros::~Macros().

void run ( void  )
slot

Runs this macro.

References RELACSWidget::displayData(), Macro::launch(), and Macros::RW.

Referenced by Macro::addMenu().

void launch ( void  )
slot

Stops the currently running repro and starts this macro.

References Macro::FallBack, Options::setDefaults(), Macros::startMacro(), and Macros::store().

Referenced by Macro::addButton(), and Macro::run().

void popup ( void  )
slot

Open the popup menu right above the macro's button.

Referenced by Macro::addButton().

void dialog ( void  )
slot
void acceptDialog ( void  )
slot

Accept the edited input from the dialog.

References Macro::menuStr(), and Options::setToDefaults().

Referenced by Macro::dialog().

void dialogAction ( int  r)
slot

Runs a macro for r==2.

References Macros::startMacro().

Referenced by Macro::dialog().

void dialogClosed ( int  r)
slot

Unsets the DialogOpen flag.

Referenced by Macro::dialog().

Friends And Related Function Documentation

ostream& operator<< ( ostream &  str,
const Macro macro 
)
friend

Write information of the Macro to str.

Member Data Documentation

const int StartUp = 0x01
static

This Macro is the startup Macro.

Referenced by Macros::check(), Macro::Macro(), and relacs::operator<<().

const int ShutDown = 0x02
static

This Macro is the shutdown Macro.

Referenced by Macros::check(), Macro::Macro(), and relacs::operator<<().

const int FallBack = 0x04
static
const int ExplicitFallBack = 0x08
static

This Macro explicitly requested to be the fallback Macro.

Referenced by RePros::activateRePro(), and Macro::Macro().

const int StartSession = 0x10
static

This Macro is the startsession Macro.

Referenced by Macros::check(), Macro::clearButton(), Macro::Macro(), and relacs::operator<<().

const int StopSession = 0x20
static

This Macro is the stopsession Macro.

Referenced by Macros::check(), Macro::Macro(), and relacs::operator<<().

const int NoMacro = 0x40
static

This is no Macro.

Referenced by ReProData::start().


The documentation for this class was generated from the following files: