lib

class.h

00001 /***************************************************************************
00002  * class.h
00003  * This file is part of the KDE project
00004  * copyright (C)2004-2005 by Sebastian Sauer (mail@dipe.org)
00005  *
00006  * This program is free software; you can redistribute it and/or
00007  * modify it under the terms of the GNU Library General Public
00008  * License as published by the Free Software Foundation; either
00009  * version 2 of the License, or (at your option) any later version.
00010  * This program is distributed in the hope that it will be useful,
00011  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013  * Library General Public License for more details.
00014  * You should have received a copy of the GNU Library General Public License
00015  * along with this program; see the file COPYING.  If not, write to
00016  * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00017  * Boston, MA 02110-1301, USA.
00018  ***************************************************************************/
00019 
00020 #ifndef KROSS_API_CLASS_H
00021 #define KROSS_API_CLASS_H
00022 
00023 #include <qstring.h>
00024 //#include <qvaluelist.h>
00025 //#include <qmap.h>
00026 #include <qobject.h>
00027 
00028 //#include "../main/krossconfig.h"
00029 #include "object.h"
00030 #include "event.h"
00031 #include "list.h"
00032 #include "exception.h"
00033 #include "variant.h"
00034 
00035 namespace Kross { namespace Api {
00036 
00043     template<class T>
00044     class Class : public Event<T>
00045     {
00046         public:
00047 
00051             typedef KSharedPtr<T> Ptr;
00052 
00058             Class(const QString& name)
00059                 : Event<T>(name)
00060             {
00061             }
00062 
00066             virtual ~Class()
00067             {
00068             }
00069 
00070             template<typename TYPE>
00071             static Object::Ptr toObject(TYPE t) { return t; }
00072 
00073             operator T* () { return (T*)this; }
00074             //operator Ptr () { return (T*)this; }
00075 
00076             /*
00077             virtual Object::Ptr call(const QString& name, List::Ptr arguments)
00078             {
00079                 krossdebug( QString("Class::call(%1)").arg(name) );
00080                 return Event<T>::call(name, arguments);
00081             }
00082             */
00083 
00084     };
00085 
00086 }}
00087 
00088 #endif
00089 
KDE Home | KDE Accessibility Home | Description of Access Keys