Commands manager. More...
#include <rexscript.h>
Inheritance diagram for bbb::RexScript:Classes | |
| struct | CallStackEntry |
| a call stack entry More... | |
| struct | CmdEntry |
| an entry for a command / type of entry More... | |
| struct | CmdFile |
| an entry for a source file More... | |
Public Types | |
| enum | LogTypes { LOG_DEBUG = 0x00000, LOG_FILES = 0x00001, LOG_COMMANDS = 0x00004, LOG_ALL } |
| bitmask for types of messages that are being logged More... | |
| enum | LinesSpecial { LINE_START = -1, LINE_END = -2 } |
| special codes for CmdFile::line_crt_ More... | |
| enum | EndOfRun { CallQuit, CallBack, CallSignal, CallNoOne } |
| the way we end a run More... | |
| typedef bool(* | cmdRoutine )(RexScript *rexs, const CmdEntry &cmd) |
| callback type used with commands in the files | |
| typedef void(* | EndOfRunCallback )(RexScript *rex) |
| the type of callback to use | |
Signals | |
| void | endOfTheRun (void) |
| raised when RexScript::endProcessing() is called, if selected | |
Public Member Functions | |
| RexScript (const QStringList &init_files, const VarMap &var_map=VarMap()) | |
| constructor; | |
| virtual | ~RexScript (void) |
| destructor; | |
| bool | start (void) |
| prepares the instance and starts the timer | |
| bool | stop (void) |
| calls end(); returns false if not running | |
| const QStringList & | initFiles (void) const |
| initial list of source files | |
| QString | crtFile (void) |
| tell current file as a path | |
| QString | crtRawLine (void) |
| raw line that is being executed | |
| RexScriptBlock * | crtBlock (void) |
| current block | |
| QString | rawLine (int i_file, int i_line) |
| raw line | |
| void | setCurrentLine (int i) |
| set current line to be executed | |
| const RexScript::CallStackEntry & | currentStackEntry (void) |
| get a reference to current entry in the stack | |
| bool | isStackEmpty (void) const |
| tell if the stack is empty | |
| bool | stackSize (void) const |
| tell if the size of the stack | |
| bool | inBlock (void) |
| tell if we're in a block or not | |
| int | returnValue (void) const |
| the value returned as program result, if used as such | |
| bool | isRunning (void) const |
| are we running right now? | |
| QString | tempStoragePath (void) const |
| get path to temporary storage path | |
| QString | getTempPath (const QString &s) |
| get path to temporary storage path | |
| bool | isLogTypeOn (int id_type) const |
| tell if a certain log type is enabled | |
| EndOfRun | typeOfEnd (void) const |
| tell the type of end to perform | |
| RexScriptBlock * | blockInStack (int i) const |
| reference to a block | |
Static Public Member Functions | |
Utilities | |
General purpose methods used from various places inside the project | |
| static QString | toUnixName (const QString &s) |
| converts input text into a unix name by keeping only letters and digits | |
| static QString | toProperName (const QString &s) |
| capitalizes first letter in each word (separated by spaces, that is) | |
| static QString | unixToCamelCase (const QString &s, bool first_upper=true) |
| converts input text into CamelCase, given that the input is in unix format More... | |
Public Attributes | |
| VarMap | vars_ |
| variables | |
| void | setEndQuit (void) |
| void | setEndCallBack (EndOfRunCallback kb) |
| void | setEndSignal (void) |
| void | setEndQuiet (void) |
| void | prependCmd (const CmdEntry &cmd) |
| add a command to the top of our list (searched early) | |
| void | appendCmd (const CmdEntry &cmd) |
| add a command to the end of our list (searched late) | |
| CmdEntry & | command (int i) |
| command at an index | |
| void | setLogTypeOn (int id_type) |
| enable a certain log type | |
| void | setLogTypeOff (int id_type) |
| disable a certain log type | |
| bool | appendLineToBlock (const QString &s) |
| append a line to current block | |
| void | fileError (const QString &s_text) |
| prints an error for current file | |
| void | blockError (const QString &s_text, int line=-1) |
| prints an error for current block | |
| void | error (const QString &s_text) |
| prints an error | |
| void | error (const QString &s_title, const QString &s_text) |
| prints an error | |
| void | errorContin (const QString &s_text) |
| prints an error continuation | |
| void | errorInRexScriptBlock (void) |
| prints an error | |
| void | error (const QString &s_file, int i_line, const QString &s_line, const QString &s_text) |
| prints an error for given file, line number and content | |
| void | warning (const QString &s_title, const QString &s_text) |
| prints a warning | |
| void | info (const QString &s_text) |
| prints an information | |
| void | log (int ty, const QString &s_text) |
| prints an informative message | |
| void | logFromFile (int ty, const QString &s_text) |
| prints an informative message and current location in file | |
| void | fileDecoration (void) |
| prints current location in file and the route to it | |
| void | blockDecoration (void) |
| prints current location in block and the route to it | |
| void | startBlock (RexScriptBlock *b) |
| start a block | |
| bool | endBlock (void) |
| end current block | |
| bool | helperOnOff (const QString &s_cmd, const QString &s_val, bool &b_on) |
| helper for ON/OFF switch | |
| void | helperLogChange (int ty, bool b_on) |
| activates or deactivates the logging of specific type | |
| virtual bool | helperLogType (const QString &s_val, int &ty) |
| get logging type from a string | |
| virtual QString | interpret (const QString &s_in, bool &b_ok, VarMap *vm=NULL) |
| interpret content between special markers in control file More... | |
| virtual bbb::VarData * | getVarData (const QString &s, bool b_create=true) |
| get a variable identified by a pattern More... | |
| virtual bool | delVariable (const QString &s) |
| delete a variable | |
| int | getIndex (VarData *vd, const QString &s) |
| get the index inside a variable | |
| QString | getPath (const QString &s) |
| get the path of a file (relative to current file) | |
| bool | getExpression (const QString &s, QString &s_res) |
| computes an expression and returns the result | |
| bool | processFile (const QString &s_file) |
| starts processing the file | |
| bool | processStack (void) |
| next step in the stack | |
| bool | processLine (const QString &s_line) |
| process one line | |
| bool | processBlock (RexScriptBlock *blk, const QString &s_line) |
| process one line in a block; used by RexScriptBlock | |
| QString | replaceVars (const QString &s_line) |
| replace variables in control file lines | |
| void | timerEvent (QTimerEvent *event) |
| fired on regular intervals when started | |
Commands manager.
|
virtual |
get a variable identified by a pattern
This method is used with commands that take variable names as arguments (like the SET's first argument).
| s | the string to be interpreted |
| b_create | if the name is not found, should a new structure be created? |
|
virtual |
interpret content between special markers in control file
By default the content is regarded as the name of a variable; inheritants may change this behaviour using this method and returning true in b_ok member.
| s_in | the input string |
| b_ok | set to true if the string was understood, false to report an error |
| vm | the variable map to use; if NULL or ommited it defaults to vars_ member. |
|
inline |
set the type of run
|
inline |
set the type of run
|
inline |
set the type of run
|
inline |
set the type of run
|
static |
converts input text into CamelCase, given that the input is in unix format
Folloving text: some_name_here is converted to SomeNameHere
| s | unix name |
| first_upper | should we capitalise first letter, too? |