activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tab...@apache.org
Subject svn commit: r560423 - in /activemq/activemq-cpp/trunk/src/decaf/src/main/decaf/lang: Character.cpp Character.h
Date Fri, 27 Jul 2007 23:42:20 GMT
Author: tabish
Date: Fri Jul 27 16:42:20 2007
New Revision: 560423

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

Adding in more Types wrappers

Modified:
    activemq/activemq-cpp/trunk/src/decaf/src/main/decaf/lang/Character.cpp
    activemq/activemq-cpp/trunk/src/decaf/src/main/decaf/lang/Character.h

Modified: activemq/activemq-cpp/trunk/src/decaf/src/main/decaf/lang/Character.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/decaf/src/main/decaf/lang/Character.cpp?view=diff&rev=560423&r1=560422&r2=560423
==============================================================================
--- activemq/activemq-cpp/trunk/src/decaf/src/main/decaf/lang/Character.cpp (original)
+++ activemq/activemq-cpp/trunk/src/decaf/src/main/decaf/lang/Character.cpp Fri Jul 27 16:42:20
2007
@@ -25,3 +25,13 @@
 Character::Character( char value ) {
     this->value = value;
 }
+
+////////////////////////////////////////////////////////////////////////////////
+int Character::compareTo( const Character& c ) const {
+    return value < c.value ? -1 : (value > c.value) ? -1 : 0;
+}
+
+////////////////////////////////////////////////////////////////////////////////
+std::string Character::toString() const {
+    return ""; // TODO
+}

Modified: activemq/activemq-cpp/trunk/src/decaf/src/main/decaf/lang/Character.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/decaf/src/main/decaf/lang/Character.h?view=diff&rev=560423&r1=560422&r2=560423
==============================================================================
--- activemq/activemq-cpp/trunk/src/decaf/src/main/decaf/lang/Character.h (original)
+++ activemq/activemq-cpp/trunk/src/decaf/src/main/decaf/lang/Character.h Fri Jul 27 16:42:20
2007
@@ -19,11 +19,15 @@
 #define _DECAF_LANG_CHARACTER_H_
 
 #include <decaf/util/Config.h>
+#include <decaf/lang/Number.h>
+#include <decaf/lang/Comparable.h>
+#include <string>
 
 namespace decaf{
 namespace lang{
 
-    class DECAF_API Character{
+    class DECAF_API Character : public Number,
+                                public Comparable<Character> {
     private:
 
         // The primitive Char value
@@ -52,6 +56,76 @@
          * @param value - char to wrap.
          */
         Character( char value );
+
+        /**
+         * Compares this Character instance with another.
+         * @param c - the Character instance to be compared
+         * @return zero if this object represents the same char value as the
+         * argument; a positive value if this object represents a value greater
+         * than the passed in value, and -1 if this object repesents a value
+         * less than the passed in value.
+         */
+        virtual int compareTo( const Character& c ) const;
+
+        /**
+         * @returns true if the two Character Objects have the same value.
+         */
+        bool equals( const Character& c ) const {
+            return this->value == c.value;
+        }
+
+        /**
+         * @returns this Character Object as a String Representation
+         */
+        std::string toString() const;
+
+        /**
+         * Answers the double value which the receiver represents
+         * @return double the value of the receiver.
+         */
+        virtual double doubleValue() const {
+            return (double)this->value;
+        }
+
+        /**
+         * Answers the float value which the receiver represents
+         * @return float the value of the receiver.
+         */
+        virtual float floatValue() const {
+            return (float)this->value;
+        }
+
+        /**
+         * Answers the byte value which the receiver represents
+         * @return int the value of the receiver.
+         */
+        virtual unsigned char byteValue() const {
+            return (unsigned char)this->value;
+        }
+
+        /**
+         * Answers the short value which the receiver represents
+         * @return int the value of the receiver.
+         */
+        virtual short shortValue() const {
+            return (short)this->value;
+        }
+
+        /**
+         * Answers the int value which the receiver represents
+         * @return int the value of the receiver.
+         */
+        virtual int intValue() const {
+            return (int)this->value;
+        }
+
+        /**
+         * Answers the long value which the receiver represents
+         * @return long the value of the receiver.
+         */
+        virtual long long longValue() const {
+            return (long long)this->value;
+        }
 
     public:    // statics
 



Mime
View raw message