corinthia-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j...@apache.org
Subject [3/5] incubator-corinthia git commit: Move framework classes into editor
Date Fri, 31 Jul 2015 16:23:15 GMT
Move framework classes into editor


Project: http://git-wip-us.apache.org/repos/asf/incubator-corinthia/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-corinthia/commit/b6f25d90
Tree: http://git-wip-us.apache.org/repos/asf/incubator-corinthia/tree/b6f25d90
Diff: http://git-wip-us.apache.org/repos/asf/incubator-corinthia/diff/b6f25d90

Branch: refs/heads/newZipExperiment
Commit: b6f25d904e6b32014cf8dfaf1046454679f31b3a
Parents: dc46348
Author: Peter Kelly <peter@uxproductivity.com>
Authored: Wed Jul 29 22:07:50 2015 +0700
Committer: Peter Kelly <peter@uxproductivity.com>
Committed: Wed Jul 29 22:07:50 2015 +0700

----------------------------------------------------------------------
 consumers/corinthia/src/framework/AColor.h    |  28 ++++
 consumers/corinthia/src/framework/AEvent.h    |  27 ++++
 consumers/corinthia/src/framework/APoint.h    |  26 ++++
 consumers/corinthia/src/framework/ARect.h     |  31 +++++
 consumers/corinthia/src/framework/AShared.cpp |  84 ++++++++++++
 consumers/corinthia/src/framework/AShared.h   | 146 +++++++++++++++++++++
 consumers/corinthia/src/framework/ASize.h     |  26 ++++
 consumers/corinthia/src/framework/AString.cpp |  81 ++++++++++++
 consumers/corinthia/src/framework/AString.h   |  52 ++++++++
 consumers/corinthia/src/framework/AView.h     |  60 +++++++++
 consumers/corinthia/src/framework/uitest.cpp  | 100 ++++++++++++++
 ui/src/AColor.h                               |  28 ----
 ui/src/AEvent.h                               |  27 ----
 ui/src/APoint.h                               |  26 ----
 ui/src/ARect.h                                |  31 -----
 ui/src/AShared.cpp                            |  84 ------------
 ui/src/AShared.h                              | 146 ---------------------
 ui/src/ASize.h                                |  26 ----
 ui/src/AString.cpp                            |  81 ------------
 ui/src/AString.h                              |  52 --------
 ui/src/AView.h                                |  60 ---------
 ui/src/uitest.cpp                             | 100 --------------
 22 files changed, 661 insertions(+), 661 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-corinthia/blob/b6f25d90/consumers/corinthia/src/framework/AColor.h
----------------------------------------------------------------------
diff --git a/consumers/corinthia/src/framework/AColor.h b/consumers/corinthia/src/framework/AColor.h
new file mode 100644
index 0000000..eb0d9d4
--- /dev/null
+++ b/consumers/corinthia/src/framework/AColor.h
@@ -0,0 +1,28 @@
+// 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.
+
+#pragma once
+
+struct AColor
+{
+    AColor() : red(0.0), green(0.0), blue(0.0) { }
+    AColor(double _red, double _green, double _blue) :
+        red(_red), green(_green), blue(_blue) { }
+    double red;
+    double green;
+    double blue;
+};

http://git-wip-us.apache.org/repos/asf/incubator-corinthia/blob/b6f25d90/consumers/corinthia/src/framework/AEvent.h
----------------------------------------------------------------------
diff --git a/consumers/corinthia/src/framework/AEvent.h b/consumers/corinthia/src/framework/AEvent.h
new file mode 100644
index 0000000..e4744a0
--- /dev/null
+++ b/consumers/corinthia/src/framework/AEvent.h
@@ -0,0 +1,27 @@
+// 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.
+
+#pragma once
+
+#include "AShared.h"
+
+class AEvent : public AShared
+{
+public:
+    AEvent() { }
+    virtual ~AEvent() { }
+};

http://git-wip-us.apache.org/repos/asf/incubator-corinthia/blob/b6f25d90/consumers/corinthia/src/framework/APoint.h
----------------------------------------------------------------------
diff --git a/consumers/corinthia/src/framework/APoint.h b/consumers/corinthia/src/framework/APoint.h
new file mode 100644
index 0000000..6956166
--- /dev/null
+++ b/consumers/corinthia/src/framework/APoint.h
@@ -0,0 +1,26 @@
+// 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.
+
+#pragma once
+
+struct APoint
+{
+    APoint() : x(0), y(0) { }
+    APoint(double _x, double _y) : x(_x), y(_y) { }
+    double x;
+    double y;
+};

http://git-wip-us.apache.org/repos/asf/incubator-corinthia/blob/b6f25d90/consumers/corinthia/src/framework/ARect.h
----------------------------------------------------------------------
diff --git a/consumers/corinthia/src/framework/ARect.h b/consumers/corinthia/src/framework/ARect.h
new file mode 100644
index 0000000..239db42
--- /dev/null
+++ b/consumers/corinthia/src/framework/ARect.h
@@ -0,0 +1,31 @@
+// 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.
+
+#pragma once
+
+#include "APoint.h"
+#include "ASize.h"
+
+struct ARect
+{
+    ARect() { }
+    ARect(const APoint &o, const ASize &s) : origin(o), size(s) { }
+    ARect(double x, double y, double width, double height)
+        : origin(APoint(x,y)), size(ASize(width,height)) { }
+    APoint origin;
+    ASize size;
+};

