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:
parent
d9322b2ff3
commit
226a72178d
6 changed files with 35 additions and 11 deletions
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue