9 void * operator new (size_t size
);
10 void operator delete (void *p
);
21 virtual ~XSerializable () {};
23 virtual bool isSerializable() const = 0;
24 virtual void serialize () = 0;
31 class Grammar
: public XSerializable
, public XMemory
43 virtual GrammarType
getGrammarType() const = 0;
44 virtual bool getValidated() const = 0;
46 virtual bool isSerializable() const;
47 virtual void serialize ();
54 class SchemaGrammar
: public Grammar
58 SchemaGrammar () : Grammar(), elemID(10) { fValidated
= true; }
60 virtual ~SchemaGrammar() {}
62 virtual Grammar::GrammarType
getGrammarType() const;
63 virtual bool getValidated() const;
65 virtual bool isSerializable () const;
66 virtual void serialize ();
69 const unsigned int elemID
;
74 class OtherGrammar
: public Grammar
78 OtherGrammar () : Grammar(), elemID(10) { fValidated
= true; }
80 virtual ~OtherGrammar() {}
82 virtual Grammar::GrammarType
getGrammarType() const;
83 virtual bool getValidated() const;
85 virtual bool isSerializable () const;
86 virtual void serialize ();
89 const unsigned int elemID
;
97 printf ("in Grammar::serialize\n");
101 Grammar::isSerializable () const
107 SchemaGrammar::isSerializable () const
113 SchemaGrammar::serialize ()
115 printf ("in SchemaGrammar::serialize\n");
119 SchemaGrammar::getGrammarType() const {
120 return Grammar::SchemaGrammarType
;
124 SchemaGrammar::getValidated () const
130 XMemory::operator new (size_t size
)
132 return malloc (size
);
136 XMemory::operator delete (void *p
)
141 OtherGrammar::isSerializable () const
147 OtherGrammar::serialize ()
149 printf ("in OtherGrammar::serialize\n");
153 OtherGrammar::getGrammarType() const {
154 return Grammar::OtherGrammarType
;
158 OtherGrammar::getValidated () const
164 main (int argc
, char **argv
)
168 Grammar
&sGrammar
= sPtr
;
170 for (int i
= 0; i
< 2; ++i
)
177 if (sGrammar
.getGrammarType() != Grammar::SchemaGrammarType
||
178 sGrammar
.getValidated ())
179 printf ("if condition was true.\n");
181 printf ("if condition was false.\n");