[Ktutorial-commits] SF.net SVN: ktutorial:[362] trunk/ktutorial/ktutorial-editor
Status: Alpha
Brought to you by:
danxuliu
From: <dan...@us...> - 2012-08-10 11:28:28
|
Revision: 362 http://ktutorial.svn.sourceforge.net/ktutorial/?rev=362&view=rev Author: danxuliu Date: 2012-08-10 11:28:21 +0000 (Fri, 10 Aug 2012) Log Message: ----------- Remove "clear" method, as it is used nowhere. Modified Paths: -------------- trunk/ktutorial/ktutorial-editor/src/targetapplication/RemoteObjectMapper.cpp trunk/ktutorial/ktutorial-editor/src/targetapplication/RemoteObjectMapper.h trunk/ktutorial/ktutorial-editor/tests/unit/targetapplication/RemoteObjectMapperTest.cpp Modified: trunk/ktutorial/ktutorial-editor/src/targetapplication/RemoteObjectMapper.cpp =================================================================== --- trunk/ktutorial/ktutorial-editor/src/targetapplication/RemoteObjectMapper.cpp 2012-08-10 11:19:33 UTC (rev 361) +++ trunk/ktutorial/ktutorial-editor/src/targetapplication/RemoteObjectMapper.cpp 2012-08-10 11:28:21 UTC (rev 362) @@ -59,11 +59,3 @@ return remoteClass; } - -void RemoteObjectMapper::clear() { - qDeleteAll(mRemoteObjects); - mRemoteObjects.clear(); - - qDeleteAll(mRemoteClasses); - mRemoteClasses.clear(); -} Modified: trunk/ktutorial/ktutorial-editor/src/targetapplication/RemoteObjectMapper.h =================================================================== --- trunk/ktutorial/ktutorial-editor/src/targetapplication/RemoteObjectMapper.h 2012-08-10 11:19:33 UTC (rev 361) +++ trunk/ktutorial/ktutorial-editor/src/targetapplication/RemoteObjectMapper.h 2012-08-10 11:28:21 UTC (rev 362) @@ -32,7 +32,7 @@ * depending on the case. The same behavior is shown for RemoteClasses. * * The RemoteObjectMapper also has ownership of the RemoteObjects and - * RemoteClasses, so they are deleted when the mapper is cleared or destroyed. + * RemoteClasses, so they are deleted when the mapper is destroyed. */ class RemoteObjectMapper { public: @@ -52,8 +52,8 @@ /** * Returns the RemoteObject associated with the given object id. - * The RemoteObject is destroyed when this RemoteObjectMapper is cleared or - * destroyed, so consider using QPointer to store it. + * The RemoteObject is destroyed when this RemoteObjectMapper is destroyed, + * so consider using QPointer to store it. * The object id 0 is a special case, and it is associated to the null * object; a null pointer is returned in this case. * @@ -64,19 +64,14 @@ /** * Returns the RemoteClass associated with the given class name. - * The RemoteClass is destroyed when this RemoteObjectMapper is cleared or - * destroyed, so consider using QPointer to store it. + * The RemoteClass is destroyed when this RemoteObjectMapper is destroyed, + * so consider using QPointer to store it. * * @param className The name of the remote class. * @return The RemoteClass. */ RemoteClass* remoteClass(const QString& className); - /** - * Destroys all the mapped RemoteObjects and RemoteClasses. - */ - void clear(); - private: /** @@ -85,14 +80,12 @@ QString mService; /** - * All the RemoteObjects already requested since the last time this - * RemoteObjectMapper was cleared. + * All the RemoteObjects already requested. */ QHash<int, RemoteObject*> mRemoteObjects; /** - * All the RemoteClasses already requested since the last time this - * RemoteObjectMapper was cleared. + * All the RemoteClasses already requested. */ QHash<QString, RemoteClass*> mRemoteClasses; Modified: trunk/ktutorial/ktutorial-editor/tests/unit/targetapplication/RemoteObjectMapperTest.cpp =================================================================== --- trunk/ktutorial/ktutorial-editor/tests/unit/targetapplication/RemoteObjectMapperTest.cpp 2012-08-10 11:19:33 UTC (rev 361) +++ trunk/ktutorial/ktutorial-editor/tests/unit/targetapplication/RemoteObjectMapperTest.cpp 2012-08-10 11:28:21 UTC (rev 362) @@ -43,7 +43,6 @@ void testRemoteClassSeveralIds(); void testRemoteClassTwice(); - void testClear(); private: StubObjectRegister* mObjectRegister; @@ -149,23 +148,6 @@ QCOMPARE(remoteClass1->className(), QString("Class")); } -void RemoteObjectMapperTest::testClear() { - RemoteObjectMapper mapper(QDBusConnection::sessionBus().baseService()); - - QPointer<RemoteObject> remoteObject1 = mapper.remoteObject(42); - QPointer<RemoteClass> remoteClass1 = mapper.remoteClass("Class"); - - mapper.clear(); - - RemoteObject* remoteObject2 = mapper.remoteObject(42); - RemoteClass* remoteClass2 = mapper.remoteClass("Class"); - - QVERIFY(!remoteObject1); - QVERIFY(remoteObject2); - QVERIFY(!remoteClass1); - QVERIFY(remoteClass2); -} - QTEST_MAIN(RemoteObjectMapperTest) #include "RemoteObjectMapperTest.moc" This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |