All pastes #2110393 Raw Edit

Miscellany

public cpp v1 · immutable
#2110393 ·published 2012-02-06 18:13 UTC
rendered paste body
std::string StompHelper::convertDestination( const Pointer<ActiveMQDestination>& destination ) {    if( destination == NULL ) {        return "";    } else {        switch( destination->getDestinationType() ) {            case cms::Destination::TOPIC:#ifndef __HORNETQ                return std::string( "/topic/" ) + destination->getPhysicalName();#else				return std::string( "jms.topic." ) + destination->getPhysicalName();#endif            case cms::Destination::TEMPORARY_TOPIC:                if( destination->getPhysicalName().find( "/remote-temp-topic/" ) == 0 ) {                    return destination->getPhysicalName();				} else {                    return std::string( "/temp-topic/" ) + destination->getPhysicalName();                }            case cms::Destination::TEMPORARY_QUEUE:                if( destination->getPhysicalName().find( "/remote-temp-queue/" ) == 0 ) {                    return destination->getPhysicalName();                } else {                    return std::string( "/temp-queue/" ) + destination->getPhysicalName();                }            default:#ifndef __HORNETQ                return std::string( "/queue/" ) + destination->getPhysicalName();#else				return std::string( "jms.queue." ) + destination->getPhysicalName();#endif // __HORNETQ        }    }}////////////////////////////////////////////////////////////////////////////////Pointer<ActiveMQDestination> StompHelper::convertDestination( const std::string& destination ) {    if( destination == "" ) {        return Pointer<ActiveMQDestination>();    }    int type = 0;    std::string dest = "";    if( destination.find( "/queue/" ) == 0 ) {        dest = destination.substr( 7 );        type = cms::Destination::QUEUE;    } else if( destination.find( "/topic/" ) == 0 ) {        dest = destination.substr( 7 );        type = cms::Destination::TOPIC;    } else if( destination.find( "/temp-topic/" ) == 0 ) {        dest = destination.substr( 12 );        type = cms::Destination::TEMPORARY_TOPIC;    } else if( destination.find( "/temp-queue/" ) == 0 ) {        dest = destination.substr( 12 );        type = cms::Destination::TEMPORARY_QUEUE;    } else if( destination.find( "/remote-temp-topic/" ) == 0 ) {        type = cms::Destination::TEMPORARY_TOPIC;    } else if( destination.find( "/remote-temp-queue/" ) == 0 ) {        type = cms::Destination::TEMPORARY_QUEUE;    }#ifdef __HORNETQ	else if ( destination.find( "jms.queue.") == 0 ) {		dest = destination.substr(10);		type = cms::Destination::QUEUE;	} else if ( destination.find( "jms.topic.") == 0 ) {		dest = destination.substr(10);		type = cms::Destination::TOPIC;	}#endif // __HORNETQ    return ActiveMQDestination::createDestination( type, dest );}