[Ktutorial-commits] SF.net SVN: ktutorial:[232] trunk/ktutorial/ktutorial-editor
Status: Alpha
Brought to you by:
danxuliu
|
From: <dan...@us...> - 2010-04-14 01:14:33
|
Revision: 232
http://ktutorial.svn.sourceforge.net/ktutorial/?rev=232&view=rev
Author: danxuliu
Date: 2010-04-14 01:14:27 +0000 (Wed, 14 Apr 2010)
Log Message:
-----------
Move Exception from root to "util" package to avoid serialization and targetapplication packages linking against the root library.
Modified Paths:
--------------
trunk/ktutorial/ktutorial-editor/src/CMakeLists.txt
trunk/ktutorial/ktutorial-editor/src/serialization/CMakeLists.txt
trunk/ktutorial/ktutorial-editor/src/serialization/DeserializationException.h
trunk/ktutorial/ktutorial-editor/src/serialization/IOException.h
trunk/ktutorial/ktutorial-editor/src/targetapplication/CMakeLists.txt
trunk/ktutorial/ktutorial-editor/src/targetapplication/DBusException.h
trunk/ktutorial/ktutorial-editor/tests/unit/CMakeLists.txt
Added Paths:
-----------
trunk/ktutorial/ktutorial-editor/src/util/
trunk/ktutorial/ktutorial-editor/src/util/CMakeLists.txt
trunk/ktutorial/ktutorial-editor/src/util/Exception.cpp
trunk/ktutorial/ktutorial-editor/src/util/Exception.h
trunk/ktutorial/ktutorial-editor/tests/unit/util/
trunk/ktutorial/ktutorial-editor/tests/unit/util/CMakeLists.txt
trunk/ktutorial/ktutorial-editor/tests/unit/util/ExceptionTest.cpp
Removed Paths:
-------------
trunk/ktutorial/ktutorial-editor/src/Exception.cpp
trunk/ktutorial/ktutorial-editor/src/Exception.h
trunk/ktutorial/ktutorial-editor/tests/unit/ExceptionTest.cpp
Modified: trunk/ktutorial/ktutorial-editor/src/CMakeLists.txt
===================================================================
--- trunk/ktutorial/ktutorial-editor/src/CMakeLists.txt 2010-04-13 20:30:16 UTC (rev 231)
+++ trunk/ktutorial/ktutorial-editor/src/CMakeLists.txt 2010-04-14 01:14:27 UTC (rev 232)
@@ -7,6 +7,7 @@
add_subdirectory(commands)
add_subdirectory(data)
add_subdirectory(serialization)
+add_subdirectory(util)
add_subdirectory(view)
if (QT_QTDBUS_FOUND)
@@ -16,7 +17,6 @@
set(ktutorial_editor_SRCS
EditActions.cpp
- Exception.cpp
FileActions.cpp
KTutorialEditor.cpp
)
@@ -30,6 +30,7 @@
target_link_libraries(ktutorial_editor
ktutorial_editor_data
ktutorial_editor_serialization
+ ktutorial_editor_util
ktutorial_editor_view
)
Deleted: trunk/ktutorial/ktutorial-editor/src/Exception.cpp
===================================================================
--- trunk/ktutorial/ktutorial-editor/src/Exception.cpp 2010-04-13 20:30:16 UTC (rev 231)
+++ trunk/ktutorial/ktutorial-editor/src/Exception.cpp 2010-04-14 01:14:27 UTC (rev 232)
@@ -1,36 +0,0 @@
-/***************************************************************************
- * Copyright (C) 2010 by Daniel Calviño Sánchez *
- * dan...@gm... *
- * *
- * This program is free software; you can redistribute it and/or modify *
- * it under the terms of the GNU General Public License as published by *
- * the Free Software Foundation; either version 3 of the License, or *
- * (at your option) any later version. *
- * *
- * This program is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
- * GNU General Public License for more details. *
- * *
- * You should have received a copy of the GNU General Public License *
- * along with this program; If not, see <http://www.gnu.org/licenses/>. *
- ***************************************************************************/
-
-#include "Exception.h"
-
-//public:
-
-Exception::Exception(const QString& message): std::exception(),
- mMessage(message) {
-}
-
-Exception::~Exception() throw() {
-}
-
-const char* Exception::what() const throw() {
- return mMessage.toUtf8();
-}
-
-QString Exception::message() const throw() {
- return mMessage;
-}
Deleted: trunk/ktutorial/ktutorial-editor/src/Exception.h
===================================================================
--- trunk/ktutorial/ktutorial-editor/src/Exception.h 2010-04-13 20:30:16 UTC (rev 231)
+++ trunk/ktutorial/ktutorial-editor/src/Exception.h 2010-04-14 01:14:27 UTC (rev 232)
@@ -1,54 +0,0 @@
-/***************************************************************************
- * Copyright (C) 2010 by Daniel Calviño Sánchez *
- * dan...@gm... *
- * *
- * This program is free software; you can redistribute it and/or modify *
- * it under the terms of the GNU General Public License as published by *
- * the Free Software Foundation; either version 3 of the License, or *
- * (at your option) any later version. *
- * *
- * This program is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
- * GNU General Public License for more details. *
- * *
- * You should have received a copy of the GNU General Public License *
- * along with this program; If not, see <http://www.gnu.org/licenses/>. *
- ***************************************************************************/
-
-#ifndef EXCEPTION_H
-#define EXCEPTION_H
-
-#include <exception>
-#include <QString>
-
-/**
- * Base class for exceptions.
- */
-class Exception: public std::exception {
-public:
-
- explicit Exception(const QString& message = QString());
- virtual ~Exception() throw();
-
- /**
- * Returns the exception message.
- *
- * @return The exception message.
- */
- virtual const char* what() const throw();
-
- /**
- * Returns the exception message.
- *
- * @return The exception message.
- */
- QString message() const throw();
-
-private:
-
- QString mMessage;
-
-};
-
-#endif
Modified: trunk/ktutorial/ktutorial-editor/src/serialization/CMakeLists.txt
===================================================================
--- trunk/ktutorial/ktutorial-editor/src/serialization/CMakeLists.txt 2010-04-13 20:30:16 UTC (rev 231)
+++ trunk/ktutorial/ktutorial-editor/src/serialization/CMakeLists.txt 2010-04-14 01:14:27 UTC (rev 232)
@@ -9,4 +9,8 @@
kde4_add_library(ktutorial_editor_serialization ${ktutorial_editor_serialization_SRCS})
-target_link_libraries(ktutorial_editor_serialization ktutorial_editor ${KDE4_KIO_LIBS})
+target_link_libraries(ktutorial_editor_serialization
+ ktutorial_editor_data
+ ktutorial_editor_util
+ ${KDE4_KIO_LIBS}
+)
Modified: trunk/ktutorial/ktutorial-editor/src/serialization/DeserializationException.h
===================================================================
--- trunk/ktutorial/ktutorial-editor/src/serialization/DeserializationException.h 2010-04-13 20:30:16 UTC (rev 231)
+++ trunk/ktutorial/ktutorial-editor/src/serialization/DeserializationException.h 2010-04-14 01:14:27 UTC (rev 232)
@@ -19,7 +19,7 @@
#ifndef DESERIALIZATIONEXCEPTION_H
#define DESERIALIZATIONEXCEPTION_H
-#include "../Exception.h"
+#include "../util/Exception.h"
/**
* Thrown when the XML can't be deserialized (for example, when it isn't well
Modified: trunk/ktutorial/ktutorial-editor/src/serialization/IOException.h
===================================================================
--- trunk/ktutorial/ktutorial-editor/src/serialization/IOException.h 2010-04-13 20:30:16 UTC (rev 231)
+++ trunk/ktutorial/ktutorial-editor/src/serialization/IOException.h 2010-04-14 01:14:27 UTC (rev 232)
@@ -19,7 +19,7 @@
#ifndef IOEXCEPTION_H
#define IOEXCEPTION_H
-#include "../Exception.h"
+#include "../util/Exception.h"
/**
* Thrown when an input/ouput operation fails (for example, writing to an
Modified: trunk/ktutorial/ktutorial-editor/src/targetapplication/CMakeLists.txt
===================================================================
--- trunk/ktutorial/ktutorial-editor/src/targetapplication/CMakeLists.txt 2010-04-13 20:30:16 UTC (rev 231)
+++ trunk/ktutorial/ktutorial-editor/src/targetapplication/CMakeLists.txt 2010-04-14 01:14:27 UTC (rev 232)
@@ -9,4 +9,8 @@
kde4_add_library(ktutorial_editor_targetapplication ${ktutorial_editor_targetapplication_SRCS})
-target_link_libraries(ktutorial_editor_targetapplication ktutorial_editor ${QT_QTDBUS_LIBRARY} ${KDE4_KDECORE_LIBS})
+target_link_libraries(ktutorial_editor_targetapplication
+ ktutorial_editor_util
+ ${QT_QTDBUS_LIBRARY}
+ ${KDE4_KDECORE_LIBS}
+)
Modified: trunk/ktutorial/ktutorial-editor/src/targetapplication/DBusException.h
===================================================================
--- trunk/ktutorial/ktutorial-editor/src/targetapplication/DBusException.h 2010-04-13 20:30:16 UTC (rev 231)
+++ trunk/ktutorial/ktutorial-editor/src/targetapplication/DBusException.h 2010-04-14 01:14:27 UTC (rev 232)
@@ -19,7 +19,7 @@
#ifndef DBUSEXCEPTION_H
#define DBUSEXCEPTION_H
-#include "../Exception.h"
+#include "../util/Exception.h"
/**
* Thrown when a DBus error happened.
Added: trunk/ktutorial/ktutorial-editor/src/util/CMakeLists.txt
===================================================================
--- trunk/ktutorial/ktutorial-editor/src/util/CMakeLists.txt (rev 0)
+++ trunk/ktutorial/ktutorial-editor/src/util/CMakeLists.txt 2010-04-14 01:14:27 UTC (rev 232)
@@ -0,0 +1,5 @@
+set(ktutorial_editor_util_SRCS
+ Exception.cpp
+)
+
+kde4_add_library(ktutorial_editor_util ${ktutorial_editor_util_SRCS})
Property changes on: trunk/ktutorial/ktutorial-editor/src/util/CMakeLists.txt
___________________________________________________________________
Added: svn:eol-style
+ native
Copied: trunk/ktutorial/ktutorial-editor/src/util/Exception.cpp (from rev 198, trunk/ktutorial/ktutorial-editor/src/Exception.cpp)
===================================================================
--- trunk/ktutorial/ktutorial-editor/src/util/Exception.cpp (rev 0)
+++ trunk/ktutorial/ktutorial-editor/src/util/Exception.cpp 2010-04-14 01:14:27 UTC (rev 232)
@@ -0,0 +1,36 @@
+/***************************************************************************
+ * Copyright (C) 2010 by Daniel Calviño Sánchez *
+ * dan...@gm... *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 3 of the License, or *
+ * (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; If not, see <http://www.gnu.org/licenses/>. *
+ ***************************************************************************/
+
+#include "Exception.h"
+
+//public:
+
+Exception::Exception(const QString& message): std::exception(),
+ mMessage(message) {
+}
+
+Exception::~Exception() throw() {
+}
+
+const char* Exception::what() const throw() {
+ return mMessage.toUtf8();
+}
+
+QString Exception::message() const throw() {
+ return mMessage;
+}
Copied: trunk/ktutorial/ktutorial-editor/src/util/Exception.h (from rev 198, trunk/ktutorial/ktutorial-editor/src/Exception.h)
===================================================================
--- trunk/ktutorial/ktutorial-editor/src/util/Exception.h (rev 0)
+++ trunk/ktutorial/ktutorial-editor/src/util/Exception.h 2010-04-14 01:14:27 UTC (rev 232)
@@ -0,0 +1,54 @@
+/***************************************************************************
+ * Copyright (C) 2010 by Daniel Calviño Sánchez *
+ * dan...@gm... *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 3 of the License, or *
+ * (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; If not, see <http://www.gnu.org/licenses/>. *
+ ***************************************************************************/
+
+#ifndef EXCEPTION_H
+#define EXCEPTION_H
+
+#include <exception>
+#include <QString>
+
+/**
+ * Base class for exceptions.
+ */
+class Exception: public std::exception {
+public:
+
+ explicit Exception(const QString& message = QString());
+ virtual ~Exception() throw();
+
+ /**
+ * Returns the exception message.
+ *
+ * @return The exception message.
+ */
+ virtual const char* what() const throw();
+
+ /**
+ * Returns the exception message.
+ *
+ * @return The exception message.
+ */
+ QString message() const throw();
+
+private:
+
+ QString mMessage;
+
+};
+
+#endif
Modified: trunk/ktutorial/ktutorial-editor/tests/unit/CMakeLists.txt
===================================================================
--- trunk/ktutorial/ktutorial-editor/tests/unit/CMakeLists.txt 2010-04-13 20:30:16 UTC (rev 231)
+++ trunk/ktutorial/ktutorial-editor/tests/unit/CMakeLists.txt 2010-04-14 01:14:27 UTC (rev 232)
@@ -4,31 +4,5 @@
if (QT_QTDBUS_FOUND)
add_subdirectory(targetapplication)
endif (QT_QTDBUS_FOUND)
+add_subdirectory(util)
add_subdirectory(view)
-
-# Used by kde4_add_unit_test to set the full path to test executables
-set(EXECUTABLE_OUTPUT_PATH ${CMAKE_CURRENT_BINARY_DIR})
-
-include_directories(${ktutorial-editor_SOURCE_DIR}/src/ ${KDE4_INCLUDES})
-
-MACRO(UNIT_TESTS)
- FOREACH(_className ${ARGN})
- set(_testName ${_className}Test)
- kde4_add_unit_test(${_testName} TESTNAME ktutorial-editor-unit-${_testName} ${_testName}.cpp)
- target_link_libraries(${_testName} ktutorial_editor ${QT_QTTEST_LIBRARY})
- ENDFOREACH(_className)
-ENDMACRO(UNIT_TESTS)
-
-unit_tests(
- Exception
-)
-
-MACRO(MEM_TESTS)
- FOREACH(_testname ${ARGN})
- add_test(ktutorial-editor-unit-mem-${_testname} ${CMAKE_CURRENT_SOURCE_DIR}/runMemcheck.py ${CMAKE_CURRENT_BINARY_DIR}/${_testname}Test ${CMAKE_CURRENT_BINARY_DIR})
- ENDFOREACH(_testname)
-ENDMACRO(MEM_TESTS)
-
-mem_tests(
- Exception
-)
Deleted: trunk/ktutorial/ktutorial-editor/tests/unit/ExceptionTest.cpp
===================================================================
--- trunk/ktutorial/ktutorial-editor/tests/unit/ExceptionTest.cpp 2010-04-13 20:30:16 UTC (rev 231)
+++ trunk/ktutorial/ktutorial-editor/tests/unit/ExceptionTest.cpp 2010-04-14 01:14:27 UTC (rev 232)
@@ -1,49 +0,0 @@
-/***************************************************************************
- * Copyright (C) 2010 by Daniel Calviño Sánchez *
- * dan...@gm... *
- * *
- * This program is free software; you can redistribute it and/or modify *
- * it under the terms of the GNU General Public License as published by *
- * the Free Software Foundation; either version 3 of the License, or *
- * (at your option) any later version. *
- * *
- * This program is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
- * GNU General Public License for more details. *
- * *
- * You should have received a copy of the GNU General Public License *
- * along with this program; If not, see <http://www.gnu.org/licenses/>. *
- ***************************************************************************/
-
-#include <QtTest>
-
-#include "Exception.h"
-
-class ExceptionTest: public QObject {
-Q_OBJECT
-
-private slots:
-
- void testConstructor();
- void testConstructorEmpty();
-
-};
-
-void ExceptionTest::testConstructor() {
- Exception exception(QString("The message"));
-
- QCOMPARE(exception.what(), "The message");
- QCOMPARE(exception.message(), QString("The message"));
-}
-
-void ExceptionTest::testConstructorEmpty() {
- Exception exception;
-
- QCOMPARE(exception.what(), "");
- QCOMPARE(exception.message(), QString(""));
-}
-
-QTEST_MAIN(ExceptionTest)
-
-#include "ExceptionTest.moc"
Added: trunk/ktutorial/ktutorial-editor/tests/unit/util/CMakeLists.txt
===================================================================
--- trunk/ktutorial/ktutorial-editor/tests/unit/util/CMakeLists.txt (rev 0)
+++ trunk/ktutorial/ktutorial-editor/tests/unit/util/CMakeLists.txt 2010-04-14 01:14:27 UTC (rev 232)
@@ -0,0 +1,26 @@
+# Used by kde4_add_unit_test to set the full path to test executables
+set(EXECUTABLE_OUTPUT_PATH ${CMAKE_CURRENT_BINARY_DIR})
+
+include_directories(${ktutorial-editor_SOURCE_DIR}/src/util ${KDE4_INCLUDES})
+
+MACRO(UNIT_TESTS)
+ FOREACH(_className ${ARGN})
+ set(_testName ${_className}Test)
+ kde4_add_unit_test(${_testName} TESTNAME ktutorial-editor-unit-${_testName} ${_testName}.cpp)
+ target_link_libraries(${_testName} ktutorial_editor_util ${QT_QTTEST_LIBRARY})
+ ENDFOREACH(_className)
+ENDMACRO(UNIT_TESTS)
+
+unit_tests(
+ Exception
+)
+
+MACRO(MEM_TESTS)
+ FOREACH(_testname ${ARGN})
+ add_test(ktutorial-editor-unit-mem-${_testname} ${CMAKE_CURRENT_SOURCE_DIR}/../runMemcheck.py ${CMAKE_CURRENT_BINARY_DIR}/${_testname}Test ${CMAKE_CURRENT_BINARY_DIR})
+ ENDFOREACH(_testname)
+ENDMACRO(MEM_TESTS)
+
+mem_tests(
+ Exception
+)
Property changes on: trunk/ktutorial/ktutorial-editor/tests/unit/util/CMakeLists.txt
___________________________________________________________________
Added: svn:eol-style
+ native
Copied: trunk/ktutorial/ktutorial-editor/tests/unit/util/ExceptionTest.cpp (from rev 198, trunk/ktutorial/ktutorial-editor/tests/unit/ExceptionTest.cpp)
===================================================================
--- trunk/ktutorial/ktutorial-editor/tests/unit/util/ExceptionTest.cpp (rev 0)
+++ trunk/ktutorial/ktutorial-editor/tests/unit/util/ExceptionTest.cpp 2010-04-14 01:14:27 UTC (rev 232)
@@ -0,0 +1,49 @@
+/***************************************************************************
+ * Copyright (C) 2010 by Daniel Calviño Sánchez *
+ * dan...@gm... *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 3 of the License, or *
+ * (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; If not, see <http://www.gnu.org/licenses/>. *
+ ***************************************************************************/
+
+#include <QtTest>
+
+#include "Exception.h"
+
+class ExceptionTest: public QObject {
+Q_OBJECT
+
+private slots:
+
+ void testConstructor();
+ void testConstructorEmpty();
+
+};
+
+void ExceptionTest::testConstructor() {
+ Exception exception(QString("The message"));
+
+ QCOMPARE(exception.what(), "The message");
+ QCOMPARE(exception.message(), QString("The message"));
+}
+
+void ExceptionTest::testConstructorEmpty() {
+ Exception exception;
+
+ QCOMPARE(exception.what(), "");
+ QCOMPARE(exception.message(), QString(""));
+}
+
+QTEST_MAIN(ExceptionTest)
+
+#include "ExceptionTest.moc"
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|