You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by ta...@apache.org on 2012/10/18 22:21:45 UTC
svn commit: r1399831 [1/2] - in
/activemq/activemq-cpp/trunk/activemq-cpp/src/main: ./ decaf/internal/
decaf/internal/util/
Author: tabish
Date: Thu Oct 18 20:21:44 2012
New Revision: 1399831
URL: http://svn.apache.org/viewvc?rev=1399831&view=rev
Log:
Code cleanup and fix some throw clauses so they preserve exception types, remove unneeded includes from some headers and remove some old throw clauses.
Added:
activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/util/GenericResource.cpp (with props)
Modified:
activemq/activemq-cpp/trunk/activemq-cpp/src/main/Makefile.am
activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/AprPool.cpp
activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/AprPool.h
activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/DecafRuntime.cpp
activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/DecafRuntime.h
activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/util/ByteArrayAdapter.cpp
activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/util/ByteArrayAdapter.h
activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/util/GenericResource.h
activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/util/HexStringParser.cpp
activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/util/HexStringParser.h
activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/util/ResourceLifecycleManager.cpp
activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/util/ResourceLifecycleManager.h
activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/util/TimerTaskHeap.cpp
activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/util/TimerTaskHeap.h
Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/Makefile.am
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/Makefile.am?rev=1399831&r1=1399830&r2=1399831&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/Makefile.am (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/Makefile.am Thu Oct 18 20:21:44 2012
@@ -356,6 +356,7 @@ cc_sources = \
decaf/internal/nio/ShortArrayBuffer.cpp \
decaf/internal/security/unix/SecureRandomImpl.cpp \
decaf/internal/util/ByteArrayAdapter.cpp \
+ decaf/internal/util/GenericResource.cpp \
decaf/internal/util/HexStringParser.cpp \
decaf/internal/util/Resource.cpp \
decaf/internal/util/ResourceLifecycleManager.cpp \
Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/AprPool.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/AprPool.cpp?rev=1399831&r1=1399830&r2=1399831&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/AprPool.cpp (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/AprPool.cpp Thu Oct 18 20:21:44 2012
@@ -28,24 +28,26 @@ AprPool::AprPool() : aprPool(NULL) {
////////////////////////////////////////////////////////////////////////////////
AprPool::~AprPool() {
-
- // Destroy the pool if it was allocated.
- destroyPool();
+ try {
+ // Destroy the pool if it was allocated.
+ destroyPool();
+ }
+ DECAF_CATCHALL_NOTHROW()
}
////////////////////////////////////////////////////////////////////////////////
void AprPool::allocatePool() const {
- if( aprPool == NULL ) {
- apr_pool_create_unmanaged_ex( &aprPool, NULL, NULL );
+ if (aprPool == NULL) {
+ apr_pool_create_unmanaged_ex(&aprPool, NULL, NULL);
}
}
////////////////////////////////////////////////////////////////////////////////
void AprPool::destroyPool() {
- if( aprPool != NULL ) {
- apr_pool_destroy( aprPool );
+ if (aprPool != NULL) {
+ apr_pool_destroy(aprPool);
}
aprPool = NULL;
@@ -54,8 +56,8 @@ void AprPool::destroyPool() {
////////////////////////////////////////////////////////////////////////////////
void AprPool::cleanup() {
- if( aprPool != NULL ) {
- apr_pool_clear( aprPool );
+ if (aprPool != NULL) {
+ apr_pool_clear(aprPool);
}
}
@@ -75,6 +77,6 @@ apr_pool_t* AprPool::getAprPool() const
apr_pool_t* AprPool::getGlobalPool() {
// Ensure there is a Runtime instance created so we have a global pool
- DecafRuntime* runtime = dynamic_cast<DecafRuntime*>( Runtime::getRuntime() );
+ DecafRuntime* runtime = dynamic_cast<DecafRuntime*>(Runtime::getRuntime());
return runtime->getGlobalPool();
}
Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/AprPool.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/AprPool.h?rev=1399831&r1=1399830&r2=1399831&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/AprPool.h (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/AprPool.h Thu Oct 18 20:21:44 2012
@@ -40,8 +40,8 @@ namespace internal{
private:
- AprPool( const AprPool& pool );
- AprPool& operator= ( const AprPool& pool );
+ AprPool(const AprPool& pool);
+ AprPool& operator=(const AprPool& pool);
public:
Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/DecafRuntime.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/DecafRuntime.cpp?rev=1399831&r1=1399830&r2=1399831&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/DecafRuntime.cpp (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/DecafRuntime.cpp Thu Oct 18 20:21:44 2012
@@ -64,11 +64,11 @@ Runtime* Runtime::getRuntime() {
}
////////////////////////////////////////////////////////////////////////////////
-void Runtime::initializeRuntime( int argc, char **argv ) {
+void Runtime::initializeRuntime(int argc, char **argv) {
// Initializes the APR Runtime from within a library.
apr_initialize();
- apr_pool_create_ex( &aprPool, NULL, NULL, NULL );
+ apr_pool_create_ex(&aprPool, NULL, NULL, NULL);
Runtime::getRuntime();
@@ -79,7 +79,7 @@ void Runtime::initializeRuntime( int arg
globalLock = new Mutex;
// Initialize the System Class to make things like Properties available.
- System::initSystem( argc, argv );
+ System::initSystem(argc, argv);
// Initialize the Networking layer.
Network::initializeNetworking();
@@ -87,7 +87,7 @@ void Runtime::initializeRuntime( int arg
////////////////////////////////////////////////////////////////////////////////
void Runtime::initializeRuntime() {
- Runtime::initializeRuntime( 0, NULL );
+ Runtime::initializeRuntime(0, NULL);
}
////////////////////////////////////////////////////////////////////////////////
@@ -109,6 +109,6 @@ void Runtime::shutdownRuntime() {
Threading::shutdown();
// Cleans up APR data structures.
- apr_pool_destroy( aprPool );
+ apr_pool_destroy(aprPool);
apr_terminate();
}
Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/DecafRuntime.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/DecafRuntime.h?rev=1399831&r1=1399830&r2=1399831&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/DecafRuntime.h (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/DecafRuntime.h Thu Oct 18 20:21:44 2012
@@ -30,11 +30,11 @@ namespace internal {
/**
* Handles APR initialization and termination.
*/
- class DECAF_API DecafRuntime : public decaf::lang::Runtime {
+ class DECAF_API DecafRuntime: public decaf::lang::Runtime {
private:
- DecafRuntime( const DecafRuntime& );
- DecafRuntime& operator= ( const DecafRuntime& );
+ DecafRuntime(const DecafRuntime&);
+ DecafRuntime& operator=(const DecafRuntime&);
public:
Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/util/ByteArrayAdapter.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/util/ByteArrayAdapter.cpp?rev=1399831&r1=1399830&r2=1399831&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/util/ByteArrayAdapter.cpp (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/util/ByteArrayAdapter.cpp Thu Oct 18 20:21:44 2012
@@ -31,254 +31,228 @@ using namespace decaf::lang;
using namespace decaf::lang::exceptions;
////////////////////////////////////////////////////////////////////////////////
-ByteArrayAdapter::ByteArrayAdapter( int size ) : array(), size(size), own(true) {
+ByteArrayAdapter::ByteArrayAdapter(int size) :
+ array(), size(size), own(true) {
- try{
+ try {
- if( size < 0 ) {
- throw IndexOutOfBoundsException(
- __FILE__, __LINE__, "Array size given must be greater than zero." );
+ if (size < 0) {
+ throw IndexOutOfBoundsException(__FILE__, __LINE__, "Array size given must be greater than zero.");
}
this->array.bytes = new unsigned char[size];
- memset( this->array.bytes, 0, size );
- this->initialize( array.bytes, size, true );
+ memset(this->array.bytes, 0, size);
+ this->initialize(array.bytes, size, true);
}
- DECAF_CATCH_RETHROW( Exception )
- DECAF_CATCHALL_THROW( Exception )
+ DECAF_CATCH_RETHROW(Exception)
+ DECAF_CATCHALL_THROW(Exception)
}
////////////////////////////////////////////////////////////////////////////////
-ByteArrayAdapter::ByteArrayAdapter( unsigned char* array, int size, bool own ) :
- array(), size(size), own(own) {
+ByteArrayAdapter::ByteArrayAdapter(unsigned char* array, int size, bool own) :
+ array(), size(size), own(own) {
- try{
- this->initialize( array, size, own );
+ try {
+ this->initialize(array, size, own);
}
- DECAF_CATCH_RETHROW( NullPointerException )
- DECAF_CATCH_RETHROW( IndexOutOfBoundsException )
- DECAF_CATCHALL_THROW( NullPointerException )
+ DECAF_CATCH_RETHROW(NullPointerException)
+ DECAF_CATCH_RETHROW(IndexOutOfBoundsException)
+ DECAF_CATCHALL_THROW(NullPointerException)
}
////////////////////////////////////////////////////////////////////////////////
-ByteArrayAdapter::ByteArrayAdapter( char* array, int size, bool own ) :
- array(), size(size), own(own) {
+ByteArrayAdapter::ByteArrayAdapter(char* array, int size, bool own) :
+ array(), size(size), own(own) {
- try{
- this->initialize( reinterpret_cast<unsigned char*>( array ), size, own );
+ try {
+ this->initialize(reinterpret_cast<unsigned char*>(array), size, own);
}
- DECAF_CATCH_RETHROW( NullPointerException )
- DECAF_CATCH_RETHROW( IndexOutOfBoundsException )
- DECAF_CATCHALL_THROW( NullPointerException )
+ DECAF_CATCH_RETHROW(NullPointerException)
+ DECAF_CATCH_RETHROW(IndexOutOfBoundsException)
+ DECAF_CATCHALL_THROW(NullPointerException)
}
////////////////////////////////////////////////////////////////////////////////
-ByteArrayAdapter::ByteArrayAdapter( double* array, int size, bool own ) :
- array(), size(size), own(own) {
+ByteArrayAdapter::ByteArrayAdapter(double* array, int size, bool own) :
+ array(), size(size), own(own) {
- try{
- this->initialize( reinterpret_cast<unsigned char*>( array ),
- size * (int)sizeof( double ), own );
+ try {
+ this->initialize(reinterpret_cast<unsigned char*>(array), size * (int) sizeof(double), own);
}
- DECAF_CATCH_RETHROW( NullPointerException )
- DECAF_CATCH_RETHROW( IndexOutOfBoundsException )
- DECAF_CATCHALL_THROW( NullPointerException )
+ DECAF_CATCH_RETHROW(NullPointerException)
+ DECAF_CATCH_RETHROW(IndexOutOfBoundsException)
+ DECAF_CATCHALL_THROW(NullPointerException)
}
////////////////////////////////////////////////////////////////////////////////
-ByteArrayAdapter::ByteArrayAdapter( float* array, int size, bool own ) :
- array(), size(size), own(own) {
+ByteArrayAdapter::ByteArrayAdapter(float* array, int size, bool own) :
+ array(), size(size), own(own) {
- try{
- this->initialize( reinterpret_cast<unsigned char*>( array ),
- size * (int)sizeof( float ), own );
+ try {
+ this->initialize(reinterpret_cast<unsigned char*>(array), size * (int) sizeof(float), own);
}
- DECAF_CATCH_RETHROW( NullPointerException )
- DECAF_CATCH_RETHROW( IndexOutOfBoundsException )
- DECAF_CATCHALL_THROW( NullPointerException )
+ DECAF_CATCH_RETHROW(NullPointerException)
+ DECAF_CATCH_RETHROW(IndexOutOfBoundsException)
+ DECAF_CATCHALL_THROW(NullPointerException)
}
////////////////////////////////////////////////////////////////////////////////
-ByteArrayAdapter::ByteArrayAdapter( long long* array, int size, bool own ) :
- array(), size(size), own(own) {
+ByteArrayAdapter::ByteArrayAdapter(long long* array, int size, bool own) :
+ array(), size(size), own(own) {
- try{
- this->initialize( reinterpret_cast<unsigned char*>( array ),
- size * (int)sizeof( long long ), own );
+ try {
+ this->initialize(reinterpret_cast<unsigned char*>(array), size * (int) sizeof(long long), own);
}
- DECAF_CATCH_RETHROW( NullPointerException )
- DECAF_CATCH_RETHROW( IndexOutOfBoundsException )
- DECAF_CATCHALL_THROW( NullPointerException )
+ DECAF_CATCH_RETHROW(NullPointerException)
+ DECAF_CATCH_RETHROW(IndexOutOfBoundsException)
+ DECAF_CATCHALL_THROW(NullPointerException)
}
////////////////////////////////////////////////////////////////////////////////
-ByteArrayAdapter::ByteArrayAdapter( int* array, int size, bool own ) :
- array(), size(size), own(own) {
+ByteArrayAdapter::ByteArrayAdapter(int* array, int size, bool own) :
+ array(), size(size), own(own) {
- try{
- this->initialize( reinterpret_cast<unsigned char*>( array ),
- size * (int)sizeof( int ), own );
+ try {
+ this->initialize(reinterpret_cast<unsigned char*>(array), size * (int) sizeof(int), own);
}
- DECAF_CATCH_RETHROW( NullPointerException )
- DECAF_CATCH_RETHROW( IndexOutOfBoundsException )
- DECAF_CATCHALL_THROW( NullPointerException )
+ DECAF_CATCH_RETHROW(NullPointerException)
+ DECAF_CATCH_RETHROW(IndexOutOfBoundsException)
+ DECAF_CATCHALL_THROW(NullPointerException)
}
////////////////////////////////////////////////////////////////////////////////
-ByteArrayAdapter::ByteArrayAdapter( short* array, int size, bool own ) :
- array(), size(size), own(own) {
+ByteArrayAdapter::ByteArrayAdapter(short* array, int size, bool own) :
+ array(), size(size), own(own) {
- try{
- this->initialize( reinterpret_cast<unsigned char*>( array ),
- size * (int)sizeof( short ), own );
+ try {
+ this->initialize(reinterpret_cast<unsigned char*>(array), size * (int) sizeof(short), own);
}
- DECAF_CATCH_RETHROW( NullPointerException )
- DECAF_CATCH_RETHROW( IndexOutOfBoundsException )
- DECAF_CATCHALL_THROW( NullPointerException )
+ DECAF_CATCH_RETHROW(NullPointerException)
+ DECAF_CATCH_RETHROW(IndexOutOfBoundsException)
+ DECAF_CATCHALL_THROW(NullPointerException)
}
////////////////////////////////////////////////////////////////////////////////
-void ByteArrayAdapter::initialize( unsigned char* array, int size, bool own ) {
+void ByteArrayAdapter::initialize(unsigned char* array, int size, bool own) {
- try{
+ try {
- if( array == NULL ) {
- throw NullPointerException(
- __FILE__, __LINE__,
- "ByteArrayAdapter::initialize - Passed Buffer is null" );
+ if (array == NULL) {
+ throw NullPointerException(__FILE__, __LINE__, "ByteArrayAdapter::initialize - Passed Buffer is null");
}
- if( size < 0 ) {
- throw IndexOutOfBoundsException(
- __FILE__, __LINE__, "Array size given must be greater than zero." );
+ if (size < 0) {
+ throw IndexOutOfBoundsException(__FILE__, __LINE__, "Array size given must be greater than zero.");
}
this->array.bytes = array;
this->size = size;
this->own = own;
}
- DECAF_CATCH_RETHROW( Exception )
- DECAF_CATCHALL_THROW( Exception )
+ DECAF_CATCH_RETHROW(Exception)
+ DECAF_CATCHALL_THROW(Exception)
}
////////////////////////////////////////////////////////////////////////////////
ByteArrayAdapter::~ByteArrayAdapter() {
- try{
-
- if( own ) {
- delete [] array.bytes;
+ try {
+ if (own) {
+ delete[] array.bytes;
}
}
- DECAF_CATCH_NOTHROW( Exception )
DECAF_CATCHALL_NOTHROW()
}
////////////////////////////////////////////////////////////////////////////////
-void ByteArrayAdapter::read( unsigned char* buffer, int size, int offset, int length ) const {
+void ByteArrayAdapter::read(unsigned char* buffer, int size, int offset, int length) const {
- try{
+ try {
- if( length == 0 ) {
+ if (length == 0) {
return;
}
- if( buffer == NULL ) {
- throw NullPointerException(
- __FILE__, __LINE__,
- "ByteArrayAdapter::write - Passed buffer is null" );
+ if (buffer == NULL) {
+ throw NullPointerException(__FILE__, __LINE__, "ByteArrayAdapter::write - Passed buffer is null");
}
- if( size < 0 ) {
- throw IndexOutOfBoundsException(
- __FILE__, __LINE__, "size parameter out of Bounds: %d.", size );
+ if (size < 0) {
+ throw IndexOutOfBoundsException(__FILE__, __LINE__, "size parameter out of Bounds: %d.", size);
}
- if( offset < 0 ) {
- throw IndexOutOfBoundsException(
- __FILE__, __LINE__, "offset parameter out of Bounds: %d.", offset );
+ if (offset < 0) {
+ throw IndexOutOfBoundsException(__FILE__, __LINE__, "offset parameter out of Bounds: %d.", offset);
}
- if( length < 0 || length > size ) {
- throw IndexOutOfBoundsException(
- __FILE__, __LINE__, "length parameter out of Bounds: %d.", length );
+ if (length < 0 || length > size) {
+ throw IndexOutOfBoundsException(__FILE__, __LINE__, "length parameter out of Bounds: %d.", length);
}
- if( ( offset + length ) > this->size ) {
- throw BufferUnderflowException(
- __FILE__, __LINE__, "Not enough data to fill request." );
+ if ((offset + length) > this->size) {
+ throw BufferUnderflowException(__FILE__, __LINE__, "Not enough data to fill request.");
}
// Read, starting at offset, length number of bytes to Buffer
- memcpy( buffer, this->array.bytes + offset, length );
+ memcpy(buffer, this->array.bytes + offset, length);
}
- DECAF_CATCH_RETHROW( NullPointerException )
- DECAF_CATCH_RETHROW( IndexOutOfBoundsException )
- DECAF_CATCH_RETHROW( BufferUnderflowException )
- DECAF_CATCH_EXCEPTION_CONVERT( Exception, BufferUnderflowException )
- DECAF_CATCHALL_THROW( BufferUnderflowException )
+ DECAF_CATCH_RETHROW(NullPointerException)
+ DECAF_CATCH_RETHROW(IndexOutOfBoundsException)
+ DECAF_CATCH_RETHROW(BufferUnderflowException)
+ DECAF_CATCH_EXCEPTION_CONVERT(Exception, BufferUnderflowException)
+ DECAF_CATCHALL_THROW(BufferUnderflowException)
}
////////////////////////////////////////////////////////////////////////////////
-void ByteArrayAdapter::write( unsigned char* buffer, int size, int offset, int length ) {
+void ByteArrayAdapter::write(unsigned char* buffer, int size, int offset, int length) {
- try{
+ try {
- if( length == 0 ) {
+ if (length == 0) {
return;
}
- if( buffer == NULL ) {
- throw NullPointerException(
- __FILE__, __LINE__,
- "ByteArrayAdapter::write - Passed buffer is null" );
+ if (buffer == NULL) {
+ throw NullPointerException(__FILE__, __LINE__, "ByteArrayAdapter::write - Passed buffer is null");
}
- if( size < 0 ) {
- throw IndexOutOfBoundsException(
- __FILE__, __LINE__, "size parameter out of Bounds: %d.", size );
+ if (size < 0) {
+ throw IndexOutOfBoundsException(__FILE__, __LINE__, "size parameter out of Bounds: %d.", size);
}
- if( offset < 0 ) {
- throw IndexOutOfBoundsException(
- __FILE__, __LINE__, "offset parameter out of Bounds: %d.", offset );
+ if (offset < 0) {
+ throw IndexOutOfBoundsException(__FILE__, __LINE__, "offset parameter out of Bounds: %d.", offset);
}
- if( length < 0 || length > size ) {
- throw IndexOutOfBoundsException(
- __FILE__, __LINE__, "length parameter out of Bounds: %d.", length );
+ if (length < 0 || length > size) {
+ throw IndexOutOfBoundsException(__FILE__, __LINE__, "length parameter out of Bounds: %d.", length);
}
- if( ( offset + length ) > this->size ) {
- throw BufferOverflowException(
- __FILE__, __LINE__,
- "ByteArrayAdapter::read - Not room in array to hold request." );
+ if ((offset + length) > this->size) {
+ throw BufferOverflowException(__FILE__, __LINE__, "ByteArrayAdapter::read - Not room in array to hold request.");
}
// Write, starting at offset, length number of bytes from buffer.
- memcpy( this->array.bytes + offset, buffer, length );
+ memcpy(this->array.bytes + offset, buffer, length);
}
- DECAF_CATCH_RETHROW( NullPointerException )
- DECAF_CATCH_RETHROW( IndexOutOfBoundsException )
- DECAF_CATCH_RETHROW( BufferOverflowException )
- DECAF_CATCH_EXCEPTION_CONVERT( Exception, BufferOverflowException )
- DECAF_CATCHALL_THROW( BufferOverflowException )
+ DECAF_CATCH_RETHROW(NullPointerException)
+ DECAF_CATCH_RETHROW(IndexOutOfBoundsException)
+ DECAF_CATCH_RETHROW(BufferOverflowException)
+ DECAF_CATCH_EXCEPTION_CONVERT(Exception, BufferOverflowException)
+ DECAF_CATCHALL_THROW(BufferOverflowException)
}
////////////////////////////////////////////////////////////////////////////////
-void ByteArrayAdapter::resize( int size ) {
+void ByteArrayAdapter::resize(int size) {
- try{
+ try {
- if( !own ) {
- throw InvalidStateException(
- __FILE__, __LINE__,
- "ByteArrayAdapter::resize - Not the array owner, can't resize" );
+ if (!own) {
+ throw InvalidStateException(__FILE__, __LINE__, "ByteArrayAdapter::resize - Not the array owner, can't resize");
}
- if( size < 0 ) {
- throw IllegalArgumentException(
- __FILE__, __LINE__, "size parameter out of Bounds: %d.", size );
+ if (size < 0) {
+ throw IllegalArgumentException(__FILE__, __LINE__, "size parameter out of Bounds: %d.", size);
}
// Save old state
@@ -288,173 +262,161 @@ void ByteArrayAdapter::resize( int size
// Resize and copy as much of the old as we can back and delete old array
this->array.bytes = new unsigned char[size];
this->size = size;
- memcpy( this->array.bytes, oldArray, Math::min( (int)oldCapacity, (int)size ) );
- delete [] oldArray;
+ memcpy(this->array.bytes, oldArray, Math::min((int) oldCapacity, (int) size));
+ delete[] oldArray;
}
- DECAF_CATCH_RETHROW( InvalidStateException )
- DECAF_CATCHALL_THROW( InvalidStateException )
+ DECAF_CATCH_RETHROW(InvalidStateException)
+ DECAF_CATCHALL_THROW(InvalidStateException)
}
////////////////////////////////////////////////////////////////////////////////
void ByteArrayAdapter::clear() {
- memset( this->array.bytes, 0, this->size );
+ memset(this->array.bytes, 0, this->size);
}
////////////////////////////////////////////////////////////////////////////////
-unsigned char& ByteArrayAdapter::operator[]( int index ) {
+unsigned char& ByteArrayAdapter::operator[](int index) {
- try{
+ try {
- if( index < 0 || index > this->size ) {
- throw IndexOutOfBoundsException(
- __FILE__, __LINE__, "Index %d is out of bounds", index );
+ if (index < 0 || index > this->size) {
+ throw IndexOutOfBoundsException(__FILE__, __LINE__, "Index %d is out of bounds", index);
}
return this->array.bytes[index];
}
- DECAF_CATCH_RETHROW( IndexOutOfBoundsException )
- DECAF_CATCHALL_THROW( IndexOutOfBoundsException )
+ DECAF_CATCH_RETHROW(IndexOutOfBoundsException)
+ DECAF_CATCHALL_THROW(IndexOutOfBoundsException)
}
////////////////////////////////////////////////////////////////////////////////
-const unsigned char& ByteArrayAdapter::operator[]( int index ) const {
+const unsigned char& ByteArrayAdapter::operator[](int index) const {
- try{
+ try {
- if( index < 0 || index > this->size ) {
- throw IndexOutOfBoundsException(
- __FILE__, __LINE__, "Index %d is out of bounds", index );
+ if (index < 0 || index > this->size) {
+ throw IndexOutOfBoundsException(__FILE__, __LINE__, "Index %d is out of bounds", index);
}
return this->array.bytes[index];
}
- DECAF_CATCH_RETHROW( IndexOutOfBoundsException )
- DECAF_CATCHALL_THROW( IndexOutOfBoundsException )
+ DECAF_CATCH_RETHROW(IndexOutOfBoundsException)
+ DECAF_CATCHALL_THROW(IndexOutOfBoundsException)
}
////////////////////////////////////////////////////////////////////////////////
-unsigned char ByteArrayAdapter::get( int index ) const {
+unsigned char ByteArrayAdapter::get(int index) const {
- try{
+ try {
- if( index < 0 || index >= this->getCapacity() ) {
- throw IndexOutOfBoundsException(
- __FILE__, __LINE__,
- "ByteArrayAdapter::get - Not enough data to fill request." );
+ if (index < 0 || index >= this->getCapacity()) {
+ throw IndexOutOfBoundsException(__FILE__, __LINE__, "ByteArrayAdapter::get - Not enough data to fill request.");
}
return (*this)[index];
}
- DECAF_CATCH_RETHROW( IndexOutOfBoundsException )
- DECAF_CATCH_EXCEPTION_CONVERT( Exception, IndexOutOfBoundsException )
- DECAF_CATCHALL_THROW( IndexOutOfBoundsException )
+ DECAF_CATCH_RETHROW(IndexOutOfBoundsException)
+ DECAF_CATCH_EXCEPTION_CONVERT(Exception, IndexOutOfBoundsException)
+ DECAF_CATCHALL_THROW(IndexOutOfBoundsException)
}
////////////////////////////////////////////////////////////////////////////////
-char ByteArrayAdapter::getChar( int index ) const {
+char ByteArrayAdapter::getChar(int index) const {
- try{
- return (char)this->get( index );
+ try {
+ return (char) this->get(index);
}
- DECAF_CATCH_RETHROW( IndexOutOfBoundsException )
- DECAF_CATCH_EXCEPTION_CONVERT( Exception, IndexOutOfBoundsException )
- DECAF_CATCHALL_THROW( IndexOutOfBoundsException )
+ DECAF_CATCH_RETHROW(IndexOutOfBoundsException)
+ DECAF_CATCH_EXCEPTION_CONVERT(Exception, IndexOutOfBoundsException)
+ DECAF_CATCHALL_THROW(IndexOutOfBoundsException)
}
////////////////////////////////////////////////////////////////////////////////
-double ByteArrayAdapter::getDouble( int index ) const {
+double ByteArrayAdapter::getDouble(int index) const {
- try{
+ try {
- if( index < 0 || index >= this->getDoubleCapacity() ) {
- throw IndexOutOfBoundsException(
- __FILE__, __LINE__,
- "ByteArrayAdapter::getDouble(i) - Not enough data to fill a long long." );
+ if (index < 0 || index >= this->getDoubleCapacity()) {
+ throw IndexOutOfBoundsException(__FILE__, __LINE__, "ByteArrayAdapter::getDouble(i) - Not enough data to fill a long long.");
}
- return this->array.doubles[ index ];
+ return this->array.doubles[index];
}
- DECAF_CATCH_RETHROW( IndexOutOfBoundsException )
- DECAF_CATCH_EXCEPTION_CONVERT( Exception, IndexOutOfBoundsException )
- DECAF_CATCHALL_THROW( IndexOutOfBoundsException )
+ DECAF_CATCH_RETHROW(IndexOutOfBoundsException)
+ DECAF_CATCH_EXCEPTION_CONVERT(Exception, IndexOutOfBoundsException)
+ DECAF_CATCHALL_THROW(IndexOutOfBoundsException)
}
////////////////////////////////////////////////////////////////////////////////
-double ByteArrayAdapter::getDoubleAt( int index ) const {
+double ByteArrayAdapter::getDoubleAt(int index) const {
- try{
+ try {
- unsigned long long lvalue = this->getLongAt( index );
- return Double::longBitsToDouble( lvalue );
+ unsigned long long lvalue = this->getLongAt(index);
+ return Double::longBitsToDouble(lvalue);
}
- DECAF_CATCH_RETHROW( IndexOutOfBoundsException )
- DECAF_CATCH_EXCEPTION_CONVERT( Exception, IndexOutOfBoundsException )
- DECAF_CATCHALL_THROW( IndexOutOfBoundsException )
+ DECAF_CATCH_RETHROW(IndexOutOfBoundsException)
+ DECAF_CATCH_EXCEPTION_CONVERT(Exception, IndexOutOfBoundsException)
+ DECAF_CATCHALL_THROW(IndexOutOfBoundsException)
}
////////////////////////////////////////////////////////////////////////////////
-float ByteArrayAdapter::getFloat( int index ) const {
+float ByteArrayAdapter::getFloat(int index) const {
- try{
+ try {
- if( index < 0 || index >= this->getFloatCapacity() ) {
- throw IndexOutOfBoundsException(
- __FILE__, __LINE__,
- "ByteArrayAdapter::getFloat(i) - Not enough data to fill a long long." );
+ if (index < 0 || index >= this->getFloatCapacity()) {
+ throw IndexOutOfBoundsException(__FILE__, __LINE__, "ByteArrayAdapter::getFloat(i) - Not enough data to fill a long long.");
}
- return this->array.floats[ index ];
+ return this->array.floats[index];
}
- DECAF_CATCH_RETHROW( IndexOutOfBoundsException )
- DECAF_CATCH_EXCEPTION_CONVERT( Exception, IndexOutOfBoundsException )
- DECAF_CATCHALL_THROW( IndexOutOfBoundsException )
+ DECAF_CATCH_RETHROW(IndexOutOfBoundsException)
+ DECAF_CATCH_EXCEPTION_CONVERT(Exception, IndexOutOfBoundsException)
+ DECAF_CATCHALL_THROW(IndexOutOfBoundsException)
}
////////////////////////////////////////////////////////////////////////////////
-float ByteArrayAdapter::getFloatAt( int index ) const {
+float ByteArrayAdapter::getFloatAt(int index) const {
- try{
+ try {
- unsigned int ivalue = this->getIntAt( index );
- return Float::intBitsToFloat( ivalue );
+ unsigned int ivalue = this->getIntAt(index);
+ return Float::intBitsToFloat(ivalue);
}
- DECAF_CATCH_RETHROW( IndexOutOfBoundsException )
- DECAF_CATCH_EXCEPTION_CONVERT( Exception, IndexOutOfBoundsException )
- DECAF_CATCHALL_THROW( IndexOutOfBoundsException )
+ DECAF_CATCH_RETHROW(IndexOutOfBoundsException)
+ DECAF_CATCH_EXCEPTION_CONVERT(Exception, IndexOutOfBoundsException)
+ DECAF_CATCHALL_THROW(IndexOutOfBoundsException)
}
////////////////////////////////////////////////////////////////////////////////
-long long ByteArrayAdapter::getLong( int index ) const {
+long long ByteArrayAdapter::getLong(int index) const {
- try{
+ try {
- if( index < 0 || index >= this->getLongCapacity() ) {
- throw IndexOutOfBoundsException(
- __FILE__, __LINE__,
- "ByteArrayAdapter::getLong(i) - Not enough data to fill a long long." );
+ if (index < 0 || index >= this->getLongCapacity()) {
+ throw IndexOutOfBoundsException(__FILE__, __LINE__, "ByteArrayAdapter::getLong(i) - Not enough data to fill a long long.");
}
- return this->array.longs[ index ];
+ return this->array.longs[index];
}
- DECAF_CATCH_RETHROW( IndexOutOfBoundsException )
- DECAF_CATCH_EXCEPTION_CONVERT( Exception, IndexOutOfBoundsException )
- DECAF_CATCHALL_THROW( IndexOutOfBoundsException )
+ DECAF_CATCH_RETHROW(IndexOutOfBoundsException)
+ DECAF_CATCH_EXCEPTION_CONVERT(Exception, IndexOutOfBoundsException)
+ DECAF_CATCHALL_THROW(IndexOutOfBoundsException)
}
////////////////////////////////////////////////////////////////////////////////
-long long ByteArrayAdapter::getLongAt( int index ) const {
+long long ByteArrayAdapter::getLongAt(int index) const {
- try{
+ try {
- if( index < 0 || ( index + (int)sizeof( long long ) ) > this->getCapacity() ) {
- throw IndexOutOfBoundsException(
- __FILE__, __LINE__,
- "ByteArrayAdapter::getLong(i) - Not enough data to fill a long long." );
+ if (index < 0 || (index + (int) sizeof(long long)) > this->getCapacity()) {
+ throw IndexOutOfBoundsException(__FILE__, __LINE__, "ByteArrayAdapter::getLong(i) - Not enough data to fill a long long.");
}
unsigned long long value = 0;
- unsigned char buffer[sizeof(value)] = {0};
- this->read( buffer, sizeof(value), index, sizeof(value) );
+ unsigned char buffer[sizeof(value)] = { 0 };
+ this->read(buffer, sizeof(value), index, sizeof(value));
// Have to do it this way because on Solaris and Cygwin we get all
// kinds of warnings when shifting a byte up into a long long.
@@ -467,314 +429,292 @@ long long ByteArrayAdapter::getLongAt( i
unsigned long long byte7 = buffer[6] & 0x00000000000000FFULL;
unsigned long long byte8 = buffer[7] & 0x00000000000000FFULL;
- value = ( byte1 << 56 | byte2 << 48 | byte3 << 40 | byte4 << 32 |
- byte5 << 24 | byte6 << 16 | byte7 << 8 | byte8 << 0 );
+ value = (byte1 << 56 | byte2 << 48 | byte3 << 40 | byte4 << 32 | byte5 << 24 | byte6 << 16 | byte7 << 8 | byte8 << 0);
return value;
}
- DECAF_CATCH_RETHROW( IndexOutOfBoundsException )
- DECAF_CATCH_EXCEPTION_CONVERT( Exception, IndexOutOfBoundsException )
- DECAF_CATCHALL_THROW( IndexOutOfBoundsException )
+ DECAF_CATCH_RETHROW(IndexOutOfBoundsException)
+ DECAF_CATCH_EXCEPTION_CONVERT(Exception, IndexOutOfBoundsException)
+ DECAF_CATCHALL_THROW(IndexOutOfBoundsException)
}
////////////////////////////////////////////////////////////////////////////////
-int ByteArrayAdapter::getInt( int index ) const {
+int ByteArrayAdapter::getInt(int index) const {
- try{
+ try {
- if( index < 0 || index >= this->getIntCapacity() ) {
- throw IndexOutOfBoundsException(
- __FILE__, __LINE__,
- "ByteArrayAdapter::getInt(i) - Not enough data to fill an int." );
+ if (index < 0 || index >= this->getIntCapacity()) {
+ throw IndexOutOfBoundsException(__FILE__, __LINE__, "ByteArrayAdapter::getInt(i) - Not enough data to fill an int.");
}
- return this->array.ints[ index ];
+ return this->array.ints[index];
}
- DECAF_CATCH_RETHROW( IndexOutOfBoundsException )
- DECAF_CATCH_EXCEPTION_CONVERT( Exception, IndexOutOfBoundsException )
- DECAF_CATCHALL_THROW( IndexOutOfBoundsException )
+ DECAF_CATCH_RETHROW(IndexOutOfBoundsException)
+ DECAF_CATCH_EXCEPTION_CONVERT(Exception, IndexOutOfBoundsException)
+ DECAF_CATCHALL_THROW(IndexOutOfBoundsException)
}
////////////////////////////////////////////////////////////////////////////////
-int ByteArrayAdapter::getIntAt( int index ) const {
+int ByteArrayAdapter::getIntAt(int index) const {
- try{
+ try {
- if( index < 0 || ( index + (int)sizeof(int) ) > this->getCapacity() ) {
- throw IndexOutOfBoundsException(
- __FILE__, __LINE__,
- "ByteArrayAdapter::getInt(i) - Not enough data to fill an int." );
+ if (index < 0 || (index + (int) sizeof(int)) > this->getCapacity()) {
+ throw IndexOutOfBoundsException(__FILE__, __LINE__, "ByteArrayAdapter::getInt(i) - Not enough data to fill an int.");
}
unsigned int value = 0;
- unsigned char buffer[sizeof(value)] = {0};
- this->read( buffer, sizeof(value), index, sizeof(value) );
- value |= (buffer[0] << 24 | buffer[1] << 16 |
- buffer[2] << 8 | buffer[3] << 0);
+ unsigned char buffer[sizeof(value)] = { 0 };
+ this->read(buffer, sizeof(value), index, sizeof(value));
+ value |= (buffer[0] << 24 | buffer[1] << 16 | buffer[2] << 8 | buffer[3] << 0);
return value;
}
- DECAF_CATCH_RETHROW( IndexOutOfBoundsException )
- DECAF_CATCH_EXCEPTION_CONVERT( Exception, IndexOutOfBoundsException )
- DECAF_CATCHALL_THROW( IndexOutOfBoundsException )
+ DECAF_CATCH_RETHROW(IndexOutOfBoundsException)
+ DECAF_CATCH_EXCEPTION_CONVERT(Exception, IndexOutOfBoundsException)
+ DECAF_CATCHALL_THROW(IndexOutOfBoundsException)
}
////////////////////////////////////////////////////////////////////////////////
-short ByteArrayAdapter::getShort( int index ) const {
+short ByteArrayAdapter::getShort(int index) const {
- try{
+ try {
- if( index < 0 || index >= this->getShortCapacity() ) {
- throw IndexOutOfBoundsException(
- __FILE__, __LINE__,
- "ByteArrayAdapter::getShort(i) - Not enough data to fill a short." );
+ if (index < 0 || index >= this->getShortCapacity()) {
+ throw IndexOutOfBoundsException(__FILE__, __LINE__, "ByteArrayAdapter::getShort(i) - Not enough data to fill a short.");
}
- return this->array.shorts[ index ];
+ return this->array.shorts[index];
}
- DECAF_CATCH_RETHROW( IndexOutOfBoundsException )
- DECAF_CATCH_EXCEPTION_CONVERT( Exception, IndexOutOfBoundsException )
- DECAF_CATCHALL_THROW( IndexOutOfBoundsException )
+ DECAF_CATCH_RETHROW(IndexOutOfBoundsException)
+ DECAF_CATCH_EXCEPTION_CONVERT(Exception, IndexOutOfBoundsException)
+ DECAF_CATCHALL_THROW(IndexOutOfBoundsException)
}
////////////////////////////////////////////////////////////////////////////////
-short ByteArrayAdapter::getShortAt( int index ) const {
+short ByteArrayAdapter::getShortAt(int index) const {
- try{
+ try {
- if( index < 0 || ( index + (int)sizeof(short) ) > this->getCapacity() ) {
- throw IndexOutOfBoundsException(
- __FILE__, __LINE__,
- "ByteArrayAdapter::getShort(i) - Not enough data to fill a short." );
+ if (index < 0 || (index + (int) sizeof(short)) > this->getCapacity()) {
+ throw IndexOutOfBoundsException(__FILE__, __LINE__, "ByteArrayAdapter::getShort(i) - Not enough data to fill a short.");
}
short value = 0;
- unsigned char buffer[sizeof(value)] = {0};
- this->read( buffer, sizeof(value), index, sizeof(value) );
- value |= (short)(buffer[0] << 8 | buffer[1] << 0);
+ unsigned char buffer[sizeof(value)] = { 0 };
+ this->read(buffer, sizeof(value), index, sizeof(value));
+ value |= (short) (buffer[0] << 8 | buffer[1] << 0);
return value;
}
- DECAF_CATCH_RETHROW( IndexOutOfBoundsException )
- DECAF_CATCH_EXCEPTION_CONVERT( Exception, IndexOutOfBoundsException )
- DECAF_CATCHALL_THROW( IndexOutOfBoundsException )
+ DECAF_CATCH_RETHROW(IndexOutOfBoundsException)
+ DECAF_CATCH_EXCEPTION_CONVERT(Exception, IndexOutOfBoundsException)
+ DECAF_CATCHALL_THROW(IndexOutOfBoundsException)
}
////////////////////////////////////////////////////////////////////////////////
-ByteArrayAdapter& ByteArrayAdapter::put( int index, unsigned char value ) {
+ByteArrayAdapter& ByteArrayAdapter::put(int index, unsigned char value) {
- try{
+ try {
- if( index < 0 || index >= this->getCapacity() ) {
- throw IndexOutOfBoundsException(
- __FILE__, __LINE__,
- "ByteArrayAdapter::put(i,i) - Not enough data to fill request." );
+ if (index < 0 || index >= this->getCapacity()) {
+ throw IndexOutOfBoundsException(__FILE__, __LINE__, "ByteArrayAdapter::put(i,i) - Not enough data to fill request.");
}
(*this)[index] = value;
return *this;
}
- DECAF_CATCH_RETHROW( IndexOutOfBoundsException )
- DECAF_CATCH_EXCEPTION_CONVERT( Exception, IndexOutOfBoundsException )
- DECAF_CATCHALL_THROW( IndexOutOfBoundsException )
+ DECAF_CATCH_RETHROW(IndexOutOfBoundsException)
+ DECAF_CATCH_EXCEPTION_CONVERT(Exception, IndexOutOfBoundsException)
+ DECAF_CATCHALL_THROW(IndexOutOfBoundsException)
}
////////////////////////////////////////////////////////////////////////////////
-ByteArrayAdapter& ByteArrayAdapter::putChar( int index, char value ) {
+ByteArrayAdapter& ByteArrayAdapter::putChar(int index, char value) {
- try{
+ try {
- this->put( index, value );
+ this->put(index, value);
return *this;
}
- DECAF_CATCH_RETHROW( IndexOutOfBoundsException )
- DECAF_CATCH_EXCEPTION_CONVERT( Exception, IndexOutOfBoundsException )
- DECAF_CATCHALL_THROW( IndexOutOfBoundsException )
+ DECAF_CATCH_RETHROW(IndexOutOfBoundsException)
+ DECAF_CATCH_EXCEPTION_CONVERT(Exception, IndexOutOfBoundsException)
+ DECAF_CATCHALL_THROW(IndexOutOfBoundsException)
}
////////////////////////////////////////////////////////////////////////////////
-ByteArrayAdapter& ByteArrayAdapter::putDouble( int index, double value ) {
+ByteArrayAdapter& ByteArrayAdapter::putDouble(int index, double value) {
- try{
+ try {
- if( index < 0 || index >= this->getDoubleCapacity() ) {
- throw IndexOutOfBoundsException(
- __FILE__, __LINE__,
- "ByteArrayAdapter::putDouble(i,i) - Not enough data to fill request." );
+ if (index < 0 || index >= this->getDoubleCapacity()) {
+ throw IndexOutOfBoundsException(__FILE__, __LINE__, "ByteArrayAdapter::putDouble(i,i) - Not enough data to fill request.");
}
- this->array.doubles[ index ] = value;
+ this->array.doubles[index] = value;
return *this;
}
- DECAF_CATCH_RETHROW( IndexOutOfBoundsException )
- DECAF_CATCH_EXCEPTION_CONVERT( Exception, IndexOutOfBoundsException )
- DECAF_CATCHALL_THROW( IndexOutOfBoundsException )
+ DECAF_CATCH_RETHROW(IndexOutOfBoundsException)
+ DECAF_CATCH_EXCEPTION_CONVERT(Exception, IndexOutOfBoundsException)
+ DECAF_CATCHALL_THROW(IndexOutOfBoundsException)
}
////////////////////////////////////////////////////////////////////////////////
-ByteArrayAdapter& ByteArrayAdapter::putDoubleAt( int index, double value ) {
+ByteArrayAdapter& ByteArrayAdapter::putDoubleAt(int index, double value) {
- try{
+ try {
- this->putLongAt( index, Double::doubleToLongBits( value ) );
+ this->putLongAt(index, Double::doubleToLongBits(value));
return *this;
}
- DECAF_CATCH_RETHROW( IndexOutOfBoundsException )
- DECAF_CATCH_EXCEPTION_CONVERT( Exception, IndexOutOfBoundsException )
- DECAF_CATCHALL_THROW( IndexOutOfBoundsException )
+ DECAF_CATCH_RETHROW(IndexOutOfBoundsException)
+ DECAF_CATCH_EXCEPTION_CONVERT(Exception, IndexOutOfBoundsException)
+ DECAF_CATCHALL_THROW(IndexOutOfBoundsException)
}
////////////////////////////////////////////////////////////////////////////////
-ByteArrayAdapter& ByteArrayAdapter::putFloat( int index, float value ) {
+ByteArrayAdapter& ByteArrayAdapter::putFloat(int index, float value) {
- try{
+ try {
- if( index < 0 || index >= this->getFloatCapacity() ) {
- throw IndexOutOfBoundsException(
- __FILE__, __LINE__,
- "ByteArrayAdapter::putFloat(i,i) - Not enough data to fill request." );
+ if (index < 0 || index >= this->getFloatCapacity()) {
+ throw IndexOutOfBoundsException(__FILE__, __LINE__, "ByteArrayAdapter::putFloat(i,i) - Not enough data to fill request.");
}
this->array.floats[index] = value;
return *this;
}
- DECAF_CATCH_RETHROW( IndexOutOfBoundsException )
- DECAF_CATCH_EXCEPTION_CONVERT( Exception, IndexOutOfBoundsException )
- DECAF_CATCHALL_THROW( IndexOutOfBoundsException )
+ DECAF_CATCH_RETHROW(IndexOutOfBoundsException)
+ DECAF_CATCH_EXCEPTION_CONVERT(Exception, IndexOutOfBoundsException)
+ DECAF_CATCHALL_THROW(IndexOutOfBoundsException)
}
////////////////////////////////////////////////////////////////////////////////
-ByteArrayAdapter& ByteArrayAdapter::putFloatAt( int index, float value ) {
+ByteArrayAdapter& ByteArrayAdapter::putFloatAt(int index, float value) {
- try{
+ try {
- this->putIntAt( index, Float::floatToIntBits( value ) );
+ this->putIntAt(index, Float::floatToIntBits(value));
return *this;
}
- DECAF_CATCH_RETHROW( IndexOutOfBoundsException )
- DECAF_CATCH_EXCEPTION_CONVERT( Exception, IndexOutOfBoundsException )
- DECAF_CATCHALL_THROW( IndexOutOfBoundsException )
+ DECAF_CATCH_RETHROW(IndexOutOfBoundsException)
+ DECAF_CATCH_EXCEPTION_CONVERT(Exception, IndexOutOfBoundsException)
+ DECAF_CATCHALL_THROW(IndexOutOfBoundsException)
}
////////////////////////////////////////////////////////////////////////////////
-ByteArrayAdapter& ByteArrayAdapter::putLong( int index, long long value ) {
+ByteArrayAdapter& ByteArrayAdapter::putLong(int index, long long value) {
- try{
+ try {
- if( index < 0 || index >= this->getLongCapacity() ) {
- throw IndexOutOfBoundsException(
- __FILE__, __LINE__,
- "ByteArrayAdapter::putLong(i,i) - Not enough data to fill request." );
+ if (index < 0 || index >= this->getLongCapacity()) {
+ throw IndexOutOfBoundsException(__FILE__, __LINE__, "ByteArrayAdapter::putLong(i,i) - Not enough data to fill request.");
}
this->array.longs[index] = value;
return *this;
}
- DECAF_CATCH_RETHROW( IndexOutOfBoundsException )
- DECAF_CATCH_EXCEPTION_CONVERT( Exception, IndexOutOfBoundsException )
- DECAF_CATCHALL_THROW( IndexOutOfBoundsException )
+ DECAF_CATCH_RETHROW(IndexOutOfBoundsException)
+ DECAF_CATCH_EXCEPTION_CONVERT(Exception, IndexOutOfBoundsException)
+ DECAF_CATCHALL_THROW(IndexOutOfBoundsException)
}
////////////////////////////////////////////////////////////////////////////////
-ByteArrayAdapter& ByteArrayAdapter::putLongAt( int index, long long value ) {
+ByteArrayAdapter& ByteArrayAdapter::putLongAt(int index, long long value) {
- try{
+ try {
unsigned char buffer[sizeof(value)];
- buffer[0] = (unsigned char)((value & 0xFF00000000000000ULL) >> 56);
- buffer[1] = (unsigned char)((value & 0x00FF000000000000ULL) >> 48);
- buffer[2] = (unsigned char)((value & 0x0000FF0000000000ULL) >> 40);
- buffer[3] = (unsigned char)((value & 0x000000FF00000000ULL) >> 32);
- buffer[4] = (unsigned char)((value & 0x00000000FF000000ULL) >> 24);
- buffer[5] = (unsigned char)((value & 0x0000000000FF0000ULL) >> 16);
- buffer[6] = (unsigned char)((value & 0x000000000000FF00ULL) >> 8);
- buffer[7] = (unsigned char)((value & 0x00000000000000FFULL) >> 0);
+ buffer[0] = (unsigned char) ((value & 0xFF00000000000000ULL) >> 56);
+ buffer[1] = (unsigned char) ((value & 0x00FF000000000000ULL) >> 48);
+ buffer[2] = (unsigned char) ((value & 0x0000FF0000000000ULL) >> 40);
+ buffer[3] = (unsigned char) ((value & 0x000000FF00000000ULL) >> 32);
+ buffer[4] = (unsigned char) ((value & 0x00000000FF000000ULL) >> 24);
+ buffer[5] = (unsigned char) ((value & 0x0000000000FF0000ULL) >> 16);
+ buffer[6] = (unsigned char) ((value & 0x000000000000FF00ULL) >> 8);
+ buffer[7] = (unsigned char) ((value & 0x00000000000000FFULL) >> 0);
- this->write( buffer, sizeof(value), index, sizeof(value) );
+ this->write(buffer, sizeof(value), index, sizeof(value));
return *this;
}
- DECAF_CATCH_RETHROW( IndexOutOfBoundsException )
- DECAF_CATCH_EXCEPTION_CONVERT( Exception, IndexOutOfBoundsException )
- DECAF_CATCHALL_THROW( IndexOutOfBoundsException )
+ DECAF_CATCH_RETHROW(IndexOutOfBoundsException)
+ DECAF_CATCH_EXCEPTION_CONVERT(Exception, IndexOutOfBoundsException)
+ DECAF_CATCHALL_THROW(IndexOutOfBoundsException)
}
////////////////////////////////////////////////////////////////////////////////
-ByteArrayAdapter& ByteArrayAdapter::putInt( int index, int value ) {
+ByteArrayAdapter& ByteArrayAdapter::putInt(int index, int value) {
- try{
+ try {
- if( index < 0 || index >= this->getIntCapacity() ) {
- throw IndexOutOfBoundsException(
- __FILE__, __LINE__,
- "ByteArrayAdapter::putInt(i,i) - Not enough data to fill request." );
+ if (index < 0 || index >= this->getIntCapacity()) {
+ throw IndexOutOfBoundsException(__FILE__, __LINE__, "ByteArrayAdapter::putInt(i,i) - Not enough data to fill request.");
}
this->array.ints[index] = value;
return *this;
}
- DECAF_CATCH_RETHROW( IndexOutOfBoundsException )
- DECAF_CATCH_EXCEPTION_CONVERT( Exception, IndexOutOfBoundsException )
- DECAF_CATCHALL_THROW( IndexOutOfBoundsException )
+ DECAF_CATCH_RETHROW(IndexOutOfBoundsException)
+ DECAF_CATCH_EXCEPTION_CONVERT(Exception, IndexOutOfBoundsException)
+ DECAF_CATCHALL_THROW(IndexOutOfBoundsException)
}
////////////////////////////////////////////////////////////////////////////////
-ByteArrayAdapter& ByteArrayAdapter::putIntAt( int index, int value ) {
+ByteArrayAdapter& ByteArrayAdapter::putIntAt(int index, int value) {
- try{
+ try {
unsigned char buffer[sizeof(value)];
- buffer[0] = (unsigned char)((value & 0xFF000000) >> 24);
- buffer[1] = (unsigned char)((value & 0x00FF0000) >> 16);
- buffer[2] = (unsigned char)((value & 0x0000FF00) >> 8);
- buffer[3] = (unsigned char)((value & 0x000000FF) >> 0);
+ buffer[0] = (unsigned char) ((value & 0xFF000000) >> 24);
+ buffer[1] = (unsigned char) ((value & 0x00FF0000) >> 16);
+ buffer[2] = (unsigned char) ((value & 0x0000FF00) >> 8);
+ buffer[3] = (unsigned char) ((value & 0x000000FF) >> 0);
- this->write( buffer, sizeof(value), index, sizeof(value) );
+ this->write(buffer, sizeof(value), index, sizeof(value));
return *this;
}
- DECAF_CATCH_RETHROW( IndexOutOfBoundsException )
- DECAF_CATCH_EXCEPTION_CONVERT( Exception, IndexOutOfBoundsException )
- DECAF_CATCHALL_THROW( IndexOutOfBoundsException )
+ DECAF_CATCH_RETHROW(IndexOutOfBoundsException)
+ DECAF_CATCH_EXCEPTION_CONVERT(Exception, IndexOutOfBoundsException)
+ DECAF_CATCHALL_THROW(IndexOutOfBoundsException)
}
////////////////////////////////////////////////////////////////////////////////
-ByteArrayAdapter& ByteArrayAdapter::putShort( int index, short value ) {
+ByteArrayAdapter& ByteArrayAdapter::putShort(int index, short value) {
- try{
+ try {
- if( index < 0 || index >= this->getShortCapacity() ) {
- throw IndexOutOfBoundsException(
- __FILE__, __LINE__,
- "ByteArrayAdapter::putShort(i,i) - Not enough data to fill request." );
+ if (index < 0 || index >= this->getShortCapacity()) {
+ throw IndexOutOfBoundsException(__FILE__, __LINE__, "ByteArrayAdapter::putShort(i,i) - Not enough data to fill request.");
}
this->array.shorts[index] = value;
return *this;
}
- DECAF_CATCH_RETHROW( IndexOutOfBoundsException )
- DECAF_CATCH_EXCEPTION_CONVERT( Exception, IndexOutOfBoundsException )
- DECAF_CATCHALL_THROW( IndexOutOfBoundsException )
+ DECAF_CATCH_RETHROW(IndexOutOfBoundsException)
+ DECAF_CATCH_EXCEPTION_CONVERT(Exception, IndexOutOfBoundsException)
+ DECAF_CATCHALL_THROW(IndexOutOfBoundsException)
}
////////////////////////////////////////////////////////////////////////////////
-ByteArrayAdapter& ByteArrayAdapter::putShortAt( int index, short value ) {
+ByteArrayAdapter& ByteArrayAdapter::putShortAt(int index, short value) {
- try{
+ try {
unsigned char buffer[sizeof(value)];
- buffer[0] = (unsigned char)((value & 0xFF00) >> 8);
- buffer[1] = (unsigned char)((value & 0x00FF) >> 0);
+ buffer[0] = (unsigned char) ((value & 0xFF00) >> 8);
+ buffer[1] = (unsigned char) ((value & 0x00FF) >> 0);
- this->write( buffer, sizeof(value), index, sizeof(value) );
+ this->write(buffer, sizeof(value), index, sizeof(value));
return *this;
}
- DECAF_CATCH_RETHROW( IndexOutOfBoundsException )
- DECAF_CATCH_EXCEPTION_CONVERT( Exception, IndexOutOfBoundsException )
- DECAF_CATCHALL_THROW( IndexOutOfBoundsException )
+ DECAF_CATCH_RETHROW(IndexOutOfBoundsException)
+ DECAF_CATCH_EXCEPTION_CONVERT(Exception, IndexOutOfBoundsException)
+ DECAF_CATCHALL_THROW(IndexOutOfBoundsException)
}
Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/util/ByteArrayAdapter.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/util/ByteArrayAdapter.h?rev=1399831&r1=1399830&r2=1399831&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/util/ByteArrayAdapter.h (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/util/ByteArrayAdapter.h Thu Oct 18 20:21:44 2012
@@ -25,9 +25,9 @@
#include <decaf/nio/BufferUnderflowException.h>
#include <decaf/nio/BufferOverflowException.h>
-namespace decaf{
-namespace internal{
-namespace util{
+namespace decaf {
+namespace internal {
+namespace util {
/**
* This class adapts primitive type arrays to a base byte array so that the
@@ -76,7 +76,7 @@ namespace util{
*
* @throws IllegalArgumentException if size is negative.
*/
- ByteArrayAdapter( int size );
+ ByteArrayAdapter(int size);
/**
* Creates a byte array object that wraps the given array. If the own flag
@@ -92,7 +92,7 @@ namespace util{
* @throws NullPointerException if buffer is NULL
* @throws IndexOutOfBoundsException if the size is negative.
*/
- ByteArrayAdapter( unsigned char* array, int size, bool own = false );
+ ByteArrayAdapter(unsigned char* array, int size, bool own = false);
/**
* Creates a byte array object that wraps the given array. If the own flag
@@ -108,7 +108,7 @@ namespace util{
* @throws NullPointerException if buffer is NULL
* @throws IndexOutOfBoundsException if the size is negative.
*/
- ByteArrayAdapter( char* array, int size, bool own = false );
+ ByteArrayAdapter(char* array, int size, bool own = false);
/**
* Creates a byte array object that wraps the given array. If the own flag
@@ -124,7 +124,7 @@ namespace util{
* @throws NullPointerException if buffer is NULL
* @throws IndexOutOfBoundsException if the size is negative.
*/
- ByteArrayAdapter( double* array, int size, bool own = false );
+ ByteArrayAdapter(double* array, int size, bool own = false);
/**
* Creates a byte array object that wraps the given array. If the own flag
@@ -140,7 +140,7 @@ namespace util{
* @throws NullPointerException if buffer is NULL
* @throws IndexOutOfBoundsException if the size is negative.
*/
- ByteArrayAdapter( float* array, int size, bool own = false );
+ ByteArrayAdapter(float* array, int size, bool own = false);
/**
* Creates a byte array object that wraps the given array. If the own flag
@@ -156,7 +156,7 @@ namespace util{
* @throws NullPointerException if buffer is NULL
* @throws IndexOutOfBoundsException if the size is negative.
*/
- ByteArrayAdapter( long long* array, int size, bool own = false );
+ ByteArrayAdapter(long long* array, int size, bool own = false);
/**
* Creates a byte array object that wraps the given array. If the own flag
@@ -172,7 +172,7 @@ namespace util{
* @throws NullPointerException if buffer is NULL
* @throws IndexOutOfBoundsException if the size is negative.
*/
- ByteArrayAdapter( int* array, int size, bool own = false );
+ ByteArrayAdapter(int* array, int size, bool own = false);
/**
* Creates a byte array object that wraps the given array. If the own flag
@@ -188,7 +188,7 @@ namespace util{
* @throws NullPointerException if buffer is NULL
* @throws IndexOutOfBoundsException if the size is negative.
*/
- ByteArrayAdapter( short* array, int size, bool own = false );
+ ByteArrayAdapter(short* array, int size, bool own = false);
virtual ~ByteArrayAdapter();
@@ -213,7 +213,7 @@ namespace util{
* @return the size the array.
*/
virtual int getDoubleCapacity() const {
- return this->size / (int)sizeof( double );
+ return this->size / (int) sizeof(double);
}
/**
@@ -221,7 +221,7 @@ namespace util{
* @return the size the array.
*/
virtual int getFloatCapacity() const {
- return this->size / (int)sizeof( float );
+ return this->size / (int) sizeof(float);
}
/**
@@ -229,7 +229,7 @@ namespace util{
* @return the size the array.
*/
virtual int getLongCapacity() const {
- return this->size / (int)sizeof( long long );
+ return this->size / (int) sizeof(long long);
}
/**
@@ -237,7 +237,7 @@ namespace util{
* @return the size the array.
*/
virtual int getIntCapacity() const {
- return this->size / (int)sizeof( int );
+ return this->size / (int) sizeof(int);
}
/**
@@ -245,7 +245,7 @@ namespace util{
* @return the size the array.
*/
virtual int getShortCapacity() const {
- return this->size / (int)sizeof( short );
+ return this->size / (int) sizeof(short);
}
/**
@@ -330,7 +330,7 @@ namespace util{
* @throws BufferUnderflowException if there is not enough data to read
* because the offset or the length is greater than the size of this array.
*/
- virtual void read( unsigned char* buffer, int size, int offset, int length ) const;
+ virtual void read(unsigned char* buffer, int size, int offset, int length) const;
/**
* Writes from the Byte array given, starting at the specified offset and writing
@@ -352,7 +352,7 @@ namespace util{
* @throws BufferOverflowException if the amount of data to be written to this
* array or the offset given are larger than this array's size.
*/
- virtual void write( unsigned char* buffer, int size, int offset, int length );
+ virtual void write(unsigned char* buffer, int size, int offset, int length);
/**
* Resizes the underlying array to the new given size, preserving all the
@@ -369,7 +369,7 @@ namespace util{
* @throws IllegalArgumentException if the size parameter is negative.
* @throws InvalidStateException if this object does not own the buffer.
*/
- virtual void resize( int size );
+ virtual void resize(int size);
/**
* Clear all data from that Array, setting the underlying bytes to zero.
@@ -387,8 +387,8 @@ namespace util{
*
* @throws IndexOutOfBoundsException if the preconditions of index are not met.
*/
- unsigned char& operator[]( int index );
- const unsigned char& operator[]( int index ) const;
+ unsigned char& operator[](int index);
+ const unsigned char& operator[](int index) const;
/**
* Absolute get method. Reads the byte at the given index.
@@ -401,7 +401,7 @@ namespace util{
* @throws IndexOutOfBoundsException If index is not smaller than the
* buffer's limit or is negative.
*/
- virtual unsigned char get( int index ) const;
+ virtual unsigned char get(int index) const;
/**
* Reads one byte at the given index and returns it.
@@ -414,7 +414,7 @@ namespace util{
* @throws IndexOutOfBoundsException If index is not smaller than the
* buffer's limit or is negative.
*/
- virtual char getChar( int index ) const;
+ virtual char getChar(int index) const;
/**
* Reads eight bytes at the given index and returns it. The index is a
@@ -430,7 +430,7 @@ namespace util{
* @throws IndexOutOfBoundsException if there are not enough bytes remaining
* to fill the requested Data Type, or index is negative.
*/
- virtual double getDouble( int index ) const;
+ virtual double getDouble(int index) const;
/**
* Reads eight bytes at the given byte index and returns it.
@@ -443,7 +443,7 @@ namespace util{
* @throws IndexOutOfBoundsException if there are not enough bytes remaining
* to fill the requested Data Type, or index is negative.
*/
- virtual double getDoubleAt( int index ) const;
+ virtual double getDoubleAt(int index) const;
/**
* Reads four bytes at the given index and returns it. The index is a
@@ -459,7 +459,7 @@ namespace util{
* @throws IndexOutOfBoundsException if there are not enough bytes remaining
* to fill the requested Data Type, or index is negative.
*/
- virtual float getFloat( int index ) const;
+ virtual float getFloat(int index) const;
/**
* Reads four bytes at the given byte index and returns it
@@ -472,7 +472,7 @@ namespace util{
* @throws IndexOutOfBoundsException if there are not enough bytes remaining
* to fill the requested Data Type, or index is negative.
*/
- virtual float getFloatAt( int index ) const;
+ virtual float getFloatAt(int index) const;
/**
* Reads eight bytes at the given index and returns it. The index is a
@@ -488,7 +488,7 @@ namespace util{
* @throws IndexOutOfBoundsException if there are not enough bytes remaining
* to fill the requested Data Type, or index is negative.
*/
- virtual long long getLong( int index ) const;
+ virtual long long getLong(int index) const;
/**
* Reads eight bytes at the given byte index and returns it.
@@ -501,7 +501,7 @@ namespace util{
* @throws IndexOutOfBoundsException if there are not enough bytes remaining
* to fill the requested Data Type, or index is negative.
*/
- virtual long long getLongAt( int index ) const;
+ virtual long long getLongAt(int index) const;
/**
* Reads four bytes at the given index and returns it. The index is a
@@ -517,7 +517,7 @@ namespace util{
* @throws IndexOutOfBoundsException if there are not enough bytes remaining
* to fill the requested Data Type, or index is negative.
*/
- virtual int getInt( int index ) const;
+ virtual int getInt(int index) const;
/**
* Reads four bytes at the given byte index and returns it.
@@ -530,7 +530,7 @@ namespace util{
* @throws IndexOutOfBoundsException if there are not enough bytes remaining
* to fill the requested Data Type, or index is negative.
*/
- virtual int getIntAt( int index ) const;
+ virtual int getIntAt(int index) const;
/**
* Reads two bytes at the given index and returns it. The index is a
@@ -546,7 +546,7 @@ namespace util{
* @throws IndexOutOfBoundsException if there are not enough bytes remaining
* to fill the requested Data Type, or index is negative.
*/
- virtual short getShort( int index ) const;
+ virtual short getShort(int index) const;
/**
* Reads two bytes at the given byte index and returns it.
@@ -559,7 +559,7 @@ namespace util{
* @throws IndexOutOfBoundsException if there are not enough bytes remaining
* to fill the requested Data Type, or index is negative.
*/
- virtual short getShortAt( int index ) const;
+ virtual short getShortAt(int index) const;
/**
* Writes the given byte into this buffer at the given index. The index is a
@@ -577,7 +577,7 @@ namespace util{
* @throw IndexOutOfBoundsException if index greater than the buffer's limit
* minus the size of the type being written, or index is negative.
*/
- virtual ByteArrayAdapter& put( int index, unsigned char value );
+ virtual ByteArrayAdapter& put(int index, unsigned char value);
/**
* Writes one byte containing the given value, into this buffer at the
@@ -595,7 +595,7 @@ namespace util{
* @throw IndexOutOfBoundsException if index greater than the buffer's limit
* minus the size of the type being written, or index is negative.
*/
- virtual ByteArrayAdapter& putChar( int index, char value );
+ virtual ByteArrayAdapter& putChar(int index, char value);
/**
* Writes eight bytes containing the given value, into this buffer at the
@@ -613,7 +613,7 @@ namespace util{
* @throw IndexOutOfBoundsException if index greater than the buffer's limit
* minus the size of the type being written, or index is negative.
*/
- virtual ByteArrayAdapter& putDouble( int index, double value );
+ virtual ByteArrayAdapter& putDouble(int index, double value);
/**
* Writes eight bytes containing the given value, into this buffer at the
@@ -629,7 +629,7 @@ namespace util{
* @throw IndexOutOfBoundsException if index greater than the buffer's limit
* minus the size of the type being written, or index is negative.
*/
- virtual ByteArrayAdapter& putDoubleAt( int index, double value );
+ virtual ByteArrayAdapter& putDoubleAt(int index, double value);
/**
* Writes four bytes containing the given value, into this buffer at the
@@ -647,7 +647,7 @@ namespace util{
* @throw IndexOutOfBoundsException if index greater than the buffer's limit
* minus the size of the type being written, or index is negative.
*/
- virtual ByteArrayAdapter& putFloat( int index, float value );
+ virtual ByteArrayAdapter& putFloat(int index, float value);
/**
* Writes four bytes containing the given value, into this buffer at the
@@ -663,7 +663,7 @@ namespace util{
* @throw IndexOutOfBoundsException if index greater than the buffer's limit
* minus the size of the type being written, or index is negative.
*/
- virtual ByteArrayAdapter& putFloatAt( int index, float value );
+ virtual ByteArrayAdapter& putFloatAt(int index, float value);
/**
* Writes eight bytes containing the given value, into this buffer at the
@@ -681,7 +681,7 @@ namespace util{
* @throw IndexOutOfBoundsException if index greater than the buffer's limit
* minus the size of the type being written, or index is negative.
*/
- virtual ByteArrayAdapter& putLong( int index, long long value );
+ virtual ByteArrayAdapter& putLong(int index, long long value);
/**
* Writes eight bytes containing the given value, into this buffer at the
@@ -697,7 +697,7 @@ namespace util{
* @throw IndexOutOfBoundsException if index greater than the buffer's limit
* minus the size of the type being written, or index is negative.
*/
- virtual ByteArrayAdapter& putLongAt( int index, long long value );
+ virtual ByteArrayAdapter& putLongAt(int index, long long value);
/**
* Writes four bytes containing the given value, into this buffer at the
@@ -715,7 +715,7 @@ namespace util{
* @throw IndexOutOfBoundsException if index greater than the buffer's limit
* minus the size of the type being written, or index is negative.
*/
- virtual ByteArrayAdapter& putInt( int index, int value );
+ virtual ByteArrayAdapter& putInt(int index, int value);
/**
* Writes four bytes containing the given value, into this buffer at the
@@ -731,7 +731,7 @@ namespace util{
* @throw IndexOutOfBoundsException if index greater than the buffer's limit
* minus the size of the type being written, or index is negative.
*/
- virtual ByteArrayAdapter& putIntAt( int index, int value );
+ virtual ByteArrayAdapter& putIntAt(int index, int value);
/**
* Writes two bytes containing the given value, into this buffer at the
@@ -749,7 +749,7 @@ namespace util{
* @throw IndexOutOfBoundsException if index greater than the buffer's limit
* minus the size of the type being written, or index is negative.
*/
- virtual ByteArrayAdapter& putShort( int index, short value );
+ virtual ByteArrayAdapter& putShort(int index, short value);
/**
* Writes two bytes containing the given value, into this buffer at the
@@ -765,11 +765,11 @@ namespace util{
* @throw IndexOutOfBoundsException if index greater than the buffer's limit
* minus the size of the type being written, or index is negative.
*/
- virtual ByteArrayAdapter& putShortAt( int index, short value );
+ virtual ByteArrayAdapter& putShortAt(int index, short value);
private:
- void initialize( unsigned char* buffer, int size, bool own );
+ void initialize(unsigned char* buffer, int size, bool own);
};
Added: activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/util/GenericResource.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/util/GenericResource.cpp?rev=1399831&view=auto
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/util/GenericResource.cpp (added)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/util/GenericResource.cpp Thu Oct 18 20:21:44 2012
@@ -0,0 +1,22 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "GenericResource.h"
+
+
+
+
Propchange: activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/util/GenericResource.cpp
------------------------------------------------------------------------------
svn:eol-style = native
Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/util/GenericResource.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/util/GenericResource.h?rev=1399831&r1=1399830&r2=1399831&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/util/GenericResource.h (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/internal/util/GenericResource.h Thu Oct 18 20:21:44 2012
@@ -33,32 +33,33 @@ namespace util {
* @since 1.0
*/
template<typename T>
- class GenericResource : public Resource {
+ class GenericResource: public Resource {
private:
T* managed;
private:
- GenericResource( const GenericResource& );
- GenericResource& operator= ( const GenericResource& );
+ GenericResource(const GenericResource&);
+ GenericResource& operator=(const GenericResource&);
public:
- explicit GenericResource( T* value ) : managed( value ) {
+ explicit GenericResource(T* value) : managed(value) {
}
virtual ~GenericResource() {
- try{
+ try {
delete managed;
- } catch(...) {}
+ } catch (...) {
+ }
}
T* getManaged() const {
return this->managed;
}
- void setManaged( T* value ) {
+ void setManaged(T* value) {
this->managed = value;
}