Changes between Version 2 and Version 3 of code/howto/XMLPort
- Timestamp:
- Oct 4, 2015, 9:35:41 PM (9 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
code/howto/XMLPort
v2 v3 14 14 { 15 15 public: 16 MyClass(); 16 MyClass(Context* context); 17 virtual ~MyClass(); 18 17 19 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); 18 20 … … 30 32 }}} 31 33 32 == 2. Create a Factory==33 Additionally you have to create a [wiki:Factory] for the new class. Use the [wiki:CoreIncludes CreateFactory] macro outside a function in a source file:34 == 2. Register Class and Object == 35 Additionally you have to register the new class in the framework. Use the [wiki:CoreIncludes RegisterClass] macro outside a function in a source file: 34 36 35 37 MyClass.cc file: … … 37 39 #include "MyClass.h" 38 40 39 CreateFactory(MyClass);41 RegisterClass(MyClass); 40 42 41 43 // Constructor: 42 MyClass::MyClass( )44 MyClass::MyClass(Context* context) : BaseObject(context) // or "OtherClass(context)" 43 45 { 44 46 RegisterObject(MyClass);