activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tab...@apache.org
Subject svn commit: r920566 - in /activemq/activemq-cpp/trunk/activemq-cpp/src/main: Makefile.am decaf/lang/String.cpp decaf/lang/String.h
Date Mon, 08 Mar 2010 23:32:43 GMT
Author: tabish
Date: Mon Mar  8 23:32:42 2010
New Revision: 920566

URL: http://svn.apache.org/viewvc?rev=920566&view=rev
Log:
Add a skeleton String class.

Added:
    activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/lang/String.cpp   (with props)
    activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/lang/String.h   (with props)
Modified:
    activemq/activemq-cpp/trunk/activemq-cpp/src/main/Makefile.am

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=920566&r1=920565&r2=920566&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/Makefile.am (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/Makefile.am Mon Mar  8 23:32:42 2010
@@ -537,6 +537,7 @@
     decaf/lang/Long.cpp \
     decaf/lang/Math.cpp \
     decaf/lang/Short.cpp \
+    decaf/lang/String.cpp \
     decaf/lang/System.cpp \
     decaf/lang/Thread.cpp \
     decaf/lang/ThreadGroup.cpp \
@@ -1208,6 +1209,7 @@
     decaf/lang/Runnable.h \
     decaf/lang/Runtime.h \
     decaf/lang/Short.h \
+    decaf/lang/String.h \
     decaf/lang/System.h \
     decaf/lang/Thread.h \
     decaf/lang/ThreadGroup.h \

Added: activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/lang/String.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/lang/String.cpp?rev=920566&view=auto
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/lang/String.cpp (added)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/lang/String.cpp Mon Mar  8 23:32:42
2010
@@ -0,0 +1,73 @@
+/*
+ * 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 "String.h"
+
+#include <decaf/lang/System.h>
+#include <decaf/lang/exceptions/NullPointerException.h>
+
+using namespace std;
+using namespace decaf;
+using namespace decaf::lang;
+using namespace decaf::lang::exceptions;
+
+////////////////////////////////////////////////////////////////////////////////
+namespace decaf{
+namespace lang{
+
+    class StringContents {
+    public:
+
+        unsigned char* value;
+
+    public:
+
+        StringContents() : value( NULL ) {
+        }
+
+        ~StringContents() {
+            delete [] value;
+        }
+
+    };
+
+}}
+
+////////////////////////////////////////////////////////////////////////////////
+String::String() {
+    this->contents = new StringContents();
+}
+
+////////////////////////////////////////////////////////////////////////////////
+String::String( const std::string& source ) {
+
+    // Initialize the contents object.
+    this->contents = new StringContents();
+    this->contents->value = new unsigned char[source.length()];
+
+    // load the passed string into the contents value.
+    System::arraycopy( (unsigned char*)source.c_str(), 0, contents->value, 0, source.length()
);
+}
+
+////////////////////////////////////////////////////////////////////////////////
+String::~String() {
+    try{
+        delete this->contents;
+    }
+    DECAF_CATCH_NOTHROW( Exception )
+    DECAF_CATCHALL_NOTHROW()
+}

Propchange: activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/lang/String.cpp
------------------------------------------------------------------------------
    svn:eol-style = native

Added: activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/lang/String.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/lang/String.h?rev=920566&view=auto
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/lang/String.h (added)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/lang/String.h Mon Mar  8 23:32:42
2010
@@ -0,0 +1,64 @@
+/*
+ * 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.
+ */
+
+#ifndef _DECAF_LANG_STRING_H_
+#define _DECAF_LANG_STRING_H_
+
+#include <decaf/util/Config.h>
+
+#include <decaf/lang/CharSequence.h>
+#include <decaf/lang/Comparable.h>
+
+#include <string>
+
+namespace decaf {
+namespace lang {
+
+    class StringContents;
+
+    /**
+     * The String class represents an immutable sequence of chars.
+     *
+     * @since 1.0
+     */
+    class DECAF_API String {
+    private:
+
+        StringContents* contents;
+
+    public:
+
+        /**
+         * Creates a new empty String object.
+         */
+        String();
+
+        /**
+         * Create a new String object that represents the given STL string
+         *
+         * @param source
+         *      The string to copy into this new String object.
+         */
+        String( const std::string& source );
+
+        virtual ~String();
+
+    };
+
+}}
+
+#endif /* _DECAF_LANG_STRING_H_ */

Propchange: activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/lang/String.h
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message