http://git-wip-us.apache.org/repos/asf/incubator-corinthia/blob/b6f25d90/consumers/corinthia/src/framework/AShared.cpp
----------------------------------------------------------------------
diff --git a/consumers/corinthia/src/framework/AShared.cpp b/consumers/corinthia/src/framework/AShared.cpp
new file mode 100644
index 0000000..d8fd5f4
--- /dev/null
+++ b/consumers/corinthia/src/framework/AShared.cpp
@@ -0,0 +1,84 @@
+// 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 "AShared.h"
+#include <assert.h>
+#include <stdio.h>
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+//                                                                                                //
+//                                             AShared                                            //
+//                                                                                                //
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+AShared::AShared()
+    : _refCount(0)
+{
+}
+
+AShared::~AShared()
+{
+    AWeakRefData *ref = _weakRefs.first;
+    while (ref != NULL) {
+        AWeakRefData *next = ref->next;
+        ref->ptr = NULL;
+        ref->prev = NULL;
+        ref->next = NULL;
+        ref = next;
+    }
+}
+
+int AShared::weakRefCount() const
+{
+    int count = 0;
+    for (AWeakRefData *d = _weakRefs.first; d != NULL; d = d->next)
+        count++;
+    return count;
+}
+
+void AShared::addWeakRef(AWeakRefData *ref)
+{
+    ref->ptr = this;
+
+    assert(!ref->prev && !ref->next);
+    if (_weakRefs.last) {
+        ref->prev = _weakRefs.last;
+        _weakRefs.last->next = ref;
+        _weakRefs.last = ref;
+    }
+    else {
+        _weakRefs.first = _weakRefs.last = ref;
+    }
+}
+
+void AShared::removeWeakRef(AWeakRefData *ref)
+{
+    ref->ptr = NULL;
+
+    assert(ref->prev || (_weakRefs.first == ref));
+    assert(ref->next || (_weakRefs.last == ref));
+    if (_weakRefs.first == ref)
+        _weakRefs.first = ref->next;
+    if (_weakRefs.last == ref)
+        _weakRefs.last = ref->prev;
+    if (ref->next)
+        ref->next->prev = ref->prev;
+    if (ref->prev)
+        ref->prev->next = ref->next;
+    ref->next = NULL;
+    ref->prev = NULL;
+}

http://git-wip-us.apache.org/repos/asf/incubator-corinthia/blob/b6f25d90/consumers/corinthia/src/framework/AShared.h
----------------------------------------------------------------------
diff --git a/consumers/corinthia/src/framework/AShared.h b/consumers/corinthia/src/framework/AShared.h
new file mode 100644
index 0000000..ece97d2
--- /dev/null
+++ b/consumers/corinthia/src/framework/AShared.h
@@ -0,0 +1,146 @@
+// 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.
+
+#pragma once
+
+#include <stddef.h>
+#include <stdio.h>
+
+class AShared;
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+//                                                                                                //
+//                                          AWeakRefData                                          //
+//                                                                                                //
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+struct AWeakRefData
+{
+    AWeakRefData(void *_back) : ptr(NULL), prev(NULL), next(NULL), back(_back) { }
+    AShared *ptr;
+    AWeakRefData *prev;
+    AWeakRefData *next;
+    void *back;
+};
+
+struct AWeakRefDataList
+{
+    AWeakRefDataList() : first(NULL), last(NULL) { }
+    AWeakRefData *first;
+    AWeakRefData *last;
+};
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+//                                                                                                //
+//                                             AShared                                            //
+//                                                                                                //
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+class AShared
+{
+public:
+    AShared();
+    virtual ~AShared();
+
+    void ref() { _refCount++; }
+    void deref() { _refCount--; if (_refCount == 0) delete this; }
+    int refCount() const { return _refCount; }
+
+    void addWeakRef(AWeakRefData *ref);
+    void removeWeakRef(AWeakRefData *ref);
+    int weakRefCount() const;
+
+private:
+    int _refCount;
+    AWeakRefDataList _weakRefs;
+};
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+//                                                                                                //
+//                                              ARef                                              //
+//                                                                                                //
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+template <class T>
+class ARef
+{
+public:
+    ARef() : _ptr(NULL) { }
+    ARef(T *ptr) : _ptr(NULL) { setPtr(ptr); }
+    ARef(const ARef<T> &other) : _ptr(NULL) { setPtr(other._ptr); }
+    ~ARef() { setPtr(NULL); }
+
+    ARef<T> &operator=(const ARef<T> &other) {
+        setPtr(other._ptr);
+        return *this;
+    }
+
+    T &operator*() const { return *_ptr; }
+    T *operator->() const { return _ptr; }
+    T *ptr() const { return _ptr; }
+    bool isNull() const { return (_ptr == NULL); }
+
+    void setPtr(T *newPtr) {
+        T *oldPtr = _ptr;
+        if (newPtr != NULL)
+            newPtr->ref();
+        if (oldPtr != NULL)
+            oldPtr->deref();
+        _ptr = newPtr;
+    }
+
+ private:
+    T *_ptr;
+};
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+//                                                                                                //
+//                                            AWeakRef                                            //
+//                                                                                                //
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+template<class T>
+class AWeakRef
+{
+public:
+    AWeakRef() : _data(this) { }
+    AWeakRef(T *ptr) : _data(this) { setPtr(ptr); }
+    AWeakRef(const AWeakRef<T> &other) : _data(this) { setPtr(other._data.ptr); }
+    ~AWeakRef() { setPtr(NULL); }
+
+    AWeakRef &operator=(const AWeakRef<T> &other) {
+        setPtr(other._data.ptr);
+        return *this;
+    }
+
+    T &operator*() const { return *(static_cast<T*>(_data.ptr)); }
+    T *operator->() const { return static_cast<T*>(_data.ptr); }
+    T *ptr() const { return static_cast<T*>(_data.ptr); }
+    bool isNull() const { return (_data.ptr == NULL); }
+
+    void setPtr(AShared *newPtr) {
+        AShared *oldPtr = _data.ptr;
+        if (oldPtr != NULL)
+            oldPtr->removeWeakRef(&_data);
+        if (newPtr != NULL)
+            newPtr->addWeakRef(&_data);
+        _data.ptr = newPtr;
+    }
+
+private:
+    AWeakRefData _data;
+};

