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 2007/07/27 01:56:32 UTC
svn commit: r560036 - in
/activemq/activemq-cpp/trunk/src/decaf/src/main/decaf/lang: Double.h
Float.h Integer.h Long.h Number.h Short.cpp Short.h
Author: tabish
Date: Thu Jul 26 16:56:31 2007
New Revision: 560036
URL: http://svn.apache.org/viewvc?view=rev&rev=560036
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/Double.h
activemq/activemq-cpp/trunk/src/decaf/src/main/decaf/lang/Float.h
activemq/activemq-cpp/trunk/src/decaf/src/main/decaf/lang/Integer.h
activemq/activemq-cpp/trunk/src/decaf/src/main/decaf/lang/Long.h
activemq/activemq-cpp/trunk/src/decaf/src/main/decaf/lang/Number.h
activemq/activemq-cpp/trunk/src/decaf/src/main/decaf/lang/Short.cpp
activemq/activemq-cpp/trunk/src/decaf/src/main/decaf/lang/Short.h
Modified: activemq/activemq-cpp/trunk/src/decaf/src/main/decaf/lang/Double.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/decaf/src/main/decaf/lang/Double.h?view=diff&rev=560036&r1=560035&r2=560036
==============================================================================
--- activemq/activemq-cpp/trunk/src/decaf/src/main/decaf/lang/Double.h (original)
+++ activemq/activemq-cpp/trunk/src/decaf/src/main/decaf/lang/Double.h Thu Jul 26 16:56:31 2007
@@ -19,6 +19,7 @@
#define _DECAF_LANG_DOUBLE_H_
#include <decaf/util/Config.h>
+#include <decaf/lang/Comparable.h>
#include <decaf/lang/Number.h>
#include <string>
Modified: activemq/activemq-cpp/trunk/src/decaf/src/main/decaf/lang/Float.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/decaf/src/main/decaf/lang/Float.h?view=diff&rev=560036&r1=560035&r2=560036
==============================================================================
--- activemq/activemq-cpp/trunk/src/decaf/src/main/decaf/lang/Float.h (original)
+++ activemq/activemq-cpp/trunk/src/decaf/src/main/decaf/lang/Float.h Thu Jul 26 16:56:31 2007
@@ -20,6 +20,7 @@
#include <decaf/util/Config.h>
#include <decaf/lang/Number.h>
+#include <decaf/lang/Comparable.h>
#include <string>
namespace decaf{
Modified: activemq/activemq-cpp/trunk/src/decaf/src/main/decaf/lang/Integer.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/decaf/src/main/decaf/lang/Integer.h?view=diff&rev=560036&r1=560035&r2=560036
==============================================================================
--- activemq/activemq-cpp/trunk/src/decaf/src/main/decaf/lang/Integer.h (original)
+++ activemq/activemq-cpp/trunk/src/decaf/src/main/decaf/lang/Integer.h Thu Jul 26 16:56:31 2007
@@ -18,7 +18,9 @@
#ifndef _DECAF_LANG_INTEGER_H_
#define _DECAF_LANG_INTEGER_H_
+#include <decaf/util/Config.h>
#include <decaf/lang/Number.h>
+#include <decaf/lang/Comparable.h>
#include <string>
namespace decaf{
Modified: activemq/activemq-cpp/trunk/src/decaf/src/main/decaf/lang/Long.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/decaf/src/main/decaf/lang/Long.h?view=diff&rev=560036&r1=560035&r2=560036
==============================================================================
--- activemq/activemq-cpp/trunk/src/decaf/src/main/decaf/lang/Long.h (original)
+++ activemq/activemq-cpp/trunk/src/decaf/src/main/decaf/lang/Long.h Thu Jul 26 16:56:31 2007
@@ -19,6 +19,7 @@
#define _DECAF_LANG_LONG_H_
#include <decaf/lang/Number.h>
+#include <decaf/lang/Comparable.h>
#include <string>
namespace decaf{
Modified: activemq/activemq-cpp/trunk/src/decaf/src/main/decaf/lang/Number.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/decaf/src/main/decaf/lang/Number.h?view=diff&rev=560036&r1=560035&r2=560036
==============================================================================
--- activemq/activemq-cpp/trunk/src/decaf/src/main/decaf/lang/Number.h (original)
+++ activemq/activemq-cpp/trunk/src/decaf/src/main/decaf/lang/Number.h Thu Jul 26 16:56:31 2007
@@ -63,9 +63,9 @@
/**
* Answers the long value which the receiver represents
- * @return long the value of the receiver.
+ * @return long long the value of the receiver.
*/
- virtual long longValue() const = 0;
+ virtual long long longValue() const = 0;
/**
* Answers the short value which the receiver represents
Modified: activemq/activemq-cpp/trunk/src/decaf/src/main/decaf/lang/Short.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/decaf/src/main/decaf/lang/Short.cpp?view=diff&rev=560036&r1=560035&r2=560036
==============================================================================
--- activemq/activemq-cpp/trunk/src/decaf/src/main/decaf/lang/Short.cpp (original)
+++ activemq/activemq-cpp/trunk/src/decaf/src/main/decaf/lang/Short.cpp Thu Jul 26 16:56:31 2007
@@ -21,5 +21,16 @@
using namespace decaf::lang;
////////////////////////////////////////////////////////////////////////////////
-Short::Short() {
+Short::Short( short value ) {
+ this->value = value;
+}
+
+////////////////////////////////////////////////////////////////////////////////
+Short::Short( const std::string& value ) {
+ this->value = value.size(); //Short::parseShort( value );
+}
+
+////////////////////////////////////////////////////////////////////////////////
+int Short::compareTo( const Short& b ) const {
+ return value == b.value ? 0 : ( value > b.value ? 1 : -1 );
}
Modified: activemq/activemq-cpp/trunk/src/decaf/src/main/decaf/lang/Short.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/decaf/src/main/decaf/lang/Short.h?view=diff&rev=560036&r1=560035&r2=560036
==============================================================================
--- activemq/activemq-cpp/trunk/src/decaf/src/main/decaf/lang/Short.h (original)
+++ activemq/activemq-cpp/trunk/src/decaf/src/main/decaf/lang/Short.h Thu Jul 26 16:56:31 2007
@@ -19,16 +19,140 @@
#define _DECAF_LANG_SHORT_H_
#include <decaf/lang/Number.h>
+#include <decaf/lang/Comparable.h>
+//#include <decaf/lang/exceptions/NumberFormatException.h>
#include <string>
namespace decaf{
namespace lang{
- class Short : public Number {
+ class Short : public Number,
+ public Comparable<Short> {
+ private:
+
+ // The short value
+ short value;
+
public:
- Short();
+ /**
+ * @param value - short to wrap
+ */
+ Short( short value );
+
+ /**
+ * @param value - string value to convert to short and wrap
+ */
+ Short( const std::string& value );
+
virtual ~Short() {}
+
+ /**
+ * Compares this Short instance with another.
+ * @param b - the Short instance to be compared
+ * @return zero if this object represents the same short 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 Short& b ) const;
+
+ /**
+ * @returns true if the two Short Objects have the same value.
+ */
+ bool equals( const Short& s ) const {
+ return this->value == s.value;
+ }
+
+ /**
+ * 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 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
+
+ /**
+ * Parses the string argument as a signed short in the radix specified by
+ * the second argument. The characters in the string must all be digits,
+ * of the specified radix (as determined by whether
+ * Character.digit(char, int) returns a nonnegative value) except that the
+ * first character may be an ASCII minus sign '-' ('\u002D') to indicate
+ * a negative value. The resulting byte value is returned.
+ *
+ * An exception of type NumberFormatException is thrown if any of the
+ * following situations occurs:
+ * * The first argument is null or is a string of length zero.
+ * * The radix is either smaller than Character.MIN_RADIX or larger than
+ * Character.MAX_RADIX.
+ * * Any character of the string is not a digit of the specified radix,
+ * except that the first character may be a minus sign '-' ('\u002D')
+ * provided that the string is longer than length 1.
+ * * The value represented by the string is not a value of type short.
+ *
+ * @param s - the String containing the short representation to be parsed
+ * @param radix - the radix to be used while parsing s
+ * @return the short represented by the string argument in the specified radix.
+ * @throws NumberFormatException - If String does not contain a parsable short.
+ */
+// static short parseShort( const std::string& s, int radix )
+// throw ( exceptions::NumberFormatException );
+
+ /**
+ * Parses the string argument as a signed decimal short. The characters
+ * in the string must all be decimal digits, except that the first
+ * character may be an ASCII minus sign '-' ('\u002D') to indicate a
+ * negative value. The resulting short value is returned, exactly as if
+ * the argument and the radix 10 were given as arguments to the
+ * parseShort( const std::string, int ) method.
+ * @param s - String to convert to a short
+ * @returns the converted short value
+ * @throws NumberFormatException if the string is not a short.
+ */
+// static short parseShort( const std::string& s )
+// throw ( exceptions::NumberFormatException );
};