diff --git a/src/apps/icon-o-matic/Jamfile b/src/apps/icon-o-matic/Jamfile index b5450d53e3..a6ded8a408 100644 --- a/src/apps/icon-o-matic/Jamfile +++ b/src/apps/icon-o-matic/Jamfile @@ -64,6 +64,7 @@ for sourceDir in $(sourceDirs) { # system headers UseLibraryHeaders agg expat icon ; +UsePrivateHeaders shared ; @@ -292,7 +293,7 @@ Application Icon-O-Matic : MainWindow.cpp Util.cpp - : be tracker translation libagg.a libexpat.a + : be tracker translation libshared.a libagg.a libexpat.a : Icon-O-Matic.rdef ; diff --git a/src/apps/icon-o-matic/generic/support/AutoDeleter.h b/src/apps/icon-o-matic/generic/support/AutoDeleter.h deleted file mode 100644 index 9f5e351e20..0000000000 --- a/src/apps/icon-o-matic/generic/support/AutoDeleter.h +++ /dev/null @@ -1,133 +0,0 @@ -/* - * Copyright 2001-2006, Haiku. - * Distributed under the terms of the MIT License. - * - * Authors: - * IngoWeinhold - */ - -/** Scope-based automatic deletion of objects/arrays. - * ObjectDeleter - deletes an object - * ArrayDeleter - deletes an array - * MemoryDeleter - free()s malloc()ed memory - */ - -#ifndef _AUTO_DELETER_H -#define _AUTO_DELETER_H - -#include - -namespace BPrivate { - -// AutoDeleter - -template -class AutoDeleter { -public: - inline AutoDeleter() - : fObject(NULL) - { - } - - inline AutoDeleter(C *object) - : fObject(object) - { - } - - inline ~AutoDeleter() - { - fDelete(fObject); - } - - inline void SetTo(C *object) - { - if (object != fObject) { - fDelete(fObject); - fObject = object; - } - } - - inline void Unset() - { - SetTo(NULL); - } - - inline void Delete() - { - SetTo(NULL); - } - - inline C *Detach() - { - C *object = fObject; - fObject = NULL; - return object; - } - -private: - C *fObject; - DeleteFunc fDelete; -}; - - -// ObjectDeleter - -template -struct ObjectDelete -{ - inline void operator()(C *object) - { - delete object; - } -}; - -template -struct ObjectDeleter : AutoDeleter > -{ - ObjectDeleter() : AutoDeleter >() {} - ObjectDeleter(C *object) : AutoDeleter >(object) {} -}; - - -// ArrayDeleter - -template -struct ArrayDelete -{ - inline void operator()(C *array) - { - delete[] array; - } -}; - -template -struct ArrayDeleter : AutoDeleter > -{ - ArrayDeleter() : AutoDeleter >() {} - ArrayDeleter(C *array) : AutoDeleter >(array) {} -}; - - -// MemoryDeleter - -struct MemoryDelete -{ - inline void operator()(void *memory) - { - free(memory); - } -}; - -struct MemoryDeleter : AutoDeleter -{ - MemoryDeleter() : AutoDeleter() {} - MemoryDeleter(void *memory) : AutoDeleter(memory) {} -}; - -} // namespace BPrivate - -using BPrivate::ObjectDeleter; -using BPrivate::ArrayDeleter; -using BPrivate::MemoryDeleter; - -#endif // _AUTO_DELETER_H diff --git a/src/apps/icon-o-matic/generic/support/AutoLocker.h b/src/apps/icon-o-matic/generic/support/AutoLocker.h deleted file mode 100644 index ea568ebc61..0000000000 --- a/src/apps/icon-o-matic/generic/support/AutoLocker.h +++ /dev/null @@ -1,151 +0,0 @@ -/* - * Copyright 2004-2006, Haiku. - * Distributed under the terms of the MIT License. - * - * Authors: - * IngoWeinhold - */ - -/** Scope-based automatic deletion of objects/arrays. - * ObjectDeleter - deletes an object - * ArrayDeleter - deletes an array - * MemoryDeleter - free()s malloc()ed memory - */ - -#ifndef AUTO_LOCKER_H -#define AUTO_LOCKER_H - -#include - -// locking - -// AutoLockerStandardLocking -template -class AutoLockerStandardLocking { -public: - inline bool Lock(Lockable *lockable) - { - return lockable->Lock(); - } - - inline void Unlock(Lockable *lockable) - { - lockable->Unlock(); - } -}; - -// AutoLockerReadLocking -template -class AutoLockerReadLocking { -public: - inline bool Lock(Lockable *lockable) - { - return lockable->ReadLock(); - } - - inline void Unlock(Lockable *lockable) - { - lockable->ReadUnlock(); - } -}; - -// AutoLockerWriteLocking -template -class AutoLockerWriteLocking { -public: - inline bool Lock(Lockable *lockable) - { - return lockable->WriteLock(); - } - - inline void Unlock(Lockable *lockable) - { - lockable->WriteUnlock(); - } -}; - -// AutoLocker -template > -class AutoLocker { -private: - typedef AutoLocker ThisClass; -public: - inline AutoLocker(Lockable *lockable, bool alreadyLocked = false) - : fLockable(lockable), - fLocked(fLockable && alreadyLocked) - { - if (!fLocked) - _Lock(); - } - - inline AutoLocker(Lockable &lockable, bool alreadyLocked = false) - : fLockable(&lockable), - fLocked(fLockable && alreadyLocked) - { - if (!fLocked) - _Lock(); - } - - inline ~AutoLocker() - { - Unlock(); - } - - inline void SetTo(Lockable *lockable, bool alreadyLocked) - { - Unlock(); - fLockable = lockable; - fLocked = alreadyLocked; - if (!fLocked) - _Lock(); - } - - inline void SetTo(Lockable &lockable, bool alreadyLocked) - { - SetTo(&lockable, alreadyLocked); - } - - inline void Unset() - { - Unlock(); - } - - inline AutoLocker &operator=(Lockable *lockable) - { - SetTo(lockable); - return *this; - } - - inline AutoLocker &operator=(Lockable &lockable) - { - SetTo(&lockable); - return *this; - } - - inline bool IsLocked() const { return fLocked; } - - inline void Unlock() - { - if (fLockable && fLocked) { - fLocking.Unlock(fLockable); - fLocked = false; - } - } - - inline operator bool() const { return fLocked; } - -private: - inline void _Lock() - { - if (fLockable) - fLocked = fLocking.Lock(fLockable); - } - -private: - Lockable *fLockable; - bool fLocked; - Locking fLocking; -}; - -#endif // AUTO_LOCKER_H