File indexing completed on 2024-04-14 04:00:14

0001 /***************************************************************************
0002                           cscript.h  -  one script
0003                              -------------------
0004     begin                : So dec 7 2002
0005     copyright            : (C) 2002 by Tomas Mecir
0006     email                : kmuddy@kmuddy.com
0007  ***************************************************************************/
0008 
0009 /***************************************************************************
0010  *                                                                         *
0011  *   This program is free software; you can redistribute it and/or modify  *
0012  *   it under the terms of the GNU General Public License as published by  *
0013  *   the Free Software Foundation; either version 2 of the License, or     *
0014  *   (at your option) any later version.                                   *
0015  *                                                                         *
0016  ***************************************************************************/
0017 
0018 #ifndef CSCRIPT_H
0019 #define CSCRIPT_H
0020 
0021 #include "csaveablefield.h"
0022 
0023 class cRunningScript;
0024 
0025 /**
0026 Information about one script.
0027   *@author Tomas Mecir
0028   */
0029 
0030 class cScript : public cSaveableField  {
0031 public: 
0032   cScript (int _sess);
0033   ~cScript () override;
0034 
0035   cSaveableField *newInstance () override;
0036 
0037   /** load data from a config file */
0038   void load (KConfig *config, const QString &group) override;
0039 
0040   /** returns type of item (light-weight RTTI) */
0041   int itemType () override { return TYPE_SCRIPT; };
0042 
0043   /** get* methods */
0044   QString getName () { return name; };
0045   QString getComment () { return comment; };
0046   QString getCommand () { return command; };
0047   QString getWorkDir () { return workdir; };
0048   QString getPrefix () { return prefix; };
0049   QString getSuffix () { return suffix; };
0050   bool getEnableInput () { return enableinput; };
0051   bool getEnableOutput () { return enablestdout; };
0052   bool getSendOutput () { return sendstdout; };
0053   bool getEnableError () { return enablestderr; }
0054   bool getSendError () { return sendstderr; }
0055   bool getSendUserCommands () { return sendusercommands; };
0056     /** prepends every line with line type (command, server output, ...) */
0057   bool getUseAdvComm () { return useadvcomm; };
0058   bool getAllowParams () { return allowparams; };
0059   bool getSingleInstance () { return singleinstance; };
0060   bool getShellExpansion () { return shellexpansion; };
0061   bool getOnlyIfMatch () { return onlyifmatch; };
0062   bool getNoFlowControl () { return noflowcontrol; };
0063   bool getAllowVars () { return allowvars; };
0064   
0065   /** set* methods */
0066   void setName (const QString &str) { name = str; };
0067   void setComment (const QString &str) { comment = str; };
0068   void setCommand (const QString &str) { command = str; };
0069   void setWorkDir (const QString &str) { workdir = str; };
0070   void setPrefix (const QString &str) { prefix = str; };
0071   void setSuffix (const QString &str) { suffix = str; };
0072   void setEnableInput (bool b) { enableinput = b; };
0073   void setEnableOutput (bool b) { enablestdout= b; };
0074   void setSendOutput (bool b) { sendstdout= b; };
0075   void setEnableError (bool b) { enablestderr = b; };
0076   void setSendError (bool b) { sendstderr = b; };
0077   void setSendUserCommands (bool b) { sendusercommands = b; };
0078     /** prepends every line with line type (command, server output, ...) */
0079   void setUseAdvComm (bool b) { useadvcomm = b; };
0080   void setAllowParams (bool b) { allowparams = b; };
0081   void setSingleInstance (bool b) { singleinstance = b; };
0082   void setShellExpansion (bool b) { shellexpansion = b; };
0083   void setOnlyIfMatch (bool b) { onlyifmatch = b; };
0084   void setNoFlowControl (bool b) { noflowcontrol = b; };
0085   void setAllowVars (bool b) { allowvars = b; };
0086 protected:
0087   /** some storeable variables */
0088   QString name, comment;
0089   QString command, workdir;
0090   QString prefix, suffix;
0091   bool enableinput, enablestdout, sendstdout, enablestderr, sendstderr;
0092   bool sendusercommands;
0093     /** prepends every line with line type (command, server output, ...) */
0094   bool useadvcomm;
0095   /** disable flow control? */
0096   bool noflowcontrol;
0097   /** is variable communication allowed? */
0098   bool allowvars;
0099   bool allowparams;
0100   bool singleinstance;
0101   bool shellexpansion;
0102   /** if there's some limiting text, this says if it must or mustn't pass */
0103   bool onlyifmatch;
0104 
0105   int sess;
0106 };
0107 
0108 #endif
0109