activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tab...@apache.org
Subject svn commit: r507328 - in /activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/util: PrimitiveMap.cpp PrimitiveMap.h
Date Wed, 14 Feb 2007 00:19:19 GMT
Author: tabish
Date: Tue Feb 13 16:19:18 2007
New Revision: 507328

URL: http://svn.apache.org/viewvc?view=rev&rev=507328
Log:
http://issues.apache.org/activemq/browse/AMQCPP-30

Modified:
    activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/util/PrimitiveMap.cpp
    activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/util/PrimitiveMap.h

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/util/PrimitiveMap.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/util/PrimitiveMap.cpp?view=diff&rev=507328&r1=507327&r2=507328
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/util/PrimitiveMap.cpp (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/util/PrimitiveMap.cpp Tue Feb
13 16:19:18 2007
@@ -47,7 +47,17 @@
 ////////////////////////////////////////////////////////////////////////////////
 std::string PrimitiveMap::toString() const {
 
+    std::vector<std::string> keys = this->valueNodeMap.getKeys();
     ostringstream stream;
+
+    stream << "Begin Class PrimitiveMap:" << std::endl;
+
+    for( std::size_t i = 0; i < keys.size(); ++i ) {
+        stream << "map[" << keys[i] << "] = "
+               << valueNodeMap.getValue( keys[i] ).toString() << std::endl;
+    }
+
+    stream << "Begin Class PrimitiveMap:" << std::endl;
 
     return stream.str();
 }

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/util/PrimitiveMap.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/util/PrimitiveMap.h?view=diff&rev=507328&r1=507327&r2=507328
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/util/PrimitiveMap.h (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/util/PrimitiveMap.h Tue Feb
13 16:19:18 2007
@@ -330,6 +330,38 @@
                 return *value.byteArrayValue;
             }
 
+            std::string toString() const {
+                std::ostringstream stream;
+
+                if( valueType == BOOLEAN_TYPE ) {
+                    stream << value.boolValue;
+                } else if( valueType == BYTE_TYPE ) {
+                    stream << value.byteValue;
+                } else if( valueType == CHAR_TYPE ) {
+                    stream << value.charValue;
+                } else if( valueType == SHORT_TYPE ) {
+                    stream << value.shortValue;
+                } else if(  valueType == INTEGER_TYPE ) {
+                    stream << value.intValue;
+                } else if( valueType == LONG_TYPE ) {
+                    stream << value.longValue;
+                } else if( valueType == DOUBLE_TYPE ) {
+                    stream << value.doubleValue;
+                } else if( valueType == FLOAT_TYPE ) {
+                    stream << value.floatValue;
+                } else if( valueType == STRING_TYPE ) {
+                    stream << *value.stringValue;
+                } else if( valueType == BYTE_ARRAY_TYPE ) {
+                    std::vector<unsigned char>::const_iterator iter =
+                        value.byteArrayValue->begin();
+                    for( ; iter != value.byteArrayValue->end(); ++iter ) {
+                        stream << '[' << (int)(*iter) << ']';
+                    }
+                }
+
+                return stream.str();
+            }
+
         };
 
 
@@ -339,8 +371,8 @@
 
     public:
 
-    	PrimitiveMap();
-    	virtual ~PrimitiveMap();
+        PrimitiveMap();
+        virtual ~PrimitiveMap();
 
         /**
          * Copy Constructor



Mime
View raw message