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,2024 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 
30 typedef FXuint FXSelector;
31 
32 
34 class FXAPI FXMetaClass {
35 private:
36  const FXchar *className; // Class name
37  FXObject* (*manufacture)(); // Factory function
38  const FXMetaClass *baseClass; // Base classes' metaclass
39  const void *assoc; // Associated handlers
40  FXuint nassocs; // Count of handlers
41  FXuint assocsz; // Size of association
42 private:
43  static const FXMetaClass **metaClassTable; // Class table
44  static FXuint metaClassSlots; // Number of slots
45  static FXuint metaClassCount; // Number items
46 private:
47  static void resize(FXuint slots);
48 public:
49  static void dumpMessageMap(const FXMetaClass* m);
50  static void dumpMetaClasses();
51 private:
52  FXMetaClass(const FXMetaClass&);
53  FXMetaClass &operator=(const FXMetaClass&);
54 public:
55 
57  FXMetaClass(const FXchar* name,FXObject *(fac)(),const FXMetaClass* base,const void* ass,FXuint nass,FXuint assz);
58 
60  const void* search(FXSelector key) const;
61 
63  const FXchar* getClassName() const { return className; }
64 
66  const FXMetaClass* getBaseClass() const { return baseClass; }
67 
69  FXbool isSubClassOf(const FXMetaClass* metaclass) const;
70 
72  static const FXMetaClass* getMetaClassFromName(const FXchar* name);
73  static const FXMetaClass* getMetaClassFromName(const FXString& name);
74 
76  static FXObject* makeInstanceOfName(const FXchar* name);
77  static FXObject* makeInstanceOfName(const FXString& name);
78 
80  FXObject* makeInstance() const;
81 
83  static FXObject* nullObject();
84 
86  virtual ~FXMetaClass();
87  };
88 
89 }
90 
91 #endif
Describes a FOX object.
Definition: FXMetaClass.h:34
Definition: FX4Splitter.h:28
Object is the base class for all objects in FOX; in order to receive messages from the user interface...
Definition: FXObject.h:134
const FXchar * getClassName() const
Ask class name.
Definition: FXMetaClass.h:63
const FXMetaClass * getBaseClass() const
Ask base class.
Definition: FXMetaClass.h:66
FXString provides essential string manipulation capabilities in FOX.
Definition: FXString.h:42

Copyright © 1997-2022 Jeroen van der Zijp