File indexing completed on 2024-04-14 03:59:59

0001 //
0002 // C++ Interface: ctrigger
0003 //
0004 // Description: one trigger
0005 //
0006 /*
0007 Copyright 2002-2011 Tomas Mecir <kmuddy@kmuddy.com>
0008 
0009 This program is free software; you can redistribute it and/or
0010 modify it under the terms of the GNU General Public License as
0011 published by the Free Software Foundation; either version 2 of 
0012 the License, or (at your option) any later version.
0013 
0014 This program is distributed in the hope that it will be useful,
0015 but WITHOUT ANY WARRANTY; without even the implied warranty of
0016 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0017 GNU General Public License for more details.
0018 
0019 You should have received a copy of the GNU General Public License
0020 along with this program.  If not, see <http://www.gnu.org/licenses/>.
0021 */
0022 
0023 #ifndef CTRIGGER_H
0024 #define CTRIGGER_H
0025 
0026 class cTriggerList;
0027 
0028 #include <clistobject.h>
0029 
0030 #include <qcolor.h>
0031 
0032 #include <map>
0033 
0034 using namespace std;
0035 
0036 /**
0037 One trigger.
0038   *@author Tomas Mecir
0039   */
0040 
0041 class cTrigger : public cListObject {
0042 public:
0043   ~cTrigger () override;
0044 
0045 protected:
0046   friend class cTriggerList;
0047   cTrigger (cList *list);
0048 
0049   /** React on an attribute change by updating the pattern object. */
0050   void attribChanged (const QString &name) override;
0051 
0052   void updateVisibleName() override;
0053 
0054 #define TRIGGER_MATCH 1
0055 
0056   cList::TraverseAction traverse (int traversalType) override;
0057 
0058   /** Perform trigger matching. */
0059   cList::TraverseAction doMatch ();
0060 
0061   bool testCondition ();
0062 
0063   /** Execute the trigger. */
0064   void executeTrigger ();
0065 
0066   // TODO: methods to manipulate colorizations ? Would be used by scripting ...
0067 
0068   /** compute new colors and recolorize the line */
0069   void recolorize ();
0070   /** replace old text with new text */
0071   void rewrite ();
0072 
0073   struct Private;
0074   Private *d;
0075 };
0076 
0077 #endif  // CTRIGGER_H
0078