http://git-wip-us.apache.org/repos/asf/incubator-corinthia/blob/b6f25d90/consumers/corinthia/src/framework/ASize.h
----------------------------------------------------------------------
diff --git a/consumers/corinthia/src/framework/ASize.h b/consumers/corinthia/src/framework/ASize.h
new file mode 100644
index 0000000..900fff9
--- /dev/null
+++ b/consumers/corinthia/src/framework/ASize.h
@@ -0,0 +1,26 @@
+// 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.
+
+#pragma once
+
+struct ASize
+{
+    ASize() : width(0), height(0) { }
+    ASize(double w, double h) : width(w), height(h) { }
+    double width;
+    double height;
+};

http://git-wip-us.apache.org/repos/asf/incubator-corinthia/blob/b6f25d90/consumers/corinthia/src/framework/AString.cpp
----------------------------------------------------------------------
diff --git a/consumers/corinthia/src/framework/AString.cpp b/consumers/corinthia/src/framework/AString.cpp
new file mode 100644
index 0000000..25d5c6b
--- /dev/null
+++ b/consumers/corinthia/src/framework/AString.cpp
@@ -0,0 +1,81 @@
+// 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 "AString.h"
+#include <string.h>
+
+class AStringImpl : public AShared
+{
+public:
+    AStringImpl() { }
+    ~AStringImpl() { delete chars; }
+    AChar *chars;
+    unsigned int len;
+};
+
+AString::AString()
+{
+    _impl = NULL;
+}
+
+AString::AString(const char *utf8)
+{
+    _impl = new AStringImpl();
+    _impl->len = strlen(utf8);
+    _impl->chars = new AChar[_impl->len];
+    // FIXME: Do propert UTF-8 decoding here
+    for (unsigned int i = 0; i < _impl->len; i++)
+        _impl->chars[i] = utf8[i];
+}
+
+AString::AString(AChar *chars, unsigned int length)
+{
+    _impl = new AStringImpl();
+    _impl->chars = new AChar[length];
+    _impl->len = length;
+}
+
+AString::AString(const AString &other)
+{
+    _impl = other._impl;
+}
+
+AString::~AString()
+{
+}
+
+AString &AString::operator=(const AString &other)
+{
+    _impl = other._impl;
+    return *this;
+}
+
+unsigned int AString::length() const
+{
+    if (_impl.isNull())
+        return 0;
+    else
+        return _impl->len;
+}
+
+AChar AString::charAt(int index) const
+{
+    if (_impl.isNull())
+        return 0;
+    else
+        return _impl->chars[index];
+}

http://git-wip-us.apache.org/repos/asf/incubator-corinthia/blob/b6f25d90/consumers/corinthia/src/framework/AString.h
----------------------------------------------------------------------
diff --git a/consumers/corinthia/src/framework/AString.h b/consumers/corinthia/src/framework/AString.h
new file mode 100644
index 0000000..ea43c8f
--- /dev/null
+++ b/consumers/corinthia/src/framework/AString.h
@@ -0,0 +1,52 @@
+// 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.
+
+class AStringImpl;
+
+#include <stdint.h>
+#include "AShared.h"
+
+typedef uint32_t AChar;
+
+class AString
+{
+public:
+    AString();
+    AString(const char *utf8);
+    AString(AChar *chars, unsigned int length);
+    AString(const AString &other);
+    ~AString();
+
+    AString &operator=(const AString &other);
+
+    unsigned int length() const;
+    AChar charAt(int index) const;
+
+    /*
+    int compare(const AString &other) const;
+    bool hasPrefix(const AString &other) const;
+    bool hasSuffix(const AString &other) const;
+    AString substring(int start, int end) const;
+    AString substringTo(int start) const;
+    AString substringFrom(int end) const;
+    AString lowerCase() const;
+    AString upperCase() const;
+    */
+
+ private:
+    ARef<AStringImpl> _impl;
+};

