summaryrefslogtreecommitdiffstats
path: root/fbreader/src/formats/dummy
diff options
context:
space:
mode:
authorMichele Calgaro <[email protected]>2024-05-11 21:28:48 +0900
committerMichele Calgaro <[email protected]>2024-05-11 21:28:48 +0900
commit2462d03f322261bd616721c2b2065c4004b36c9c (patch)
tree239947a0737bb8386703a1497f12c09aebd3080a /fbreader/src/formats/dummy
downloadtde-ebook-reader-2462d03f322261bd616721c2b2065c4004b36c9c.tar.gz
tde-ebook-reader-2462d03f322261bd616721c2b2065c4004b36c9c.zip
Initial import (as is) from Debian Snapshot's 'fbreader' source code (https://snapshot.debian.org/package/fbreader/0.99.4%2Bdfsg-6).
The Debian code is provided under GPL2 license. Signed-off-by: Michele Calgaro <[email protected]>
Diffstat (limited to 'fbreader/src/formats/dummy')
-rw-r--r--fbreader/src/formats/dummy/DummyBookReader.cpp42
-rw-r--r--fbreader/src/formats/dummy/DummyBookReader.h44
-rw-r--r--fbreader/src/formats/dummy/DummyMetaInfoReader.cpp40
-rw-r--r--fbreader/src/formats/dummy/DummyMetaInfoReader.h46
-rw-r--r--fbreader/src/formats/dummy/DummyPlugin.cpp57
-rw-r--r--fbreader/src/formats/dummy/DummyPlugin.h38
-rwxr-xr-xfbreader/src/formats/dummy/createPlugin.sh12
7 files changed, 279 insertions, 0 deletions
diff --git a/fbreader/src/formats/dummy/DummyBookReader.cpp b/fbreader/src/formats/dummy/DummyBookReader.cpp
new file mode 100644
index 0000000..2684ebf
--- /dev/null
+++ b/fbreader/src/formats/dummy/DummyBookReader.cpp
@@ -0,0 +1,42 @@
+/*
+ * Copyright (C) 2004-2012 Geometer Plus <[email protected]>
+ *
+ * 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 2 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, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301, USA.
+ */
+
+#include <ZLInputStream.h>
+
+#include "DummyBookReader.h"
+#include "../../bookmodel/BookModel.h"
+
+DummyBookReader::DummyBookReader(BookModel &model) : myModelReader(model) {
+}
+
+/*
+void DummyBookReader::characterDataHandler(const char *text, std::size_t len) {
+}
+
+void DummyBookReader::startElementHandler(int tag, const char **xmlattributes) {
+}
+
+void DummyBookReader::endElementHandler(int tag) {
+}
+*/
+
+bool DummyBookReader::readBook(shared_ptr<ZLInputStream> stream) {
+ //return readDocument(stream);
+ return true;
+}
diff --git a/fbreader/src/formats/dummy/DummyBookReader.h b/fbreader/src/formats/dummy/DummyBookReader.h
new file mode 100644
index 0000000..ba6bcf8
--- /dev/null
+++ b/fbreader/src/formats/dummy/DummyBookReader.h
@@ -0,0 +1,44 @@
+/*
+ * Copyright (C) 2004-2012 Geometer Plus <[email protected]>
+ *
+ * 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 2 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, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301, USA.
+ */
+
+#ifndef __DUMMYBOOKREADER_H__
+#define __DUMMYBOOKREADER_H__
+
+#include "../../bookmodel/BookReader.h"
+
+class DummyBookReader {
+
+public:
+ DummyBookReader(BookModel &model);
+ ~DummyBookReader();
+ bool readBook(shared_ptr<ZLInputStream> stream);
+
+ /*
+ void startElementHandler(int tag, const char **attributes);
+ void endElementHandler(int tag);
+ void characterDataHandler(const char *text, std::size_t len);
+ */
+
+private:
+ BookReader myModelReader;
+};
+
+inline DummyBookReader::~DummyBookReader() {}
+
+#endif /* __DUMMYBOOKREADER_H__ */
diff --git a/fbreader/src/formats/dummy/DummyMetaInfoReader.cpp b/fbreader/src/formats/dummy/DummyMetaInfoReader.cpp
new file mode 100644
index 0000000..5dd13c5
--- /dev/null
+++ b/fbreader/src/formats/dummy/DummyMetaInfoReader.cpp
@@ -0,0 +1,40 @@
+/*
+ * Copyright (C) 2004-2012 Geometer Plus <[email protected]>
+ *
+ * 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 2 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, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301, USA.
+ */
+
+#include <ZLInputStream.h>
+
+#include "DummyMetaInfoReader.h"
+
+DummyMetaInfoReader::DummyMetaInfoReader(Book &book) : myBook(book) {
+}
+
+/*
+void DummyMetaInfoReader::characterDataHandler(const char *text, std::size_t len) {
+}
+
+void DummyMetaInfoReader::startElementHandler(int tag, const char **) {
+}
+
+void DummyMetaInfoReader::endElementHandler(int tag) {
+}
+*/
+
+bool DummyMetaInfoReader::readMetaInfo(shared_ptr<ZLInputStream> stream) {
+ return false;
+}
diff --git a/fbreader/src/formats/dummy/DummyMetaInfoReader.h b/fbreader/src/formats/dummy/DummyMetaInfoReader.h
new file mode 100644
index 0000000..818d996
--- /dev/null
+++ b/fbreader/src/formats/dummy/DummyMetaInfoReader.h
@@ -0,0 +1,46 @@
+/*
+ * Copyright (C) 2004-2012 Geometer Plus <[email protected]>
+ *
+ * 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 2 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, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301, USA.
+ */
+
+#ifndef __DUMMYMETAINFOREADER_H__
+#define __DUMMYMETAINFOREADER_H__
+
+#include <string>
+
+class Book;
+
+class DummyMetaInfoReader {
+
+public:
+ DummyMetaInfoReader(Book &book);
+ ~DummyMetaInfoReader();
+ bool readMetaInfo(shared_ptr<ZLInputStream> stream);
+
+ /*
+ void startElementHandler(int tag, const char **attributes);
+ void endElementHandler(int tag);
+ void characterDataHandler(const char *text, std::size_t len);
+ */
+
+private:
+ Book &myBook;
+};
+
+inline DummyMetaInfoReader::~DummyMetaInfoReader() {}
+
+#endif /* __DUMMYMETAINFOREADER_H__ */
diff --git a/fbreader/src/formats/dummy/DummyPlugin.cpp b/fbreader/src/formats/dummy/DummyPlugin.cpp
new file mode 100644
index 0000000..bfe0662
--- /dev/null
+++ b/fbreader/src/formats/dummy/DummyPlugin.cpp
@@ -0,0 +1,57 @@
+/*
+ * Copyright (C) 2004-2012 Geometer Plus <[email protected]>
+ *
+ * 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 2 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, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301, USA.
+ */
+
+#include <ZLFile.h>
+#include <ZLInputStream.h>
+
+#include "DummyPlugin.h"
+#include "DummyMetaInfoReader.h"
+#include "DummyBookReader.h"
+#include "../../library/Book.h"
+
+DummyPlugin::DummyPlugin() {
+}
+
+DummyPlugin::~DummyPlugin() {
+}
+
+bool DummyPlugin::providesMetaInfo() const {
+ return true;
+}
+
+bool DummyPlugin::acceptsFile(const ZLFile &file) const {
+ return file.extension() == "dummy";
+}
+
+bool DummyPlugin::readMetaInfo(Book &book) const {
+ return DummyMetaInfoReader(book).readMetaInfo(ZLFile(path).inputStream());
+}
+
+bool DummyPlugin::readLanguageAndEncoding(Book &book) const {
+ (void)book;
+ return true;
+}
+
+bool DummyPlugin::readModel(BookModel &model) const {
+ return DummyBookReader(model).readBook(ZLFile(book.fileName()).inputStream());
+}
+
+shared_ptr<const ZLImage> DummyPlugin::coverImage(const ZLFile &file) const {
+ return DummyCoverReader(file).readCover();
+}
diff --git a/fbreader/src/formats/dummy/DummyPlugin.h b/fbreader/src/formats/dummy/DummyPlugin.h
new file mode 100644
index 0000000..073449c
--- /dev/null
+++ b/fbreader/src/formats/dummy/DummyPlugin.h
@@ -0,0 +1,38 @@
+/*
+ * Copyright (C) 2004-2012 Geometer Plus <[email protected]>
+ *
+ * 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 2 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, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301, USA.
+ */
+
+#ifndef __DUMMYPLUGIN_H__
+#define __DUMMYPLUGIN_H__
+
+#include "../FormatPlugin.h"
+
+class DummyPlugin : public FormatPlugin {
+
+public:
+ DummyPlugin();
+ ~DummyPlugin();
+ bool providesMetaInfo() const;
+ bool acceptsFile(const ZLFile &file) const;
+ bool readMetaInfo(Book &book) const;
+ bool readLanguageAndEncoding(Book &book) const;
+ bool readModel(BookModel &model) const;
+ shared_ptr<const ZLImage> coverImage(const ZLFile &file) const;
+};
+
+#endif /* __DUMMYPLUGIN_H__ */
diff --git a/fbreader/src/formats/dummy/createPlugin.sh b/fbreader/src/formats/dummy/createPlugin.sh
new file mode 100755
index 0000000..aacc3d4
--- /dev/null
+++ b/fbreader/src/formats/dummy/createPlugin.sh
@@ -0,0 +1,12 @@
+#!/bin/sh
+
+if [ $# != 3 ]; then
+ echo "usage: $0 <short_format_name> <camel_cased_format_name> <upper_cased_format_name>";
+ exit 0;
+fi;
+
+if mkdir ../$1; then
+ for file in Dummy*.h Dummy*.cpp; do
+ sed "s/Dummy/$2/g" $file | sed "s/DUMMY/$3/g" > ../$1/`echo $file | sed "s/Dummy/$2/"`;
+ done
+fi;