~ubuntu-branches/ubuntu/trusty/kvirc/trusty

« back to all changes in this revision

Viewing changes to src/kvirc/kvs/kvi_kvs_object_class.h

  • Committer: Bazaar Package Importer
  • Author(s): Kai Wasserbäch, Kai Wasserbäch, Raúl Sánchez Siles
  • Date: 2011-02-12 10:40:21 UTC
  • mfrom: (14.1.3 sid)
  • Revision ID: james.westby@ubuntu.com-20110212104021-5mh4f75jlku20mnt
The combined "Twisted Experiment" and "Nocturnal Raid" release.

[ Kai Wasserbäch ]
* Synced to upstream's SVN revision 5467.
* debian/rules:
  - Added .PHONY line.
  - Resurrect -DMANUAL_REVISION, got lost somewhere and we build SVN
    revisions again.
  - Replace "-DWITH_NO_EMBEDDED_CODE=YES" with "-DWANT_CRYPTOPP=YES".
  - Change the remaining -DWITH/-DWITHOUT to the new -DWANT syntax.
* debian/control:
  - Removed DMUA, I'm a DD now.
  - Changed my e-mail address.
  - Removed unneeded relationships (no upgrades over two releases are
    supported).
  - Fix Suggests for kvirc-dbg.
  - kvirc-data: Make the "Suggests: kvirc" a Recommends, doesn't make much
    sense to install the -data package without the program.
* debian/source/local-options: Added with "unapply-patches".
* debian/kvirc.lintian-overrides: Updated to work for 4.1.1.
* debian/patches/21_make_shared-mime-info_B-D_superfluous.patch: Updated.
* debian/kvirc-data.install: Added .notifyrc.

[ Raúl Sánchez Siles ]
* Stating the right version where kvirc-data break and replace should happen.
* Fixing link to license file.
* Added French and Portuguese man pages.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#ifndef _KVI_KVS_OBJECTCLASS_H_
2
 
#define _KVI_KVS_OBJECTCLASS_H_
3
 
//=============================================================================
4
 
//
5
 
//   File : kvi_kvs_objectclass.h
6
 
//   Creation date : Sat 23 Apr 2005 20:31:32 by Szymon Stefanek
7
 
//
8
 
//   This file is part of the KVIrc IRC client distribution
9
 
//   Copyright (C) 2005-2008 Szymon Stefanek <pragma at kvirc dot net>
10
 
//
11
 
//   This program is FREE software. You can redistribute it and/or
12
 
//   modify it under the terms of the GNU General Public License
13
 
//   as published by the Free Software Foundation; either version 2
14
 
//   of the License, or (at your opinion) any later version.
15
 
//
16
 
//   This program is distributed in the HOPE that it will be USEFUL,
17
 
//   but WITHOUT ANY WARRANTY; without even the implied warranty of
18
 
//   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
19
 
//   See the GNU General Public License for more details.
20
 
//
21
 
//   You should have received a copy of the GNU General Public License
22
 
//   along with this program. If not, write to the Free Software Foundation,
23
 
//   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
24
 
//
25
 
//=============================================================================
26
 
 
27
 
#include "kvi_settings.h"
28
 
#include "kvi_qstring.h"
29
 
#include "kvi_pointerlist.h"
30
 
 
31
 
#include "kvi_pointerhashtable.h"
32
 
 
33
 
#include "kvi_kvs_object_functionhandler.h"
34
 
 
35
 
class KviKvsObject;
36
 
class KviKvsObjectClass;
37
 
class KviKvsRunTimeContext;
38
 
class KviKvsVariantList;
39
 
class KviKvsVariant;
40
 
// Object allocation function
41
 
// parameters are: the class, the parent object (eventually 0), the object name (eventually empty)
42
 
typedef KviKvsObject * (*KviKvsObjectAllocateInstanceProc)(KviKvsObjectClass *,KviKvsObject *,const QString &);
43
 
 
44
 
// An object function callback
45
 