http://git-wip-us.apache.org/repos/asf/incubator-corinthia/blob/b6f25d90/consumers/corinthia/src/framework/AView.h
----------------------------------------------------------------------
diff --git a/consumers/corinthia/src/framework/AView.h b/consumers/corinthia/src/framework/AView.h
new file mode 100644
index 0000000..278d239
--- /dev/null
+++ b/consumers/corinthia/src/framework/AView.h
@@ -0,0 +1,60 @@
+// 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.
+
+#pragma once
+
+#include "ARect.h"
+#include "AColor.h"
+#include "AEvent.h"
+#include "AShared.h"
+
+class AView : public AShared
+{
+public:
+    AView() : _visible(true),
+              _enabled(true),
+              _parent(NULL),
+              _nextSibling(NULL),
+              _prevSibling(NULL),
+              _firstChild(NULL),
+              _lastChild(NULL) { }
+    AView(const ARect &frame) : _frame(frame) { }
+    virtual ~AView() { }
+
+    ARect frame() const { return _frame; }
+    void setFrame(const ARect &newFrame) { _frame = newFrame; }
+
+    AColor backgroundColor() const { return _backgroundColor; }
+    void setBackgroundColor(const AColor &newBackgroundColor) { _backgroundColor = newBackgroundColor; }
+
+    bool visible() const { return _visible; }
+    void setVisible(bool newVisible) { _visible = newVisible; }
+
+    bool enabled() const { return _enabled; }
+    void setEnabled(bool newEnabled) { _enabled = newEnabled; }
+
+private:
+    ARect _frame;
+    AColor _backgroundColor;
+    bool _visible;
+    bool _enabled;
+    AView *_parent;
+    AView *_nextSibling;
+    AView *_prevSibling;
+    AView *_firstChild;
+    AView *_lastChild;
+};

http://git-wip-us.apache.org/repos/asf/incubator-corinthia/blob/b6f25d90/consumers/corinthia/src/framework/uitest.cpp
----------------------------------------------------------------------
diff --git a/consumers/corinthia/src/framework/uitest.cpp b/consumers/corinthia/src/framework/uitest.cpp
new file mode 100644
index 0000000..debd85e
--- /dev/null
+++ b/consumers/corinthia/src/framework/uitest.cpp
@@ -0,0 +1,100 @@
+// 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 <stdio.h>
+#include "AView.h"
+#include "AString.h"
+
+int fooInstances = 0;
+
+class Foo : public AShared
+{
+public:
+    Foo(int value) : x(value) {
+        printf("    %p Foo::Foo()\n",this);
+        fooInstances++;
+    }
+    virtual ~Foo() {
+        printf("    %p Foo::~Foo()\n",this);
+        fooInstances--;
+    }
+    int x;
+    void print() {
+        printf("x = %d\n",x);
+    }
+};
+
+class StrongHolder
+{
+public:
+    StrongHolder() { }
+    StrongHolder(const ARef<Foo> &_ref) : ref(_ref) { }
+    StrongHolder(Foo *ptr) : ref(ptr) { }
+    ARef<Foo> ref;
+};
+
+class WeakHolder
+{
+public:
+    WeakHolder() { }
+    WeakHolder(const AWeakRef<Foo> &_ref) : ref(_ref) { }
+    WeakHolder(Foo *ptr) : ref(ptr) { }
+    AWeakRef<Foo> ref;
+};
+
+int main(int argc, const char **argv)
+{
+    printf("step 0\n");
+    Foo *f = new Foo(4);
+    printf("    f = %p\n",f);
+
+    StrongHolder *s1 = new StrongHolder();
+    StrongHolder *s2 = new StrongHolder();
+
+    WeakHolder *w1 = new WeakHolder();
+    WeakHolder *w2 = new WeakHolder();
+
+    printf("step 1\n");
+    printf("    instances=%d, strong=%d, weak=%d, w1=%p, w2=%p\n",
+           fooInstances,f->refCount(),f->weakRefCount(),w1->ref.ptr(),w2->ref.ptr());
+    s1->ref = f; // Should bring refCount to 1
+    printf("    instances=%d, strong=%d, weak=%d, w1=%p, w2=%p\n",
+           fooInstances,f->refCount(),f->weakRefCount(),w1->ref.ptr(),w2->ref.ptr());
+    printf("step 2\n");
+    s2->ref = f; // Should bring refCount to 2
+    printf("    instances=%d, strong=%d, weak=%d, w1=%p, w2=%p\n",
+           fooInstances,f->refCount(),f->weakRefCount(),w1->ref.ptr(),w2->ref.ptr());
+    printf("step 3\n");
+    w1->ref = f; // Should bring weakRefCount to 1
+    printf("    instances=%d, strong=%d, weak=%d, w1=%p, w2=%p\n",
+           fooInstances,f->refCount(),f->weakRefCount(),w1->ref.ptr(),w2->ref.ptr());
+    printf("step 4\n");
+    w2->ref = f; // Should bring weakRefCount to 2
+    printf("    instances=%d, strong=%d, weak=%d, w1=%p, w2=%p\n",
+           fooInstances,f->refCount(),f->weakRefCount(),w1->ref.ptr(),w2->ref.ptr());
+    printf("step 5\n");
+    delete s1; // Should bring refCount to 1
+    printf("    instances=%d, strong=%d, weak=%d, w1=%p, w2=%p\n",
+           fooInstances,f->refCount(),f->weakRefCount(),w1->ref.ptr(),w2->ref.ptr());
+    printf("step 6\n");
+    delete s2; // Should bring refCount to 0, deleting Foo, and clearing weak references
+    printf("    instances=%d w1=%p, w2=%p\n",
+           fooInstances,w1->ref.ptr(),w2->ref.ptr());
+    printf("done\n");
+
+    return 0;
+}

