Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members

/home/jeroen/FOX/fox/fox-1.7.33/include/FXMetaClass.h
00001 /********************************************************************************
00002 *                                                                               *
00003 *                         M e t a C l a s s   O b j e c t                       *
00004 *                                                                               *
00005 *********************************************************************************
00006 * Copyright (C) 1997,2012 by Jeroen van der Zijp.   All Rights Reserved.        *
00007 *********************************************************************************
00008 * This library is free software; you can redistribute it and/or modify          *
00009 * it under the terms of the GNU Lesser General Public License as published by   *
00010 * the Free Software Foundation; either version 3 of the License, or             *
00011 * (at your option) any later version.                                           *
00012 *                                                                               *
00013 * This library is distributed in the hope that it will be useful,               *
00014 * but WITHOUT ANY WARRANTY; without even the implied warranty of                *
00015 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the                 *
00016 * GNU Lesser General Public License for more details.                           *
00017 *                                                                               *
00018 * You should have received a copy of the GNU Lesser General Public License      *
00019 * along with this program.  If not, see <http://www.gnu.org/licenses/>          *
00020 ********************************************************************************/
00021 #ifndef FXMETACLASS_H
00022 #define FXMETACLASS_H
00023 
00024 namespace FX {
00025 
00026 class FXObject;
00027 
00029 enum {
00030   MINTYPE = 0,
00031   MAXTYPE = 65535
00032   };
00033 
00034 
00036 enum {
00037   MINKEY = 0,
00038   MAXKEY = 65535
00039   };
00040 
00041 
00043 typedef FXuint FXSelector;
00044 
00045 
00047 class FXAPI FXMetaClass {
00048 private:
00049   const FXchar       *className;        // Class name
00050   FXObject*         (*manufacture)();   // Factory function
00051   const FXMetaClass  *baseClass;        // Base classes' metaclass
00052   const void         *assoc;            // Associated handlers
00053   FXuint              nassocs;          // Count of handlers
00054   FXuint              assocsz;          // Size of association
00055 private:
00056   static const FXMetaClass **metaClassTable;    // Class table
00057   static FXuint              metaClassSlots;    // Number of slots
00058   static FXuint              metaClassCount;    // Number items
00059 private:
00060   static void resize(FXuint slots);
00061 public:
00062 
00064   FXMetaClass(const FXchar* name,FXObject *(fac)(),const FXMetaClass* base,const void* ass,FXuint nass,FXuint assz);
00065 
00067   FXObject* makeInstance() const;
00068 
00070   const void* search(FXSelector key) const;
00071 
00073   const FXchar* getClassName() const { return className; }
00074 
00076   const FXMetaClass* getBaseClass() const { return baseClass; }
00077 
00079   FXbool isSubClassOf(const FXMetaClass* metaclass) const;
00080 
00082   static const FXMetaClass* getMetaClassFromName(const FXchar* name);
00083 
00085  ~FXMetaClass();
00086   };
00087 
00088 }
00089 
00090 #endif

Copyright © 1997-2011 Jeroen van der Zijp