File indexing completed on 2024-04-21 15:08:18

0001 //
0002 // C++ Interface: caliaslist
0003 //
0004 // Description: 
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 CALIASLIST_H
0024 #define CALIASLIST_H
0025 
0026 #include <clist.h>
0027 
0028 #include <QStringList>
0029 
0030 #include <kmuddy_export.h>
0031 
0032 /**
0033 A list of aliases.
0034   *@author Tomas Mecir
0035   */
0036 
0037 class KMUDDY_EXPORT cAliasList : public cList {
0038 public: 
0039   cAliasList ();
0040   ~cAliasList () override;
0041 
0042   static cList *newList () { return new cAliasList; };
0043   cListObject *newObject () override;
0044   QString objName () override { return "Alias"; }
0045   cListEditor *editor (QWidget *parent) override;
0046 
0047   bool matchString (const QString &string);
0048   QStringList commandsToExec ();
0049 
0050 protected:
0051   friend class cAlias;
0052   struct Private;
0053   Private *d;
0054 
0055   /** String that's to be matched - used by cAlias. */
0056   QString stringToMatch ();
0057   /** Original command should also be sent - used by cAlias. */
0058   void wantOriginalCommand ();
0059   /** At least one alias has matched - used by cAlias.  */
0060   void setMatched ();
0061   /** Add a replacement command to execute - used by cAlias. */
0062   void addCommand (const QString &command);
0063   /** Check alias condition.  */
0064   void checkCondition (const QString &condition);
0065 };
0066 
0067 #endif