http://git-wip-us.apache.org/repos/asf/incubator-corinthia/blob/b6f25d90/ui/src/AColor.h
----------------------------------------------------------------------
diff --git a/ui/src/AColor.h b/ui/src/AColor.h
deleted file mode 100644
index eb0d9d4..0000000
--- a/ui/src/AColor.h
+++ /dev/null
@@ -1,28 +0,0 @@
-// 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.
-
-#pragma once
-
-struct AColor
-{
-    AColor() : red(0.0), green(0.0), blue(0.0) { }
-    AColor(double _red, double _green, double _blue) :
-        red(_red), green(_green), blue(_blue) { }
-    double red;
-    double green;
-    double blue;
-};

http://git-wip-us.apache.org/repos/asf/incubator-corinthia/blob/b6f25d90/ui/src/AEvent.h
----------------------------------------------------------------------
diff --git a/ui/src/AEvent.h b/ui/src/AEvent.h
deleted file mode 100644
index e4744a0..0000000
--- a/ui/src/AEvent.h
+++ /dev/null
@@ -1,27 +0,0 @@
-// 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.
-
-#pragma once
-
-#include "AShared.h"
-
-class AEvent : public AShared
-{
-public:
-    AEvent() { }
-    virtual ~AEvent() { }
-};

http://git-wip-us.apache.org/repos/asf/incubator-corinthia/blob/b6f25d90/ui/src/APoint.h
----------------------------------------------------------------------
diff --git a/ui/src/APoint.h b/ui/src/APoint.h
deleted file mode 100644
index 6956166..0000000
--- a/ui/src/APoint.h
+++ /dev/null
@@ -1,26 +0,0 @@
-// 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.
-
-#pragma once
-
-struct APoint
-{
-    APoint() : x(0), y(0) { }
-    APoint(double _x, double _y) : x(_x), y(_y) { }
-    double x;
-    double y;
-};

http://git-wip-us.apache.org/repos/asf/incubator-corinthia/blob/b6f25d90/ui/src/ARect.h
----------------------------------------------------------------------
diff --git a/ui/src/ARect.h b/ui/src/ARect.h
deleted file mode 100644
index 239db42..0000000
--- a/ui/src/ARect.h
+++ /dev/null
@@ -1,31 +0,0 @@
-// 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.
-
-#pragma once
-
-#include "APoint.h"
-#include "ASize.h"
-
-struct ARect
-{
-    ARect() { }
-    ARect(const APoint &o, const ASize &s) : origin(o), size(s) { }
-    ARect(double x, double y, double width, double height)
-        : origin(APoint(x,y)), size(ASize(width,height)) { }
-    APoint origin;
-    ASize size;
-};

