RTF to XML/XHTML or other converter - design problem

A

Aaron Gray

I am at the design stage for implementing a RTF event generator front end
for converting RTF to XHTML or XML.

Basically am stuck on whether to use virtual functions dispatched from a
table or whether to use enums dispatched with in a switch and case
statement. There are problems with both in regarding inheritance and
reusability. ie you cannot call virtual methods of a subclass and switch and
case statements are not exactly extendable.

I am stuck which route to take.

Any thoughts or ideas that may influence me are welcome,

Aaron
 
V

Victor Bazarov

Aaron said:
I am at the design stage for implementing a RTF event generator front
end for converting RTF to XHTML or XML.

Basically am stuck on whether to use virtual functions dispatched
from a table or whether to use enums dispatched with in a switch and
case statement. There are problems with both in regarding inheritance
and reusability. ie you cannot call virtual methods of a subclass and
switch and case statements are not exactly extendable.

I am stuck which route to take.

Use a map with your enum as the key and a pointer-to-function as the
value. Extendable and no inheritance problem whatsoever.

V
 
A

Aaron Gray

Victor Bazarov said:
Use a map with your enum as the key and a pointer-to-function as the
value. Extendable and no inheritance problem whatsoever.

Yep, use functions, simple solution, thanks Victor.

Not as neat as C++ usually makes things, but a working solution never the
less.

Aaron
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,482
Members
44,900
Latest member
Nell636132

Latest Threads

Top