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

FXMetaClass.h
1 /********************************************************************************
2 * *
3 * M e t a C l a s s O b j e c t *
4 * *
5 *********************************************************************************
6 * Copyright (C) 1997,2017 by Jeroen van der Zijp. All Rights Reserved. *
7 *********************************************************************************
8 * This library is free software; you can redistribute it and/or modify *
9 * it under the terms of the GNU Lesser General Public License as published by *
10 * the Free Software Foundation; either version 3 of the License, or *
11 * (at your option) any later version. *
12 * *
13 * This library is distributed in the hope that it will be useful, *
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
16 * GNU Lesser General Public License for more details. *
17 * *
18 * You should have received a copy of the GNU Lesser General Public License *
19 * along with this program. If not, see <http://www.gnu.org/licenses/> *
20 ********************************************************************************/
21 #ifndef FXMETACLASS_H
22 #define FXMETACLASS_H
23 
24 namespace FX {
25 
26 
27 class FXObject;
28 
29 
31 enum {
32  MINTYPE = 0,
33  MAXTYPE = 65535
34  };
35 
36 
38 enum {
39  MINKEY = 0,
40  MAXKEY = 65535
41  };
42 
43 
45 typedef FXuint FXSelector;
46 
47 
49 class FXAPI FXMetaClass {
50 private:
51  const FXchar *className; // Class name
52  FXObject* (*manufacture)(); // Factory function
53  const FXMetaClass *baseClass; // Base classes' metaclass
54  const void *assoc; // Associated handlers
55  FXuint nassocs; // Count of handlers
56  FXuint assocsz; // Size of association
57 private:
58  static const FXMetaClass **metaClassTable; // Class table
59  static FXuint metaClassSlots; // Number of slots
60  static FXuint metaClassCount; // Number items
61 private:
62  static void resize(FXuint slots);
63 public:
64 
66  FXMetaClass(const FXchar* name,FXObject *(fac)(),const FXMetaClass* base,const void* ass,FXuint nass,FXuint assz);
67 
69  FXObject* makeInstance() const;
70 
72  const void* search(FXSelector key) const;
73 
75  const FXchar* getClassName() const { return className; }
76 
78  const FXMetaClass* getBaseClass() const { return baseClass; }
79 
81  FXbool isSubClassOf(const FXMetaClass* metaclass) const;
82 
84  static const FXMetaClass* getMetaClassFromName(const FXchar* name);
85 
87  static FXObject* nullObject();
88 
90  ~FXMetaClass();
91  };
92 
93 }
94 
95 #endif

Copyright © 1997-2016 Jeroen van der Zijp