http://git-wip-us.apache.org/repos/asf/incubator-corinthia/blob/b6f25d90/ui/src/AShared.cpp
----------------------------------------------------------------------
diff --git a/ui/src/AShared.cpp b/ui/src/AShared.cpp
deleted file mode 100644
index d8fd5f4..0000000
--- a/ui/src/AShared.cpp
+++ /dev/null
@@ -1,84 +0,0 @@
-// 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 "AShared.h"
-#include <assert.h>
-#include <stdio.h>
-
-////////////////////////////////////////////////////////////////////////////////////////////////////
-//                                                                                                //
-//                                             AShared                                            //
-//                                                                                                //
-////////////////////////////////////////////////////////////////////////////////////////////////////
-
-AShared::AShared()
-    : _refCount(0)
-{
-}
-
-AShared::~AShared()
-{
-    AWeakRefData *ref = _weakRefs.first;
-    while (ref != NULL) {
-        AWeakRefData *next = ref->next;
-        ref->ptr = NULL;
-        ref->prev = NULL;
-        ref->next = NULL;
-        ref = next;
-    }
-}
-
-int AShared::weakRefCount() const
-{
-    int count = 0;
-    for (AWeakRefData *d = _weakRefs.first; d != NULL; d = d->next)
-        count++;
-    return count;
-}
-
-void AShared::addWeakRef(AWeakRefData *ref)
-{
-    ref->ptr = this;
-
-    assert(!ref->prev && !ref->next);
-    if (_weakRefs.last) {
-        ref->prev = _weakRefs.last;
-        _weakRefs.last->next = ref;
-        _weakRefs.last = ref;
-    }
-    else {
-        _weakRefs.first = _weakRefs.last = ref;
-    }
-}
-
-void AShared::removeWeakRef(AWeakRefData *ref)
-{
-    ref->ptr = NULL;
-
-    assert(ref->prev || (_weakRefs.first == ref));
-    assert(ref->next || (_weakRefs.last == ref));
-    if (_weakRefs.first == ref)
-        _weakRefs.first = ref->next;
-    if (_weakRefs.last == ref)
-        _weakRefs.last = ref->prev;
-    if (ref->next)
-        ref->next->prev = ref->prev;
-    if (ref->prev)
-        ref->prev->next = ref->next;
-    ref->next = NULL;
-    ref->prev = NULL;
-}

http://git-wip-us.apache.org/repos/asf/incubator-corinthia/blob/b6f25d90/ui/src/AShared.h
----------------------------------------------------------------------
diff --git a/ui/src/AShared.h b/ui/src/AShared.h
deleted file mode 100644
index ece97d2..0000000
--- a/ui/src/AShared.h
+++ /dev/null
@@ -1,146 +0,0 @@
-// 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.
-
-#pragma once
-
-#include <stddef.h>
-#include <stdio.h>
-
-class AShared;
-
-////////////////////////////////////////////////////////////////////////////////////////////////////
-//                                                                                                //
-//                                          AWeakRefData                                          //
-//                                                                                                //
-////////////////////////////////////////////////////////////////////////////////////////////////////
-
-struct AWeakRefData
-{
-    AWeakRefData(void *_back) : ptr(NULL), prev(NULL), next(NULL), back(_back) { }
-    AShared *ptr;
-    AWeakRefData *prev;
-    AWeakRefData *next;
-    void *back;
-};
-
-struct AWeakRefDataList
-{
-    AWeakRefDataList() : first(NULL), last(NULL) { }
-    AWeakRefData *first;
-    AWeakRefData *last;
-};
-
-////////////////////////////////////////////////////////////////////////////////////////////////////
-//                                                                                                //
-//                                             AShared                                            //
-//                                                                                                //
-////////////////////////////////////////////////////////////////////////////////////////////////////
-
-class AShared
-{
-public:
-    AShared();
-    virtual ~AShared();
-
-    void ref() { _refCount++; }
-    void deref() { _refCount--; if (_refCount == 0) delete this; }
-    int refCount() const { return _refCount; }
-
-    void addWeakRef(AWeakRefData *ref);
-    void removeWeakRef(AWeakRefData *ref);
-    int weakRefCount() const;
-
-private:
-    int _refCount;
-    AWeakRefDataList _weakRefs;
-};
-
-////////////////////////////////////////////////////////////////////////////////////////////////////
-//                                                                                                //
-//                                              ARef                                              //
-//                                                                                                //
-////////////////////////////////////////////////////////////////////////////////////////////////////
-
-template <class T>
-class ARef
-{
-public:
-    ARef() : _ptr(NULL) { }
-    ARef(T *ptr) : _ptr(NULL) { setPtr(ptr); }
-    ARef(const ARef<T> &other) : _ptr(NULL) { setPtr(other._ptr); }
-    ~ARef() { setPtr(NULL); }
-
-    ARef<T> &operator=(const ARef<T> &other) {
-        setPtr(other._ptr);
-        return *this;
-    }
-
-    T &operator*() const { return *_ptr; }
-    T *operator->() const { return _ptr; }
-    T *ptr() const { return _ptr; }
-    bool isNull() const { return (_ptr == NULL); }
-
-    void setPtr(T *newPtr) {
-        T *oldPtr = _ptr;
-        if (newPtr != NULL)
-            newPtr->ref();
-        if (oldPtr != NULL)
-            oldPtr->deref();
-        _ptr = newPtr;
-    }
-
- private:
-    T *_ptr;
-};
-
-////////////////////////////////////////////////////////////////////////////////////////////////////
-//                                                                                                //
-//                                            AWeakRef                                            //
-//                                                                                                //
-////////////////////////////////////////////////////////////////////////////////////////////////////
-
-template<class T>
-class AWeakRef
-{
-public:
-    AWeakRef() : _data(this) { }
-    AWeakRef(T *ptr) : _data(this) { setPtr(ptr); }
-    AWeakRef(const AWeakRef<T> &other) : _data(this) { setPtr(other._data.ptr); }
-    ~AWeakRef() { setPtr(NULL); }
-
-    AWeakRef &operator=(const AWeakRef<T> &other) {
-        setPtr(other._data.ptr);
-        return *this;
-    }
-
-    T &operator*() const { return *(static_cast<T*>(_data.ptr)); }
-    T *operator->() const { return static_cast<T*>(_data.ptr); }
-    T *ptr() const { return static_cast<T*>(_data.ptr); }
-    bool isNull() const { return (_data.ptr == NULL); }
-
-    void setPtr(AShared *newPtr) {
-        AShared *oldPtr = _data.ptr;
-        if (oldPtr != NULL)
-            oldPtr->removeWeakRef(&_data);
-        if (newPtr != NULL)
-            newPtr->addWeakRef(&_data);
-        _data.ptr = newPtr;
-    }
-
-private:
-    AWeakRefData _data;
-};

