You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@corinthia.apache.org by pm...@apache.org on 2015/07/29 17:16:00 UTC
[1/2] incubator-corinthia git commit: Move framework classes into
editor
Repository: incubator-corinthia
Updated Branches:
refs/heads/master dc46348ec -> 2545a4e6e
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/master
Commit: b6f25d904e6b32014cf8dfaf1046454679f31b3a
Parents: dc46348
Author: Peter Kelly <pe...@uxproductivity.com>
Authored: Wed Jul 29 22:07:50 2015 +0700
Committer: Peter Kelly <pe...@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;
-}
[2/2] incubator-corinthia git commit: Use 'C' as prefix for framework
classes
Posted by pm...@apache.org.
Use 'C' as prefix for framework classes
Project: http://git-wip-us.apache.org/repos/asf/incubator-corinthia/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-corinthia/commit/2545a4e6
Tree: http://git-wip-us.apache.org/repos/asf/incubator-corinthia/tree/2545a4e6
Diff: http://git-wip-us.apache.org/repos/asf/incubator-corinthia/diff/2545a4e6
Branch: refs/heads/master
Commit: 2545a4e6e52075bdabaa7bcf1aa119b4f3291193
Parents: b6f25d9
Author: Peter Kelly <pe...@uxproductivity.com>
Authored: Wed Jul 29 22:15:41 2015 +0700
Committer: Peter Kelly <pe...@uxproductivity.com>
Committed: Wed Jul 29 22:15:41 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/CColor.h | 28 ++++
consumers/corinthia/src/framework/CEvent.h | 27 ++++
consumers/corinthia/src/framework/CPoint.h | 26 ++++
consumers/corinthia/src/framework/CRect.h | 31 +++++
consumers/corinthia/src/framework/CShared.cpp | 84 ++++++++++++
consumers/corinthia/src/framework/CShared.h | 146 +++++++++++++++++++++
consumers/corinthia/src/framework/CSize.h | 26 ++++
consumers/corinthia/src/framework/CString.cpp | 81 ++++++++++++
consumers/corinthia/src/framework/CString.h | 52 ++++++++
consumers/corinthia/src/framework/CView.h | 60 +++++++++
consumers/corinthia/src/framework/uitest.cpp | 14 +-
21 files changed, 568 insertions(+), 568 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-corinthia/blob/2545a4e6/consumers/corinthia/src/framework/AColor.h
----------------------------------------------------------------------
diff --git a/consumers/corinthia/src/framework/AColor.h b/consumers/corinthia/src/framework/AColor.h
deleted file mode 100644
index eb0d9d4..0000000
--- a/consumers/corinthia/src/framework/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/2545a4e6/consumers/corinthia/src/framework/AEvent.h
----------------------------------------------------------------------
diff --git a/consumers/corinthia/src/framework/AEvent.h b/consumers/corinthia/src/framework/AEvent.h
deleted file mode 100644
index e4744a0..0000000
--- a/consumers/corinthia/src/framework/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/2545a4e6/consumers/corinthia/src/framework/APoint.h
----------------------------------------------------------------------
diff --git a/consumers/corinthia/src/framework/APoint.h b/consumers/corinthia/src/framework/APoint.h
deleted file mode 100644
index 6956166..0000000
--- a/consumers/corinthia/src/framework/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/2545a4e6/consumers/corinthia/src/framework/ARect.h
----------------------------------------------------------------------
diff --git a/consumers/corinthia/src/framework/ARect.h b/consumers/corinthia/src/framework/ARect.h
deleted file mode 100644
index 239db42..0000000
--- a/consumers/corinthia/src/framework/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/2545a4e6/consumers/corinthia/src/framework/AShared.cpp
----------------------------------------------------------------------
diff --git a/consumers/corinthia/src/framework/AShared.cpp b/consumers/corinthia/src/framework/AShared.cpp
deleted file mode 100644
index d8fd5f4..0000000
--- a/consumers/corinthia/src/framework/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/2545a4e6/consumers/corinthia/src/framework/AShared.h
----------------------------------------------------------------------
diff --git a/consumers/corinthia/src/framework/AShared.h b/consumers/corinthia/src/framework/AShared.h
deleted file mode 100644
index ece97d2..0000000
--- a/consumers/corinthia/src/framework/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/2545a4e6/consumers/corinthia/src/framework/ASize.h
----------------------------------------------------------------------
diff --git a/consumers/corinthia/src/framework/ASize.h b/consumers/corinthia/src/framework/ASize.h
deleted file mode 100644
index 900fff9..0000000
--- a/consumers/corinthia/src/framework/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/2545a4e6/consumers/corinthia/src/framework/AString.cpp
----------------------------------------------------------------------
diff --git a/consumers/corinthia/src/framework/AString.cpp b/consumers/corinthia/src/framework/AString.cpp
deleted file mode 100644
index 25d5c6b..0000000
--- a/consumers/corinthia/src/framework/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/2545a4e6/consumers/corinthia/src/framework/AString.h
----------------------------------------------------------------------
diff --git a/consumers/corinthia/src/framework/AString.h b/consumers/corinthia/src/framework/AString.h
deleted file mode 100644
index ea43c8f..0000000
--- a/consumers/corinthia/src/framework/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/2545a4e6/consumers/corinthia/src/framework/AView.h
----------------------------------------------------------------------
diff --git a/consumers/corinthia/src/framework/AView.h b/consumers/corinthia/src/framework/AView.h
deleted file mode 100644
index 278d239..0000000
--- a/consumers/corinthia/src/framework/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/2545a4e6/consumers/corinthia/src/framework/CColor.h
----------------------------------------------------------------------
diff --git a/consumers/corinthia/src/framework/CColor.h b/consumers/corinthia/src/framework/CColor.h
new file mode 100644
index 0000000..9800624
--- /dev/null
+++ b/consumers/corinthia/src/framework/CColor.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 CColor
+{
+ CColor() : red(0.0), green(0.0), blue(0.0) { }
+ CColor(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/2545a4e6/consumers/corinthia/src/framework/CEvent.h
----------------------------------------------------------------------
diff --git a/consumers/corinthia/src/framework/CEvent.h b/consumers/corinthia/src/framework/CEvent.h
new file mode 100644
index 0000000..24046a1
--- /dev/null
+++ b/consumers/corinthia/src/framework/CEvent.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 "CShared.h"
+
+class CEvent : public CShared
+{
+public:
+ CEvent() { }
+ virtual ~CEvent() { }
+};
http://git-wip-us.apache.org/repos/asf/incubator-corinthia/blob/2545a4e6/consumers/corinthia/src/framework/CPoint.h
----------------------------------------------------------------------
diff --git a/consumers/corinthia/src/framework/CPoint.h b/consumers/corinthia/src/framework/CPoint.h
new file mode 100644
index 0000000..ef36b9f
--- /dev/null
+++ b/consumers/corinthia/src/framework/CPoint.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 CPoint
+{
+ CPoint() : x(0), y(0) { }
+ CPoint(double _x, double _y) : x(_x), y(_y) { }
+ double x;
+ double y;
+};
http://git-wip-us.apache.org/repos/asf/incubator-corinthia/blob/2545a4e6/consumers/corinthia/src/framework/CRect.h
----------------------------------------------------------------------
diff --git a/consumers/corinthia/src/framework/CRect.h b/consumers/corinthia/src/framework/CRect.h
new file mode 100644
index 0000000..0222fb6
--- /dev/null
+++ b/consumers/corinthia/src/framework/CRect.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 "CPoint.h"
+#include "CSize.h"
+
+struct CRect
+{
+ CRect() { }
+ CRect(const CPoint &o, const CSize &s) : origin(o), size(s) { }
+ CRect(double x, double y, double width, double height)
+ : origin(CPoint(x,y)), size(CSize(width,height)) { }
+ CPoint origin;
+ CSize size;
+};
http://git-wip-us.apache.org/repos/asf/incubator-corinthia/blob/2545a4e6/consumers/corinthia/src/framework/CShared.cpp
----------------------------------------------------------------------
diff --git a/consumers/corinthia/src/framework/CShared.cpp b/consumers/corinthia/src/framework/CShared.cpp
new file mode 100644
index 0000000..c538926
--- /dev/null
+++ b/consumers/corinthia/src/framework/CShared.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 "CShared.h"
+#include <assert.h>
+#include <stdio.h>
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// //
+// CShared //
+// //
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+CShared::CShared()
+ : _refCount(0)
+{
+}
+
+CShared::~CShared()
+{
+ CWeakRefData *ref = _weakRefs.first;
+ while (ref != NULL) {
+ CWeakRefData *next = ref->next;
+ ref->ptr = NULL;
+ ref->prev = NULL;
+ ref->next = NULL;
+ ref = next;
+ }
+}
+
+int CShared::weakRefCount() const
+{
+ int count = 0;
+ for (CWeakRefData *d = _weakRefs.first; d != NULL; d = d->next)
+ count++;
+ return count;
+}
+
+void CShared::addWeakRef(CWeakRefData *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 CShared::removeWeakRef(CWeakRefData *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/2545a4e6/consumers/corinthia/src/framework/CShared.h
----------------------------------------------------------------------
diff --git a/consumers/corinthia/src/framework/CShared.h b/consumers/corinthia/src/framework/CShared.h
new file mode 100644
index 0000000..9531152
--- /dev/null
+++ b/consumers/corinthia/src/framework/CShared.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 CShared;
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// //
+// CWeakRefData //
+// //
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+struct CWeakRefData
+{
+ CWeakRefData(void *_back) : ptr(NULL), prev(NULL), next(NULL), back(_back) { }
+ CShared *ptr;
+ CWeakRefData *prev;
+ CWeakRefData *next;
+ void *back;
+};
+
+struct CWeakRefDataList
+{
+ CWeakRefDataList() : first(NULL), last(NULL) { }
+ CWeakRefData *first;
+ CWeakRefData *last;
+};
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// //
+// CShared //
+// //
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+class CShared
+{
+public:
+ CShared();
+ virtual ~CShared();
+
+ void ref() { _refCount++; }
+ void deref() { _refCount--; if (_refCount == 0) delete this; }
+ int refCount() const { return _refCount; }
+
+ void addWeakRef(CWeakRefData *ref);
+ void removeWeakRef(CWeakRefData *ref);
+ int weakRefCount() const;
+
+private:
+ int _refCount;
+ CWeakRefDataList _weakRefs;
+};
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// //
+// CRef //
+// //
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+template <class T>
+class CRef
+{
+public:
+ CRef() : _ptr(NULL) { }
+ CRef(T *ptr) : _ptr(NULL) { setPtr(ptr); }
+ CRef(const CRef<T> &other) : _ptr(NULL) { setPtr(other._ptr); }
+ ~CRef() { setPtr(NULL); }
+
+ CRef<T> &operator=(const CRef<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;
+};
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// //
+// CWeakRef //
+// //
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+template<class T>
+class CWeakRef
+{
+public:
+ CWeakRef() : _data(this) { }
+ CWeakRef(T *ptr) : _data(this) { setPtr(ptr); }
+ CWeakRef(const CWeakRef<T> &other) : _data(this) { setPtr(other._data.ptr); }
+ ~CWeakRef() { setPtr(NULL); }
+
+ CWeakRef &operator=(const CWeakRef<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(CShared *newPtr) {
+ CShared *oldPtr = _data.ptr;
+ if (oldPtr != NULL)
+ oldPtr->removeWeakRef(&_data);
+ if (newPtr != NULL)
+ newPtr->addWeakRef(&_data);
+ _data.ptr = newPtr;
+ }
+
+private:
+ CWeakRefData _data;
+};
http://git-wip-us.apache.org/repos/asf/incubator-corinthia/blob/2545a4e6/consumers/corinthia/src/framework/CSize.h
----------------------------------------------------------------------
diff --git a/consumers/corinthia/src/framework/CSize.h b/consumers/corinthia/src/framework/CSize.h
new file mode 100644
index 0000000..99e5ea8
--- /dev/null
+++ b/consumers/corinthia/src/framework/CSize.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 CSize
+{
+ CSize() : width(0), height(0) { }
+ CSize(double w, double h) : width(w), height(h) { }
+ double width;
+ double height;
+};
http://git-wip-us.apache.org/repos/asf/incubator-corinthia/blob/2545a4e6/consumers/corinthia/src/framework/CString.cpp
----------------------------------------------------------------------
diff --git a/consumers/corinthia/src/framework/CString.cpp b/consumers/corinthia/src/framework/CString.cpp
new file mode 100644
index 0000000..4cfec56
--- /dev/null
+++ b/consumers/corinthia/src/framework/CString.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 "CString.h"
+#include <string.h>
+
+class CStringImpl : public CShared
+{
+public:
+ CStringImpl() { }
+ ~CStringImpl() { delete chars; }
+ CChar *chars;
+ unsigned int len;
+};
+
+CString::CString()
+{
+ _impl = NULL;
+}
+
+CString::CString(const char *utf8)
+{
+ _impl = new CStringImpl();
+ _impl->len = strlen(utf8);
+ _impl->chars = new CChar[_impl->len];
+ // FIXME: Do propert UTF-8 decoding here
+ for (unsigned int i = 0; i < _impl->len; i++)
+ _impl->chars[i] = utf8[i];
+}
+
+CString::CString(CChar *chars, unsigned int length)
+{
+ _impl = new CStringImpl();
+ _impl->chars = new CChar[length];
+ _impl->len = length;
+}
+
+CString::CString(const CString &other)
+{
+ _impl = other._impl;
+}
+
+CString::~CString()
+{
+}
+
+CString &CString::operator=(const CString &other)
+{
+ _impl = other._impl;
+ return *this;
+}
+
+unsigned int CString::length() const
+{
+ if (_impl.isNull())
+ return 0;
+ else
+ return _impl->len;
+}
+
+CChar CString::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/2545a4e6/consumers/corinthia/src/framework/CString.h
----------------------------------------------------------------------
diff --git a/consumers/corinthia/src/framework/CString.h b/consumers/corinthia/src/framework/CString.h
new file mode 100644
index 0000000..8fae91e
--- /dev/null
+++ b/consumers/corinthia/src/framework/CString.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 CStringImpl;
+
+#include <stdint.h>
+#include "CShared.h"
+
+typedef uint32_t CChar;
+
+class CString
+{
+public:
+ CString();
+ CString(const char *utf8);
+ CString(CChar *chars, unsigned int length);
+ CString(const CString &other);
+ ~CString();
+
+ CString &operator=(const CString &other);
+
+ unsigned int length() const;
+ CChar charAt(int index) const;
+
+ /*
+ int compare(const CString &other) const;
+ bool hasPrefix(const CString &other) const;
+ bool hasSuffix(const CString &other) const;
+ CString substring(int start, int end) const;
+ CString substringTo(int start) const;
+ CString substringFrom(int end) const;
+ CString lowerCase() const;
+ CString upperCase() const;
+ */
+
+ private:
+ CRef<CStringImpl> _impl;
+};
http://git-wip-us.apache.org/repos/asf/incubator-corinthia/blob/2545a4e6/consumers/corinthia/src/framework/CView.h
----------------------------------------------------------------------
diff --git a/consumers/corinthia/src/framework/CView.h b/consumers/corinthia/src/framework/CView.h
new file mode 100644
index 0000000..87e5ca5
--- /dev/null
+++ b/consumers/corinthia/src/framework/CView.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 "CRect.h"
+#include "CColor.h"
+#include "CEvent.h"
+#include "CShared.h"
+
+class CView : public CShared
+{
+public:
+ CView() : _visible(true),
+ _enabled(true),
+ _parent(NULL),
+ _nextSibling(NULL),
+ _prevSibling(NULL),
+ _firstChild(NULL),
+ _lastChild(NULL) { }
+ CView(const CRect &frame) : _frame(frame) { }
+ virtual ~CView() { }
+
+ CRect frame() const { return _frame; }
+ void setFrame(const CRect &newFrame) { _frame = newFrame; }
+
+ CColor backgroundColor() const { return _backgroundColor; }
+ void setBackgroundColor(const CColor &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:
+ CRect _frame;
+ CColor _backgroundColor;
+ bool _visible;
+ bool _enabled;
+ CView *_parent;
+ CView *_nextSibling;
+ CView *_prevSibling;
+ CView *_firstChild;
+ CView *_lastChild;
+};
http://git-wip-us.apache.org/repos/asf/incubator-corinthia/blob/2545a4e6/consumers/corinthia/src/framework/uitest.cpp
----------------------------------------------------------------------
diff --git a/consumers/corinthia/src/framework/uitest.cpp b/consumers/corinthia/src/framework/uitest.cpp
index debd85e..727f396 100644
--- a/consumers/corinthia/src/framework/uitest.cpp
+++ b/consumers/corinthia/src/framework/uitest.cpp
@@ -16,12 +16,12 @@
// under the License.
#include <stdio.h>
-#include "AView.h"
-#include "AString.h"
+#include "CView.h"
+#include "CString.h"
int fooInstances = 0;
-class Foo : public AShared
+class Foo : public CShared
{
public:
Foo(int value) : x(value) {
@@ -42,18 +42,18 @@ class StrongHolder
{
public:
StrongHolder() { }
- StrongHolder(const ARef<Foo> &_ref) : ref(_ref) { }
+ StrongHolder(const CRef<Foo> &_ref) : ref(_ref) { }
StrongHolder(Foo *ptr) : ref(ptr) { }
- ARef<Foo> ref;
+ CRef<Foo> ref;
};
class WeakHolder
{
public:
WeakHolder() { }
- WeakHolder(const AWeakRef<Foo> &_ref) : ref(_ref) { }
+ WeakHolder(const CWeakRef<Foo> &_ref) : ref(_ref) { }
WeakHolder(Foo *ptr) : ref(ptr) { }
- AWeakRef<Foo> ref;
+ CWeakRef<Foo> ref;
};
int main(int argc, const char **argv)