From eb1beec1dd0e444b15e4227609e11314420f4dbd Mon Sep 17 00:00:00 2001 From: "Aaron J. Seigo" Date: Mon, 14 Jul 2008 22:25:21 +0000 Subject: [PATCH] version files svn path=/trunk/KDE/kdebase/workspace/libs/plasma/; revision=832542 --- CMakeLists.txt | 7 ++-- includes/Version | 1 + version.cpp | 51 +++++++++++++++++++++++++++++ version.h | 85 ++++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 142 insertions(+), 2 deletions(-) create mode 100644 includes/Version create mode 100644 version.cpp create mode 100644 version.h diff --git a/CMakeLists.txt b/CMakeLists.txt index 5653627ca..b3e36f1cb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -59,6 +59,7 @@ set(plasma_LIB_SRCS theme.cpp toolbox.cpp uiloader.cpp + version.cpp view.cpp widgets/checkbox.cpp widgets/combobox.cpp @@ -140,6 +141,7 @@ set(plasma_LIB_INCLUDES svg.h theme.h uiloader.h + version.h view.h) if(QT_QTOPENGL_FOUND AND OPENGL_FOUND) @@ -226,6 +228,7 @@ includes/TextEdit includes/Theme includes/UiLoader includes/View +includes/Version includes/WebContent DESTINATION ${INCLUDE_INSTALL_DIR}/KDE/Plasma COMPONENT Devel) @@ -242,8 +245,8 @@ install(FILES servicetypes/plasma-dataengine.desktop servicetypes/plasma-packagestructure.desktop servicetypes/plasma-runner.desktop - servicetypes/plasma-scriptengine.desktop - DESTINATION ${SERVICETYPES_INSTALL_DIR}) + servicetypes/plasma-scriptengine.desktop + DESTINATION ${SERVICETYPES_INSTALL_DIR}) install(FILES scripting/plasmoids.knsrc DESTINATION ${CONFIG_INSTALL_DIR}) diff --git a/includes/Version b/includes/Version new file mode 100644 index 000000000..61716764e --- /dev/null +++ b/includes/Version @@ -0,0 +1 @@ +#include "../../plasma/version.h" diff --git a/version.cpp b/version.cpp new file mode 100644 index 000000000..a948651bc --- /dev/null +++ b/version.cpp @@ -0,0 +1,51 @@ +/* + * Copyright 2008 by Aaron Seigo + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Library General Public License as + * published by the Free Software Foundation; either version 2, 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 Library General Public + * License along with this program; if not, write to the + * Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#include + +namespace Plasma +{ + +unsigned int version() +{ + return PLASMA_VERSION; +} + +unsigned int versionMajor() +{ + return PLASMA_VERSION_MAJOR; +} + +unsigned int versionMinor() +{ + return PLASMA_VERSION_MINOR; +} + +unsigned int versionRelease() +{ + return PLASMA_VERSION_RELEASE; +} + +const char *versionString() +{ + return PLASMA_VERSION_STRING; +} + +} // Plasma namespace + diff --git a/version.h b/version.h new file mode 100644 index 000000000..d0acb4acd --- /dev/null +++ b/version.h @@ -0,0 +1,85 @@ +/* + * Copyright 2008 by Aaron Seigo + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Library General Public License as + * published by the Free Software Foundation; either version 2, 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 Library General Public + * License along with this program; if not, write to the + * Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef PLASMA_VERSION_H +#define PLASMA_VERSION_H + +#include + +/** + * String version of libplasma version, suitable for use in + * file formats or network protocols + */ +#define PLASMA_VERSION_STRING "2.1.0" + +/// @brief Major version of libplasma, at compile time +#define PLASMA_VERSION_MAJOR 2 +/// @brief Minor version of libplasma, at compile time +#define PLASMA_VERSION_MINOR 1 +/// @brief Release version of libplasma, at compile time +#define PLASMA_VERSION_RELEASE 0 + +#define PLASMA_MAKE_VERSION(a,b,c) (((a) << 16) | ((b) << 8) | (c)) + +/** + * Compile time macro for the version number of libplasma + */ +#define PLASMA_VERSION \ + PLASMA_MAKE_VERSION(PLASMA_VERSION_MAJOR,PLASMA_VERSION_MINOR,PLASMA_VERSION_RELEASE) + +/** + * Compile-time macro for checking the plasma version. Not useful for + * detecting the version of libplasma at runtime. + */ +#define PLASMA_IS_VERSION(a,b,c) (PLASMA_VERSION >= PLASMA_MAKE_VERSION(a,b,c)) + +/** + * Namespace for everything in libplasma + */ +namespace Plasma +{ + +/** + * The runtime version of libplasma + */ +PLASMA_EXPORT unsigned int version(); + +/** + * The runtime major version of libplasma + */ +PLASMA_EXPORT unsigned int versionMajor(); + +/** + * The runtime major version of libplasma + */ +PLASMA_EXPORT unsigned int versionMinor(); + +/** + * The runtime major version of libplasma + */ +PLASMA_EXPORT unsigned int versionRelease(); + +/** + * The runtime version string of libplasma + */ +PLASMA_EXPORT const char *versionString(); + +} // Plasma namespace + +#endif // multiple inclusion guard