http://git-wip-us.apache.org/repos/asf/incubator-corinthia/blob/b6f25d90/ui/src/ASize.h
----------------------------------------------------------------------
diff --git a/ui/src/ASize.h b/ui/src/ASize.h
deleted file mode 100644
index 900fff9..0000000
--- a/ui/src/ASize.h
+++ /dev/null
@@ -1,26 +0,0 @@
-// 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.
-
-#pragma once
-
-struct ASize
-{
-    ASize() : width(0), height(0) { }
-    ASize(double w, double h) : width(w), height(h) { }
-    double width;
-    double height;
-};

http://git-wip-us.apache.org/repos/asf/incubator-corinthia/blob/b6f25d90/ui/src/AString.cpp
----------------------------------------------------------------------
diff --git a/ui/src/AString.cpp b/ui/src/AString.cpp
deleted file mode 100644
index 25d5c6b..0000000
--- a/ui/src/AString.cpp
+++ /dev/null
@@ -1,81 +0,0 @@
-// 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 "AString.h"
-#include <string.h>
-
-class AStringImpl : public AShared
-{
-public:
-    AStringImpl() { }
-    ~AStringImpl() { delete chars; }
-    AChar *chars;
-    unsigned int len;
-};
-
-AString::AString()
-{
-    _impl = NULL;
-}
-
-AString::AString(const char *utf8)
-{
-    _impl = new AStringImpl();
-    _impl->len = strlen(utf8);
-    _impl->chars = new AChar[_impl->len];
-    // FIXME: Do propert UTF-8 decoding here
-    for (unsigned int i = 0; i < _impl->len; i++)
-        _impl->chars[i] = utf8[i];
-}
-
-AString::AString(AChar *chars, unsigned int length)
-{
-    _impl = new AStringImpl();
-    _impl->chars = new AChar[length];
-    _impl->len = length;
-}
-
-AString::AString(const AString &other)
-{
-    _impl = other._impl;
-}
-
-AString::~AString()
-{
-}
-
-AString &AString::operator=(const AString &other)
-{
-    _impl = other._impl;
-    return *this;
-}
-
-unsigned int AString::length() const
-{
-    if (_impl.isNull())
-        return 0;
-    else
-        return _impl->len;
-}
-
-AChar AString::charAt(int index) const
-{
-    if (_impl.isNull())
-        return 0;
-    else
-        return _impl->chars[index];
-}

http://git-wip-us.apache.org/repos/asf/incubator-corinthia/blob/b6f25d90/ui/src/AString.h
----------------------------------------------------------------------
diff --git a/ui/src/AString.h b/ui/src/AString.h
deleted file mode 100644
index ea43c8f..0000000
--- a/ui/src/AString.h
+++ /dev/null
@@ -1,52 +0,0 @@
-// 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.
-
-class AStringImpl;
-
-#include <stdint.h>
-#include "AShared.h"
-
-typedef uint32_t AChar;
-
-class AString
-{
-public:
-    AString();
-    AString(const char *utf8);
-    AString(AChar *chars, unsigned int length);
-    AString(const AString &other);
-    ~AString();
-
-    AString &operator=(const AString &other);
-
-    unsigned int length() const;
-    AChar charAt(int index) const;
-
-    /*
-    int compare(const AString &other) const;
-    bool hasPrefix(const AString &other) const;
-    bool hasSuffix(const AString &other) const;
-    AString substring(int start, int end) const;
-    AString substringTo(int start) const;
-    AString substringFrom(int end) const;
-    AString lowerCase() const;
-    AString upperCase() const;
-    */
-
- private:
-    ARef<AStringImpl> _impl;
-};