typedef bool (KviKvsObject::*KviKvsObjectFunctionHandlerProc)(KviKvsObjectFunctionCall * pCall);
46
 
 
47
 
 
48
 
// The descriptor of a kvirc object class
49
 
 
50
 
class KVIRC_API KviKvsObjectClass
51
 
{
52
 
        friend class KviKvsObject;
53
 
        friend class KviKvsObjectController;
54
 
public:
55
 
        KviKvsObjectClass(
56
 
                        KviKvsObjectClass * pParent,            // parent class
57
 
                        const QString & szName,                 // class name
58
 
                        KviKvsObjectAllocateInstanceProc proc,  // intance allocation proc
59
 
                        bool bBuiltin = true                    // this is a builtin or script based class ?
60
 
                );
61
 
        ~KviKvsObjectClass();
62
 
protected:
63
 
        KviKvsObjectClass                           * m_pParentClass;      // the parent (base) class
64
 
        QString                                       m_szName;            // the class name
65
 
        bool                                          m_bBuiltin;          // is this a builtin or script based class ?
66
 
        KviPointerHashTable<QString,KviKvsObjectFunctionHandler>          * m_pFunctionHandlers; // all our function handlers
67
 
        KviPointerList<KviKvsObjectClass>               * m_pChildClasses;     //
68
 
        KviKvsObjectAllocateInstanceProc              m_allocProc;
69
 
        bool                                          m_bDirty;            // not yet flushed to disk (only for not builtin classes)
70
 
protected:
71
 
        void registerChildClass(KviKvsObjectClass *pClass);
72
 
        void unregisterChildClass(KviKvsObjectClass *pClass);
73
 
        KviPointerHashTable<QString,KviKvsObjectFunctionHandler> * functionHandlers(){ return m_pFunctionHandlers; };
74
 
public:
75
 
        void clearDirtyFlag(){ m_bDirty = false; };
76
 
        bool isDirty(){ return m_bDirty; };
77
 
        bool isBuiltin(){ return m_bBuiltin; };
78
 
        bool isScriptHandler(const QString & szFunctionName)
79
 
        {
80
 
            KviKvsObjectFunctionHandler *pFunctionHandler=m_pFunctionHandlers->find(szFunctionName);
81
 
            if (pFunctionHandler) return pFunctionHandler->isScriptHandler();
82
 
            else return false;
83
 
        };
84
 
        const QString & name(){ return m_szName; };
85
 
        KviKvsObjectClass * parentClass(){ return m_pParentClass; };
86
 
        // pProc CAN'T be zero here!
87
 
        void registerFunctionHandler(const QString & szFunctionName,KviKvsObjectFunctionHandlerProc pProc,unsigned int uFlags = 0);
88
 
        void registerFunctionHandler(const QString & szFunctionName,const QString &szBuffer,unsigned int uFlags = 0);
89
 
 
90
 
        // registers an empty handler that returns "nothing"
91
 
        void registerStandardNothingReturnFunctionHandler(const QString & szFunc);
92
 
        // retisters an empty handler that returns $true
93
 
        void registerStandardTrueReturnFunctionHandler(const QString & szFunc);
94
 
        // retisters an empty handler that returns $false
95
 
        void registerStandardFalseReturnFunctionHandler(const QString & szFunc);
96
 
 
97
 
        KviKvsObjectFunctionHandler * lookupFunctionHandler(const QString & szFunc){ return m_pFunctionHandlers->find(szFunc); };
98
 
        KviKvsObject * allocateInstance(KviKvsObject * pParent,const QString &szName,KviKvsRunTimeContext * pContext,KviKvsVariantList * pParams);
99
 
 
100
 
        bool save(const QString &szFileName);
101
 
        static bool load(const QString &szFileName);
102
 
        void getFunctionCode(QString &szCode,KviKvsObjectFunctionHandler &h);
103
 
        KviPointerHashTable<QString,KviKvsObjectFunctionHandler> * getHandlers(){return m_pFunctionHandlers;};
104
 
 
105
 
};
106
 
 
107
 
 
108
 
#endif //!_KVI_KVS_OBJECTCLASS_H_