]> git.saurik.com Git - apple/icu.git/blobdiff - icuSources/common/uobject.cpp
ICU-57132.0.1.tar.gz
[apple/icu.git] / icuSources / common / uobject.cpp
index 581cd74274e40feb739597bc7a0717c636159227..900e0345952cdc262b450ed6f1cb8ff159c75cb8 100644 (file)
@@ -1,7 +1,7 @@
 /*
 ******************************************************************************
 *
-*   Copyright (C) 2002-2004, International Business Machines
+*   Copyright (C) 2002-2012, International Business Machines
 *   Corporation and others.  All Rights Reserved.
 *
 ******************************************************************************
@@ -56,48 +56,48 @@ U_NAMESPACE_BEGIN
  * and replace with uprv_malloc/uprv_free.
  */
 
-void * U_EXPORT2 UMemory::operator new(size_t size) {
+void * U_EXPORT2 UMemory::operator new(size_t size) U_NO_THROW {
     return uprv_malloc(size);
 }
 
-void U_EXPORT2 UMemory::operator delete(void *p) {
+void U_EXPORT2 UMemory::operator delete(void *p) U_NO_THROW {
     if(p!=NULL) {
         uprv_free(p);
     }
 }
 
-void * U_EXPORT2 UMemory::operator new[](size_t size) {
+void * U_EXPORT2 UMemory::operator new[](size_t size) U_NO_THROW {
     return uprv_malloc(size);
 }
 
-void U_EXPORT2 UMemory::operator delete[](void *p) {
+void U_EXPORT2 UMemory::operator delete[](void *p) U_NO_THROW {
     if(p!=NULL) {
         uprv_free(p);
     }
 }
 
+#if U_HAVE_DEBUG_LOCATION_NEW
+void * U_EXPORT2 UMemory::operator new(size_t size, const char* /*file*/, int /*line*/) U_NO_THROW {
+    return UMemory::operator new(size);
+}
+
+void U_EXPORT2 UMemory::operator delete(void* p, const char* /*file*/, int /*line*/) U_NO_THROW {
+    UMemory::operator delete(p);
+}
+#endif /* U_HAVE_DEBUG_LOCATION_NEW */
+
+
 #endif
 
 UObject::~UObject() {}
 
-// Future implementation for RTTI that support subtyping. [alan]
-// 
-// UClassID UObject::getStaticClassID() {
-//     return (UClassID) NULL;
-// }
-// 
-// UBool UObject::instanceOf(UClassID type) const {
-//     UClassID c = getDynamicClassID();
-//     for (;;) {
-//         if (c == type) {
-//             return TRUE;
-//         } else if (c == (UClassID) NULL) {
-//             return FALSE;
-//         }
-//         c = * (UClassID*) c;
-//     }
-// }
+UClassID UObject::getDynamicClassID() const { return NULL; }
 
 U_NAMESPACE_END
 
+U_NAMESPACE_USE
 
+U_CAPI void U_EXPORT2
+uprv_deleteUObject(void *obj) {
+    delete static_cast<UObject *>(obj);
+}