http://git-wip-us.apache.org/repos/asf/incubator-corinthia/blob/b6f25d90/ui/src/AView.h
----------------------------------------------------------------------
diff --git a/ui/src/AView.h b/ui/src/AView.h
deleted file mode 100644
index 278d239..0000000
--- a/ui/src/AView.h
+++ /dev/null
@@ -1,60 +0,0 @@
-// 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.
-
-#pragma once
-
-#include "ARect.h"
-#include "AColor.h"
-#include "AEvent.h"
-#include "AShared.h"
-
-class AView : public AShared
-{
-public:
-    AView() : _visible(true),
-              _enabled(true),
-              _parent(NULL),
-              _nextSibling(NULL),
-              _prevSibling(NULL),
-              _firstChild(NULL),
-              _lastChild(NULL) { }
-    AView(const ARect &frame) : _frame(frame) { }
-    virtual ~AView() { }
-
-    ARect frame() const { return _frame; }
-    void setFrame(const ARect &newFrame) { _frame = newFrame; }
-
-    AColor backgroundColor() const { return _backgroundColor; }
-    void setBackgroundColor(const AColor &newBackgroundColor) { _backgroundColor = newBackgroundColor; }
-
-    bool visible() const { return _visible; }
-    void setVisible(bool newVisible) { _visible = newVisible; }
-
-    bool enabled() const { return _enabled; }
-    void setEnabled(bool newEnabled) { _enabled = newEnabled; }
-
-private:
-    ARect _frame;
-    AColor _backgroundColor;
-    bool _visible;
-    bool _enabled;
-    AView *_parent;
-    AView *_nextSibling;
-    AView *_prevSibling;
-    AView *_firstChild;
-    AView *_lastChild;
-};

http://git-wip-us.apache.org/repos/asf/incubator-corinthia/blob/b6f25d90/ui/src/uitest.cpp
----------------------------------------------------------------------
diff --git a/ui/src/uitest.cpp b/ui/src/uitest.cpp
deleted file mode 100644
index debd85e..0000000
--- a/ui/src/uitest.cpp
+++ /dev/null
@@ -1,100 +0,0 @@
-// 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 <stdio.h>
-#include "AView.h"
-#include "AString.h"
-
-int fooInstances = 0;
-
-class Foo : public AShared
-{
-public:
-    Foo(int value) : x(value) {
-        printf("    %p Foo::Foo()\n",this);
-        fooInstances++;
-    }
-    virtual ~Foo() {
-        printf("    %p Foo::~Foo()\n",this);
-        fooInstances--;
-    }
-    int x;
-    void print() {
-        printf("x = %d\n",x);
-    }
-};
-
-class StrongHolder
-{
-public:
-    StrongHolder() { }
-    StrongHolder(const ARef<Foo> &_ref) : ref(_ref) { }
-    StrongHolder(Foo *ptr) : ref(ptr) { }
-    ARef<Foo> ref;
-};
-
-class WeakHolder
-{
-public:
-    WeakHolder() { }
-    WeakHolder(const AWeakRef<Foo> &_ref) : ref(_ref) { }
-    WeakHolder(Foo *ptr) : ref(ptr) { }
-    AWeakRef<Foo> ref;
-};
-
-int main(int argc, const char **argv)
-{
-    printf("step 0\n");
-    Foo *f = new Foo(4);
-    printf("    f = %p\n",f);
-
-    StrongHolder *s1 = new StrongHolder();
-    StrongHolder *s2 = new StrongHolder();
-
-    WeakHolder *w1 = new WeakHolder();
-    WeakHolder *w2 = new WeakHolder();
-
-    printf("step 1\n");
-    printf("    instances=%d, strong=%d, weak=%d, w1=%p, w2=%p\n",
-           fooInstances,f->refCount(),f->weakRefCount(),w1->ref.ptr(),w2->ref.ptr());
-    s1->ref = f; // Should bring refCount to 1
-    printf("    instances=%d, strong=%d, weak=%d, w1=%p, w2=%p\n",
-           fooInstances,f->refCount(),f->weakRefCount(),w1->ref.ptr(),w2->ref.ptr());
-    printf("step 2\n");
-    s2->ref = f; // Should bring refCount to 2
-    printf("    instances=%d, strong=%d, weak=%d, w1=%p, w2=%p\n",
-           fooInstances,f->refCount(),f->weakRefCount(),w1->ref.ptr(),w2->ref.ptr());
-    printf("step 3\n");
-    w1->ref = f; // Should bring weakRefCount to 1
-    printf("    instances=%d, strong=%d, weak=%d, w1=%p, w2=%p\n",
-           fooInstances,f->refCount(),f->weakRefCount(),w1->ref.ptr(),w2->ref.ptr());
-    printf("step 4\n");
-    w2->ref = f; // Should bring weakRefCount to 2
-    printf("    instances=%d, strong=%d, weak=%d, w1=%p, w2=%p\n",
-           fooInstances,f->refCount(),f->weakRefCount(),w1->ref.ptr(),w2->ref.ptr());
-    printf("step 5\n");
-    delete s1; // Should bring refCount to 1
-    printf("    instances=%d, strong=%d, weak=%d, w1=%p, w2=%p\n",
-           fooInstances,f->refCount(),f->weakRefCount(),w1->ref.ptr(),w2->ref.ptr());
-    printf("step 6\n");
-    delete s2; // Should bring refCount to 0, deleting Foo, and clearing weak references
-    printf("    instances=%d w1=%p, w2=%p\n",
-           fooInstances,w1->ref.ptr(),w2->ref.ptr());
-    printf("done\n");
-
-    return 0;
-}


Mime
View raw message