From kde-commits Fri Apr 13 08:06:38 2007 From: Thomas Zander Date: Fri, 13 Apr 2007 08:06:38 +0000 To: kde-commits Subject: koffice/libs/kofficecore Message-Id: <1176451598.469785.12688.nullmailer () svn ! kde ! org> X-MARC-Message: https://marc.info/?l=kde-commits&m=117649165028267 SVN commit 653406 by zander: Remove several deprecated methods and add some API docs. There appears to be a const problem in the softpointer template in krita so I'll leave the get() method for now. This makes the API behave a lot more like a Qt container. M +14 -66 KoGenericRegistry.h --- trunk/koffice/libs/kofficecore/KoGenericRegistry.h #653405:653406 @@ -31,10 +31,7 @@ /** * Base class for registry objects. * - * Items are mapped by KoID. A KoID is the combination of - * a non-localized string that can be used in files and a - * user-visible, translated string that can be used in the - * user interface. + * Items are mapped by QString as a unique Id. */ template class KoGenericRegistry { @@ -63,93 +60,41 @@ } /** - * add an object to the registry - * @param id the id of the object - * @param item the item - */ - KDE_DEPRECATED void add(KoID id, T item) - { - m_hash.insert(id.id(), item); - } - - /** * This function remove an item from the registry - * @return the object which have been remove from the registry and which can be safely delete */ - KDE_DEPRECATED void remove(const KoID& name) - { - m_hash.remove(name.id()); - } - void remove (const QString &id) { m_hash.remove(id); } /** - * This function allow to get an object from its KoID - * @param name the KoID of the object - * @return T the object + * Retrieve the object from the registry based on the unique identifier string + * @param id the id */ - KDE_DEPRECATED T get(const KoID& name) const - { - return m_hash.value(name.id()); - } - - /** - * Get a single entry based on the identifying part of KoID, not the - * the descriptive part. - */ KDE_DEPRECATED T get(const QString& id) const { return value(id); } /** - * @param id - * @return true if there is an object corresponding to id + * @return if there is an object stored in the registry identified by the id. + * @param id the unique identifier string */ - KDE_DEPRECATED bool exists(const KoID& id) const - { - return m_hash.contains(id.id()); - } - - KDE_DEPRECATED bool exists(const QString& id) const - { - return contains(id); - } - bool contains(const QString &id) const { return m_hash.contains(id); } + /** + * Retrieve the object from the registry based on the unique identifier string + * @param id the id + */ const T value(const QString &id) const { return m_hash.value(id); } -#if 0 /** - * This function allow to search a KoID from the name. - * @param t the name to search - * @param result The result is filled in this variable - * @return true if the search has been successful, false otherwise + * This function return a list of all the keys in KoID format by using the name() method + * on the objects stored in the registry. */ - KDE_DEPRECATED bool search(const QString& t, KoID& result) const - { - for(typename storageMap::const_iterator it = m_storage.begin(); - it != m_storage.end(); ++it) - { - if(it->first.name() == t) - { - result = it->first; - return true; - } - } - return false; - } -#endif - - /** This function return a list of all the keys in KoID format - */ QList listKeys() const { QList answer; @@ -158,6 +103,9 @@ return answer; } + /** + * @return a list of all keys + */ QList keys() const { return m_hash.keys(); }