mirror of
https://github.com/geometer/FBReaderJ.git
synced 2025-10-03 17:59:33 +02:00
FBReaderSpecialEntry => ExtensionEntry
This commit is contained in:
parent
53745b25d7
commit
6d2ab76f50
10 changed files with 27 additions and 27 deletions
|
@ -247,9 +247,9 @@ void BookReader::addVideoEntry(const ZLVideoEntry &entry) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void BookReader::addFBReaderSpecialEntry(const std::string &action, const std::map<std::string,std::string> &data) {
|
void BookReader::addExtensionEntry(const std::string &action, const std::map<std::string,std::string> &data) {
|
||||||
if (myCurrentTextModel != 0) {
|
if (myCurrentTextModel != 0) {
|
||||||
myCurrentTextModel->addFBReaderSpecialEntry(action, data);
|
myCurrentTextModel->addExtensionEntry(action, data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -74,7 +74,7 @@ public:
|
||||||
void addImage(const std::string &id, shared_ptr<const ZLImage> image);
|
void addImage(const std::string &id, shared_ptr<const ZLImage> image);
|
||||||
|
|
||||||
void addVideoEntry(const ZLVideoEntry &entry);
|
void addVideoEntry(const ZLVideoEntry &entry);
|
||||||
void addFBReaderSpecialEntry(const std::string &action, const std::map<std::string,std::string> &data);
|
void addExtensionEntry(const std::string &action, const std::map<std::string,std::string> &data);
|
||||||
|
|
||||||
void beginContentsParagraph(int referenceNumber = -1);
|
void beginContentsParagraph(int referenceNumber = -1);
|
||||||
void endContentsParagraph();
|
void endContentsParagraph();
|
||||||
|
|
|
@ -543,7 +543,7 @@ void XHTMLTagPreAction::doAtEnd(XHTMLReader &reader) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void XHTMLTagOpdsAction::doAtStart(XHTMLReader &reader, const char **xmlattributes) {
|
void XHTMLTagOpdsAction::doAtStart(XHTMLReader &reader, const char **xmlattributes) {
|
||||||
bookReader(reader).addFBReaderSpecialEntry("opds", reader.attributeMap(xmlattributes));
|
bookReader(reader).addExtensionEntry("opds", reader.attributeMap(xmlattributes));
|
||||||
}
|
}
|
||||||
|
|
||||||
void XHTMLTagOpdsAction::doAtEnd(XHTMLReader &reader) {
|
void XHTMLTagOpdsAction::doAtEnd(XHTMLReader &reader) {
|
||||||
|
|
|
@ -385,7 +385,7 @@ void ZLTextModel::addVideoEntry(const ZLVideoEntry &entry) {
|
||||||
++myParagraphLengths.back();
|
++myParagraphLengths.back();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ZLTextModel::addFBReaderSpecialEntry(const std::string &action, const std::map<std::string,std::string> &data) {
|
void ZLTextModel::addExtensionEntry(const std::string &action, const std::map<std::string,std::string> &data) {
|
||||||
std::size_t fullLength = 2; // entry type + map size
|
std::size_t fullLength = 2; // entry type + map size
|
||||||
fullLength += 2 + ZLUnicodeUtil::utf8Length(action) * 2; // action name
|
fullLength += 2 + ZLUnicodeUtil::utf8Length(action) * 2; // action name
|
||||||
for (std::map<std::string,std::string>::const_iterator it = data.begin(); it != data.end(); ++it) {
|
for (std::map<std::string,std::string>::const_iterator it = data.begin(); it != data.end(); ++it) {
|
||||||
|
@ -394,7 +394,7 @@ void ZLTextModel::addFBReaderSpecialEntry(const std::string &action, const std::
|
||||||
}
|
}
|
||||||
|
|
||||||
myLastEntryStart = myAllocator->allocate(fullLength);
|
myLastEntryStart = myAllocator->allocate(fullLength);
|
||||||
*myLastEntryStart = ZLTextParagraphEntry::FBREADER_SPECIAL;
|
*myLastEntryStart = ZLTextParagraphEntry::EXTENSION_ENTRY;
|
||||||
*(myLastEntryStart + 1) = data.size();
|
*(myLastEntryStart + 1) = data.size();
|
||||||
|
|
||||||
char *p = myLastEntryStart + 2;
|
char *p = myLastEntryStart + 2;
|
||||||
|
|
|
@ -78,7 +78,7 @@ public:
|
||||||
void addFixedHSpace(unsigned char length);
|
void addFixedHSpace(unsigned char length);
|
||||||
void addBidiReset();
|
void addBidiReset();
|
||||||
void addVideoEntry(const ZLVideoEntry &entry);
|
void addVideoEntry(const ZLVideoEntry &entry);
|
||||||
void addFBReaderSpecialEntry(const std::string &action, const std::map<std::string,std::string> &data);
|
void addExtensionEntry(const std::string &action, const std::map<std::string,std::string> &data);
|
||||||
|
|
||||||
void flush();
|
void flush();
|
||||||
|
|
||||||
|
|
|
@ -48,7 +48,7 @@ public:
|
||||||
RESET_BIDI_ENTRY = 9,
|
RESET_BIDI_ENTRY = 9,
|
||||||
AUDIO_ENTRY = 10,
|
AUDIO_ENTRY = 10,
|
||||||
VIDEO_ENTRY = 11,
|
VIDEO_ENTRY = 11,
|
||||||
FBREADER_SPECIAL = 12,
|
EXTENSION_ENTRY = 12,
|
||||||
};
|
};
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
@ -154,10 +154,10 @@ private:
|
||||||
ResetBidiEntry();
|
ResetBidiEntry();
|
||||||
};
|
};
|
||||||
|
|
||||||
class FBReaderSpecialEntry : public ZLTextParagraphEntry {
|
class ExtensionEntry : public ZLTextParagraphEntry {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
~FBReaderSpecialEntry();
|
~ExtensionEntry();
|
||||||
const std::string &action() const;
|
const std::string &action() const;
|
||||||
const std::string &data() const;
|
const std::string &data() const;
|
||||||
|
|
||||||
|
@ -269,9 +269,9 @@ inline short ImageEntry::vOffset() const { return myVOffset; }
|
||||||
|
|
||||||
inline ResetBidiEntry::ResetBidiEntry() {}
|
inline ResetBidiEntry::ResetBidiEntry() {}
|
||||||
|
|
||||||
inline FBReaderSpecialEntry::~FBReaderSpecialEntry() {}
|
inline ExtensionEntry::~ExtensionEntry() {}
|
||||||
inline const std::string &FBReaderSpecialEntry::action() const { return myAction; }
|
inline const std::string &ExtensionEntry::action() const { return myAction; }
|
||||||
inline const std::string &FBReaderSpecialEntry::data() const { return myData; }
|
inline const std::string &ExtensionEntry::data() const { return myData; }
|
||||||
|
|
||||||
inline ZLTextParagraph::ZLTextParagraph() : myEntryNumber(0) {}
|
inline ZLTextParagraph::ZLTextParagraph() : myEntryNumber(0) {}
|
||||||
inline ZLTextParagraph::~ZLTextParagraph() {}
|
inline ZLTextParagraph::~ZLTextParagraph() {}
|
||||||
|
|
|
@ -21,11 +21,11 @@ package org.geometerplus.zlibrary.text.model;
|
||||||
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
public class FBReaderSpecialEntry {
|
public class ExtensionEntry {
|
||||||
public final String Type;
|
public final String Type;
|
||||||
public final Map<String,String> Data;
|
public final Map<String,String> Data;
|
||||||
|
|
||||||
FBReaderSpecialEntry(String type, Map<String,String> data) {
|
ExtensionEntry(String type, Map<String,String> data) {
|
||||||
Type = type;
|
Type = type;
|
||||||
Data = data;
|
Data = data;
|
||||||
}
|
}
|
||||||
|
@ -35,10 +35,10 @@ public class FBReaderSpecialEntry {
|
||||||
if (this == other) {
|
if (this == other) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (!(other instanceof FBReaderSpecialEntry)) {
|
if (!(other instanceof ExtensionEntry)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
final FBReaderSpecialEntry entry = (FBReaderSpecialEntry)other;
|
final ExtensionEntry entry = (ExtensionEntry)other;
|
||||||
return Type.equals(entry.Type) && Data.equals(entry.Data);
|
return Type.equals(entry.Type) && Data.equals(entry.Data);
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,7 +32,7 @@ public interface ZLTextParagraph {
|
||||||
byte RESET_BIDI = 9;
|
byte RESET_BIDI = 9;
|
||||||
byte AUDIO = 10;
|
byte AUDIO = 10;
|
||||||
byte VIDEO = 11;
|
byte VIDEO = 11;
|
||||||
byte FBREADER_SPECIAL = 12;
|
byte EXTENSION = 12;
|
||||||
}
|
}
|
||||||
|
|
||||||
interface EntryIterator {
|
interface EntryIterator {
|
||||||
|
@ -50,7 +50,7 @@ public interface ZLTextParagraph {
|
||||||
|
|
||||||
ZLImageEntry getImageEntry();
|
ZLImageEntry getImageEntry();
|
||||||
ZLVideoEntry getVideoEntry();
|
ZLVideoEntry getVideoEntry();
|
||||||
FBReaderSpecialEntry getFBReaderSpecialEntry();
|
ExtensionEntry getExtensionEntry();
|
||||||
ZLTextStyleEntry getStyleEntry();
|
ZLTextStyleEntry getStyleEntry();
|
||||||
|
|
||||||
short getFixedHSpaceLength();
|
short getFixedHSpaceLength();
|
||||||
|
|
|
@ -70,8 +70,8 @@ public class ZLTextPlainModel implements ZLTextModel, ZLTextStyleEntry.Feature {
|
||||||
// VideoEntry
|
// VideoEntry
|
||||||
private ZLVideoEntry myVideoEntry;
|
private ZLVideoEntry myVideoEntry;
|
||||||
|
|
||||||
// FBReaderSpecialEntry
|
// ExtensionEntry
|
||||||
private FBReaderSpecialEntry myFBReaderSpecialEntry;
|
private ExtensionEntry myExtensionEntry;
|
||||||
|
|
||||||
// StyleEntry
|
// StyleEntry
|
||||||
private ZLTextStyleEntry myStyleEntry;
|
private ZLTextStyleEntry myStyleEntry;
|
||||||
|
@ -125,8 +125,8 @@ public class ZLTextPlainModel implements ZLTextModel, ZLTextStyleEntry.Feature {
|
||||||
return myVideoEntry;
|
return myVideoEntry;
|
||||||
}
|
}
|
||||||
|
|
||||||
public FBReaderSpecialEntry getFBReaderSpecialEntry() {
|
public ExtensionEntry getExtensionEntry() {
|
||||||
return myFBReaderSpecialEntry;
|
return myExtensionEntry;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ZLTextStyleEntry getStyleEntry() {
|
public ZLTextStyleEntry getStyleEntry() {
|
||||||
|
@ -272,7 +272,7 @@ public class ZLTextPlainModel implements ZLTextModel, ZLTextStyleEntry.Feature {
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case ZLTextParagraph.Entry.FBREADER_SPECIAL:
|
case ZLTextParagraph.Entry.EXTENSION:
|
||||||
{
|
{
|
||||||
final short kindLength = (short)data[dataOffset++];
|
final short kindLength = (short)data[dataOffset++];
|
||||||
final String kind = new String(data, dataOffset, kindLength);
|
final String kind = new String(data, dataOffset, kindLength);
|
||||||
|
@ -288,7 +288,7 @@ public class ZLTextPlainModel implements ZLTextModel, ZLTextStyleEntry.Feature {
|
||||||
map.put(key, new String(data, dataOffset, valueLength));
|
map.put(key, new String(data, dataOffset, valueLength));
|
||||||
dataOffset += valueLength;
|
dataOffset += valueLength;
|
||||||
}
|
}
|
||||||
myFBReaderSpecialEntry = new FBReaderSpecialEntry(kind, map);
|
myExtensionEntry = new ExtensionEntry(kind, map);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -108,9 +108,9 @@ public final class ZLTextParagraphCursor {
|
||||||
case ZLTextParagraph.Entry.VIDEO:
|
case ZLTextParagraph.Entry.VIDEO:
|
||||||
elements.add(new ZLTextVideoElement(it.getVideoEntry().sources()));
|
elements.add(new ZLTextVideoElement(it.getVideoEntry().sources()));
|
||||||
break;
|
break;
|
||||||
case ZLTextParagraph.Entry.FBREADER_SPECIAL:
|
case ZLTextParagraph.Entry.EXTENSION:
|
||||||
{
|
{
|
||||||
final FBReaderSpecialEntry entry = it.getFBReaderSpecialEntry();
|
final ExtensionEntry entry = it.getExtensionEntry();
|
||||||
if ("opds".equals(entry.Type)) {
|
if ("opds".equals(entry.Type)) {
|
||||||
elements.addAll(myView.Holder.getElements(entry.Data));
|
elements.addAll(myView.Holder.getElements(entry.Data));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue