[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: =?utf-8?q?=5Bcalligra=5D_plugins/vectorshape/libsvm=3A_Added_str?=
From: Inge Wallin <inge () lysator ! liu ! se>
Date: 2011-04-24 0:28:18
Message-ID: 20110424002818.D2ED6A60A4 () git ! kde ! org
[Download RAW message or body]
Git commit c68f0e9c392a1e9889ac2c574ee96a5e355ba0a0 by Inge Wallin.
Committed on 24/04/2011 at 02:27.
Pushed by ingwa into branch 'master'.
Added structs for basic SVM datatypes
A +31 -0 plugins/vectorshape/libsvm/CMakeLists.txt [License: UNKNOWN] \
* A +124 -0 plugins/vectorshape/libsvm/SvmStructs.cpp [License: LGPL \
(v2.1+)] A +100 -0 plugins/vectorshape/libsvm/SvmStructs.h [License: \
LGPL (v2.1+)]
The files marked with a * at the end have a non valid license. Please read: \
http://techbase.kde.org/Policies/Licensing_Policy and use the headers which are \
listed at that page.
http://commits.kde.org/calligra/c68f0e9c392a1e9889ac2c574ee96a5e355ba0a0
diff --git a/plugins/vectorshape/libsvm/CMakeLists.txt \
b/plugins/vectorshape/libsvm/CMakeLists.txt new file mode 100644
index 0000000..5ac53c0
--- /dev/null
+++ b/plugins/vectorshape/libsvm/CMakeLists.txt
@@ -0,0 +1,31 @@
+
+
+include_directories( ${KOMAIN_INCLUDES} )
+
+#add_subdirectory(demo)
+
+
+########### library target ###############
+
+set(libsvm_LIB_SRCS
+ #SvmStructs.cpp
+)
+
+#kde4_add_library(libsvm SHARED ${libsvm_LIB_SRCS})
+
+#target_link_libraries(libsvm ${KDE4_KDECORE_LIBS} ${QT_QTGUI_LIBRARY} )
+
+#set_target_properties(libsvm PROPERTIES VERSION ${GENERIC_KOFFICE_LIB_VERSION} \
SOVERSION ${GENERIC_KOFFICE_LIB_SOVERSION} ) +
+
+########### install files ###############
+
+#install(TARGETS libsvm ${INSTALL_TARGETS_DEFAULT_ARGS})
+
+#install(
+# FILES
+# SvmEnums.h
+# SvmStructs.h
+# svm_export.h
+# DESTINATION ${INCLUDE_INSTALL_DIR} COMPONENT Devel
+#)
diff --git a/plugins/vectorshape/libsvm/SvmStructs.cpp \
b/plugins/vectorshape/libsvm/SvmStructs.cpp new file mode 100644
index 0000000..e64980a
--- /dev/null
+++ b/plugins/vectorshape/libsvm/SvmStructs.cpp
@@ -0,0 +1,124 @@
+/* This file is part of the Calligra project
+
+ Copyright 2011 Inge Wallin <inge@lysator.liu.se>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ This library 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
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#include "SvmStructs.h"
+
+#include <QDataStream>
+
+
+namespace Libsvm
+{
+
+VersionCompat::VersionCompat()
+ : version(0)
+ , length(0)
+{
+}
+
+VersionCompat::VersionCompat(QDataStream &stream)
+{
+ stream >> version;
+ stream >> length;
+}
+
+QDataStream &operator>>(QDataStream &stream, VersionCompat &compat)
+{
+ stream >> compat.version;
+ stream >> compat.length;
+
+ return stream;
+}
+
+
+Fraction::Fraction()
+ : numerator(1)
+ , denominator(1)
+{
+}
+
+Fraction::Fraction(QDataStream &stream)
+{
+ stream >> numerator;
+ stream >> denominator;
+}
+
+QDataStream &operator>>(QDataStream &stream, Fraction &fract)
+{
+ stream >> fract.numerator;
+ stream >> fract.denominator;
+
+ return stream;
+}
+
+
+MapMode::MapMode()
+ : version()
+ , unit(0)
+ , origin(0, 0)
+ , scaleX()
+ , scaleY()
+ , isSimple(true)
+{
+}
+
+MapMode::MapMode(QDataStream &stream)
+{
+ stream >> *this;
+}
+
+QDataStream &operator>>(QDataStream &stream, MapMode &mm)
+{
+ stream >> mm.version;
+ stream >> mm.unit;
+ stream >> mm.origin;
+ stream >> mm.scaleX;
+ stream >> mm.scaleY;
+ stream >> mm.isSimple; // FIXME: how many bytes?
+
+ return stream;
+}
+
+SvmHeader::SvmHeader()
+ : versionCompat()
+ , compressionMode()
+ , mapMode()
+ , width(0)
+ , height(0)
+ , actionCount(0)
+{
+}
+
+SvmHeader::SvmHeader(QDataStream &stream)
+{
+ stream >> *this;
+}
+
+QDataStream &operator>>(QDataStream &stream, SvmHeader &header)
+{
+ stream >> header.versionCompat;
+ stream >> header.compressionMode;
+ stream >> header.mapMode;
+ stream >> header.width;
+ stream >> header.height;
+ stream >> header.actionCount;
+
+ return stream;
+}
+
+
+};
diff --git a/plugins/vectorshape/libsvm/SvmStructs.h \
b/plugins/vectorshape/libsvm/SvmStructs.h new file mode 100644
index 0000000..1902aa1
--- /dev/null
+++ b/plugins/vectorshape/libsvm/SvmStructs.h
@@ -0,0 +1,100 @@
+/* This file is part of the Calligra project
+
+ Copyright 2011 Inge Wallin <inge@lysator.liu.se>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ This library 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
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef SVMSTRUCT_H
+#define SVMSTRUCT_H
+
+#include <qglobal.h>
+#include <QPoint>
+
+class QDataStream;
+
+/**
+ * @file
+ *
+ * Structs used in various parts of SVM files.
+ */
+
+/**
+ Namespace for StarView Metafile (SVM) classes
+*/
+namespace Libsvm
+{
+
+/**
+ * Contains version and length of an action.
+ */
+struct VersionCompat {
+ VersionCompat();
+ VersionCompat(QDataStream &stream);
+
+ quint16 version;
+ quint32 length;
+};
+
+QDataStream &operator>>(QDataStream &stream, VersionCompat &compat);
+
+
+
+struct Fraction {
+ Fraction();
+ Fraction(QDataStream &stream);
+
+ quint32 numerator;
+ quint32 denominator;
+};
+
+QDataStream &operator>>(QDataStream &stream, Fraction &fract);
+
+
+struct MapMode {
+ MapMode();
+ MapMode(QDataStream &stream);
+
+ VersionCompat version;
+ quint16 unit;
+ QPoint origin;
+ Fraction scaleX;
+ Fraction scaleY;
+ bool isSimple;
+};
+
+QDataStream &operator>>(QDataStream &stream, MapMode &mm);
+
+
+/**
+ * The header of an SVM file.
+ */
+struct SvmHeader {
+ SvmHeader();
+ SvmHeader(QDataStream &stream);
+
+ VersionCompat versionCompat;
+ quint32 compressionMode;
+ MapMode mapMode;
+ quint32 width;
+ quint32 height;
+ quint32 actionCount;
+};
+
+QDataStream &operator>>(QDataStream &stream, SvmHeader &header);
+
+
+}
+
+#endif
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic