1
0
Fork 0
mirror of https://github.com/geometer/FBReaderJ.git synced 2025-10-05 10:49:24 +02:00

introduces BuiltinFormatPlugin class

This commit is contained in:
Nikolay Pultsin 2014-07-01 20:37:16 +01:00
parent d9322b2ff3
commit 226a72178d
6 changed files with 35 additions and 11 deletions

View file

@ -26,6 +26,7 @@ import org.geometerplus.zlibrary.core.fonts.*;
import org.geometerplus.zlibrary.text.model.*;
import org.geometerplus.fbreader.book.Book;
import org.geometerplus.fbreader.formats.BuiltinFormatPlugin;
import org.geometerplus.fbreader.formats.FormatPlugin;
public abstract class BookModel {
@ -48,7 +49,7 @@ public abstract class BookModel {
);
}
plugin.readModel(model);
((BuiltinFormatPlugin)plugin).readModel(model);
return model;
}

View file

@ -0,0 +1,31 @@
/*
* Copyright (C) 2007-2014 Geometer Plus <contact@geometerplus.com>
*
* 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.
*/
package org.geometerplus.fbreader.formats;
import org.geometerplus.fbreader.bookmodel.BookModel;
import org.geometerplus.fbreader.bookmodel.BookReadingException;
public abstract class BuiltinFormatPlugin extends FormatPlugin {
protected BuiltinFormatPlugin(String fileType) {
super(fileType);
}
public abstract void readModel(BookModel model) throws BookReadingException;
}

View file

@ -28,7 +28,6 @@ import org.geometerplus.zlibrary.core.filesystem.ZLFile;
import org.geometerplus.zlibrary.core.image.ZLImage;
import org.geometerplus.fbreader.book.Book;
import org.geometerplus.fbreader.bookmodel.BookModel;
import org.geometerplus.fbreader.bookmodel.BookReadingException;
public abstract class FormatPlugin {
@ -50,7 +49,6 @@ public abstract class FormatPlugin {
}
public abstract void readMetainfo(Book book) throws BookReadingException;
public abstract void readUids(Book book) throws BookReadingException;
public abstract void readModel(BookModel model) throws BookReadingException;
public abstract void detectLanguageAndEncoding(Book book) throws BookReadingException;
public abstract ZLImage readCover(ZLFile file);
public abstract String readAnnotation(ZLFile file);

View file

@ -19,7 +19,7 @@
package org.geometerplus.fbreader.formats;
public abstract class JavaFormatPlugin extends FormatPlugin {
public abstract class JavaFormatPlugin extends BuiltinFormatPlugin {
protected JavaFormatPlugin(String fileType) {
super(fileType);
}

View file

@ -35,7 +35,7 @@ import org.geometerplus.fbreader.bookmodel.BookReadingException;
import org.geometerplus.fbreader.formats.fb2.FB2NativePlugin;
import org.geometerplus.fbreader.formats.oeb.OEBNativePlugin;
public class NativeFormatPlugin extends FormatPlugin {
public class NativeFormatPlugin extends BuiltinFormatPlugin {
public static NativeFormatPlugin create(String fileType) {
if ("fb2".equals(fileType)) {
return new FB2NativePlugin();

View file

@ -24,7 +24,6 @@ import org.geometerplus.zlibrary.core.filesystem.ZLFile;
import org.geometerplus.fbreader.book.Book;
import org.geometerplus.fbreader.book.BookUtil;
import org.geometerplus.fbreader.bookmodel.BookModel;
import org.geometerplus.fbreader.formats.FormatPlugin;
public abstract class ExternalFormatPlugin extends FormatPlugin {
@ -37,11 +36,6 @@ public abstract class ExternalFormatPlugin extends FormatPlugin {
return Type.EXTERNAL;
}
@Override
public void readModel(BookModel model) {
// TODO
}
@Override
public PluginImage readCover(ZLFile file) {
return new PluginImage(file);