> Thank you everybody.
> 
> I only typed two possibilities ("John" and "Tom") only not
> to write too much, but the fact is that I've got 9
> possibilities, and I do not want to use if-then-else, but
> switch-case.
> 
> I tested with:
> value = attr.getNodeValue().transcode()
> if (strcmp(value,"John")==0)...
> if (strcmp(value,"Tom")==0)...
> if (strcmp(value,"Mary")==0)...
> 
> It works but, in my opinion, it's more elegant switch-case,
> isn't it?

Provide you own switch/case like below:

#define SWITCH( str ) \
    if( false )

#define CASE( str ) \
    } else if( value.equals(str) ) { 

DOMString value = attr.getNodeValue();


SWITCH( value )
{
    CASE( "John" )
        cout << "Hello John"<< endl;
    CASE( "Mary" )
        cout << "Hello Mary"<< endl;
};


Peter A. Volchek
Software Engineer
Metis International, Inc.
[EMAIL PROTECTED]




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to