[xsde-users] Re: Determine whether an object model supports polymorphism

Boris Kolpackov boris at codesynthesis.com
Thu Oct 22 08:52:48 EDT 2009


Hi Thomas,

Thomas Frenzel (TomSun) <tftomsun at streamteam.de> writes:

>   Maybe you could reduce the effort in the generated code if you 
>   provide in your lib a static method... something like

It is not really the effort to generate the code that is the issue.
It is the interface (no clean way to report errors when exceptions
are disabled) as well as the generated code size concern. So I am
trying to keep things as minimal as possible.

Do you need this functionality (i.e., conversion from a string 
representation to enum other than during XML parsing) right now in
your application? Or is it something that might be useful in the 
future?


>   
>   static int ParseEnum(char* value, const char*[] enumNames)
>   {
>   // TODO do the error handling and getting the integer representation 
>      of the enum value here.
>   }

What if I have two enums that have the same value bit at different
"positions" ;-)?


>   and you could just generated the constructor like this
>   inline color:
>   color (char* enumName)
>     v_ ((value)::ParseEnum(enumName,color_str_))
>   {
>   }

No, I don't like this. It should be either implemented properly or
not implemented at all. Having a half-done solution is very costly
to support.

Boris



More information about the xsde-users mailing list