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/07/27 16:49:34 UTC
svn commit: r1366395 - in /activemq/activemq-cpp/trunk/activemq-cpp/src:
main/activemq/commands/ main/activemq/transport/ main/activemq/wireformat/
main/decaf/util/ test/activemq/commands/
Author: tabish
Date: Fri Jul 27 14:49:34 2012
New Revision: 1366395
URL: http://svn.apache.org/viewvc?rev=1366395&view=rev
Log:
Fix some issues with map size and iteration.
Modified:
activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/commands/ActiveMQMapMessage.cpp
activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/commands/ActiveMQMessageTemplate.h
activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/transport/TransportRegistry.cpp
activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/wireformat/WireFormatRegistry.cpp
activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/Collections.h
activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/Properties.cpp
activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/commands/ActiveMQMapMessageTest.cpp
Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/commands/ActiveMQMapMessage.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/commands/ActiveMQMapMessage.cpp?rev=1366395&r1=1366394&r2=1366395&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/commands/ActiveMQMapMessage.cpp (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/commands/ActiveMQMapMessage.cpp Fri Jul 27 14:49:34 2012
@@ -25,7 +25,6 @@
#include <decaf/io/BufferedInputStream.h>
#include <decaf/io/DataInputStream.h>
#include <decaf/io/DataOutputStream.h>
-#include <decaf/util/Collections.h>
#include <decaf/util/zip/DeflaterOutputStream.h>
#include <decaf/util/zip/InflaterInputStream.h>
@@ -205,7 +204,7 @@ bool ActiveMQMapMessage::isEmpty() const
std::vector<std::string> ActiveMQMapMessage::getMapNames() const {
try{
- return decaf::util::Collections::toStlVector<std::string>(getMap().keySet());
+ return getMap().keySet().toArray();
}
AMQ_CATCH_ALL_THROW_CMSEXCEPTION()
}
Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/commands/ActiveMQMessageTemplate.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/commands/ActiveMQMessageTemplate.h?rev=1366395&r1=1366394&r2=1366395&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/commands/ActiveMQMessageTemplate.h (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/commands/ActiveMQMessageTemplate.h Fri Jul 27 14:49:34 2012
@@ -28,7 +28,6 @@
#include <activemq/util/CMSExceptionSupport.h>
#include <decaf/lang/exceptions/UnsupportedOperationException.h>
-#include <decaf/util/Collections.h>
#include <cms/IllegalStateException.h>
#include <cms/MessageFormatException.h>
@@ -107,7 +106,7 @@ namespace commands {
virtual std::vector<std::string> getPropertyNames() const {
try {
- return decaf::util::Collections::toStlVector<std::string>(getMessageProperties().keySet());
+ return getMessageProperties().keySet().toArray();
}
AMQ_CATCH_ALL_THROW_CMSEXCEPTION()
}
Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/transport/TransportRegistry.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/transport/TransportRegistry.cpp?rev=1366395&r1=1366394&r2=1366395&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/transport/TransportRegistry.cpp (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/transport/TransportRegistry.cpp Fri Jul 27 14:49:34 2012
@@ -17,8 +17,6 @@
#include "TransportRegistry.h"
-#include <decaf/util/Collections.h>
-
using namespace std;
using namespace activemq;
using namespace activemq::transport;
@@ -92,7 +90,7 @@ void TransportRegistry::unregisterAllFac
////////////////////////////////////////////////////////////////////////////////
std::vector<std::string> TransportRegistry::getTransportNames() const {
- return Collections::toStlVector<std::string>(this->registry.keySet());
+ return this->registry.keySet().toArray();
}
////////////////////////////////////////////////////////////////////////////////
Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/wireformat/WireFormatRegistry.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/wireformat/WireFormatRegistry.cpp?rev=1366395&r1=1366394&r2=1366395&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/wireformat/WireFormatRegistry.cpp (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/wireformat/WireFormatRegistry.cpp Fri Jul 27 14:49:34 2012
@@ -17,8 +17,6 @@
#include "WireFormatRegistry.h"
-#include <decaf/util/Collections.h>
-
using namespace std;
using namespace activemq;
using namespace activemq::wireformat;
@@ -92,7 +90,7 @@ void WireFormatRegistry::unregisterAllFa
////////////////////////////////////////////////////////////////////////////////
std::vector<std::string> WireFormatRegistry::getWireFormatNames() const {
- return Collections::toStlVector<std::string>(this->registry.keySet());
+ return this->registry.keySet().toArray();
}
////////////////////////////////////////////////////////////////////////////////
Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/Collections.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/Collections.h?rev=1366395&r1=1366394&r2=1366395&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/Collections.h (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/Collections.h Fri Jul 27 14:49:34 2012
@@ -38,28 +38,6 @@ namespace util {
public:
- /**
- * Creates and returns a new STL vector instance that contains a copy of each
- * element in the supplied collection instance. If the Collection is empty the
- * returned vector will also be empty.
- *
- * @param collection
- * The collection whose elements are to be copied to a std::vector.
- *
- * @returns a new std::vector containing a copy of each element in the Collection.
- */
- template<typename E>
- static std::vector<E> toStlVector(const Collection<E>& collection) {
-
- std::vector<E> result(collection.size());
-
- typename std::auto_ptr< Iterator<E> > iterator(collection.iterator());
- while (iterator->hasNext()) {
- result.push_back(iterator->next());
- }
-
- return result;
- }
};
}}
Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/Properties.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/Properties.cpp?rev=1366395&r1=1366394&r2=1366395&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/Properties.cpp (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/Properties.cpp Fri Jul 27 14:49:34 2012
@@ -22,7 +22,6 @@
#include <decaf/util/Date.h>
#include <decaf/util/Map.h>
#include <decaf/util/StlMap.h>
-#include <decaf/util/Collections.h>
#include <decaf/io/BufferedInputStream.h>
#include <decaf/lang/Character.h>
#include <decaf/lang/Integer.h>
@@ -320,7 +319,7 @@ std::string Properties::toString() const
std::vector<std::string> Properties::propertyNames() const {
StlMap<std::string, std::string> selectedProperties;
this->selectProperties( selectedProperties );
- return Collections::toStlVector<std::string>(selectedProperties.keySet());
+ return selectedProperties.keySet().toArray();
}
////////////////////////////////////////////////////////////////////////////////
Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/commands/ActiveMQMapMessageTest.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/commands/ActiveMQMapMessageTest.cpp?rev=1366395&r1=1366394&r2=1366395&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/commands/ActiveMQMapMessageTest.cpp (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/commands/ActiveMQMapMessageTest.cpp Fri Jul 27 14:49:34 2012
@@ -308,7 +308,7 @@ void ActiveMQMapMessageTest::testGetMapN
std::vector<std::string> mapNamesList = msg2.getMapNames();
- CPPUNIT_ASSERT_EQUAL( mapNamesList.size(), (std::size_t)11 );
+ CPPUNIT_ASSERT_EQUAL( (std::size_t)11, mapNamesList.size() );
CPPUNIT_ASSERT( std::find( mapNamesList.begin(), mapNamesList.end(), "boolean" ) != mapNamesList.end() );
CPPUNIT_ASSERT( std::find( mapNamesList.begin(), mapNamesList.end(), "byte" ) != mapNamesList.end() );
CPPUNIT_ASSERT( std::find( mapNamesList.begin(), mapNamesList.end(), "bytes1" ) != mapNamesList.end() );
@@ -385,7 +385,7 @@ void ActiveMQMapMessageTest::testReadOnl
msg.getLong( "long" );
msg.getShort( "short" );
msg.getString( "string" );
- } catch( MessageNotReadableException mnre ) {
+ } catch( MessageNotReadableException& mnre ) {
CPPUNIT_FAIL( "should be readable" );
}
try {