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) {
|
||||
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 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 endContentsParagraph();
|
||||
|
|
|
@ -543,7 +543,7 @@ void XHTMLTagPreAction::doAtEnd(XHTMLReader &reader) {
|
|||
}
|
||||
|
||||
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) {
|
||||
|
|
|
@ -385,7 +385,7 @@ void ZLTextModel::addVideoEntry(const ZLVideoEntry &entry) {
|
|||
++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
|
||||
fullLength += 2 + ZLUnicodeUtil::utf8Length(action) * 2; // action name
|
||||
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 = ZLTextParagraphEntry::FBREADER_SPECIAL;
|
||||
*myLastEntryStart = ZLTextParagraphEntry::EXTENSION_ENTRY;
|
||||
*(myLastEntryStart + 1) = data.size();
|
||||
|
||||
char *p = myLastEntryStart + 2;
|
||||
|
|
|
@ -78,7 +78,7 @@ public:
|
|||
void addFixedHSpace(unsigned char length);
|
||||
void addBidiReset();
|
||||
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();
|
||||
|
||||
|
|
|
@ -48,7 +48,7 @@ public:
|
|||
RESET_BIDI_ENTRY = 9,
|
||||
AUDIO_ENTRY = 10,
|
||||
VIDEO_ENTRY = 11,
|
||||
FBREADER_SPECIAL = 12,
|
||||
EXTENSION_ENTRY = 12,
|
||||
};
|
||||
|
||||
protected:
|
||||
|
@ -154,10 +154,10 @@ private:
|
|||
ResetBidiEntry();
|
||||
};
|
||||
|
||||
class FBReaderSpecialEntry : public ZLTextParagraphEntry {
|
||||
class ExtensionEntry : public ZLTextParagraphEntry {
|
||||
|
||||
public:
|
||||
~FBReaderSpecialEntry();
|
||||
~ExtensionEntry();
|
||||
const std::string &action() const;
|
||||
const std::string &data() const;
|
||||
|
||||
|
@ -269,9 +269,9 @@ inline short ImageEntry::vOffset() const { return myVOffset; }
|
|||
|
||||
inline ResetBidiEntry::ResetBidiEntry() {}
|
||||
|
||||
inline FBReaderSpecialEntry::~FBReaderSpecialEntry() {}
|
||||
inline const std::string &FBReaderSpecialEntry::action() const { return myAction; }
|
||||
inline const std::string &FBReaderSpecialEntry::data() const { return myData; }
|
||||
inline ExtensionEntry::~ExtensionEntry() {}
|
||||
inline const std::string &ExtensionEntry::action() const { return myAction; }
|
||||
inline const std::string &ExtensionEntry::data() const { return myData; }
|
||||
|
||||
inline ZLTextParagraph::ZLTextParagraph() : myEntryNumber(0) {}
|
||||
inline ZLTextParagraph::~ZLTextParagraph() {}
|
||||
|
|
|
@ -21,11 +21,11 @@ package org.geometerplus.zlibrary.text.model;
|
|||
|
||||
import java.util.Map;
|
||||
|
||||
public class FBReaderSpecialEntry {
|
||||
public class ExtensionEntry {
|
||||
public final String Type;
|
||||
public final Map<String,String> Data;
|
||||
|
||||
FBReaderSpecialEntry(String type, Map<String,String> data) {
|
||||
ExtensionEntry(String type, Map<String,String> data) {
|
||||
Type = type;
|
||||
Data = data;
|
||||
}
|
||||
|
@ -35,10 +35,10 @@ public class FBReaderSpecialEntry {
|
|||
if (this == other) {
|
||||
return true;
|
||||
}
|
||||
if (!(other instanceof FBReaderSpecialEntry)) {
|
||||
if (!(other instanceof ExtensionEntry)) {
|
||||
return false;
|
||||
}
|
||||
final FBReaderSpecialEntry entry = (FBReaderSpecialEntry)other;
|
||||
final ExtensionEntry entry = (ExtensionEntry)other;
|
||||
return Type.equals(entry.Type) && Data.equals(entry.Data);
|
||||
}
|
||||
|
|
@ -32,7 +32,7 @@ public interface ZLTextParagraph {
|
|||
byte RESET_BIDI = 9;
|
||||
byte AUDIO = 10;
|
||||
byte VIDEO = 11;
|
||||
byte FBREADER_SPECIAL = 12;
|
||||
byte EXTENSION = 12;
|
||||
}
|
||||
|
||||
interface EntryIterator {
|
||||
|
@ -50,7 +50,7 @@ public interface ZLTextParagraph {
|
|||
|
||||
ZLImageEntry getImageEntry();
|
||||
ZLVideoEntry getVideoEntry();
|
||||
FBReaderSpecialEntry getFBReaderSpecialEntry();
|
||||
ExtensionEntry getExtensionEntry();
|
||||
ZLTextStyleEntry getStyleEntry();
|
||||
|
||||
short getFixedHSpaceLength();
|
||||
|
|
|
@ -70,8 +70,8 @@ public class ZLTextPlainModel implements ZLTextModel, ZLTextStyleEntry.Feature {
|
|||
// VideoEntry
|
||||
private ZLVideoEntry myVideoEntry;
|
||||
|
||||
// FBReaderSpecialEntry
|
||||
private FBReaderSpecialEntry myFBReaderSpecialEntry;
|
||||
// ExtensionEntry
|
||||
private ExtensionEntry myExtensionEntry;
|
||||
|
||||
// StyleEntry
|
||||
private ZLTextStyleEntry myStyleEntry;
|
||||
|
@ -125,8 +125,8 @@ public class ZLTextPlainModel implements ZLTextModel, ZLTextStyleEntry.Feature {
|
|||
return myVideoEntry;
|
||||
}
|
||||
|
||||
public FBReaderSpecialEntry getFBReaderSpecialEntry() {
|
||||
return myFBReaderSpecialEntry;
|
||||
public ExtensionEntry getExtensionEntry() {
|
||||
return myExtensionEntry;
|
||||
}
|
||||
|
||||
public ZLTextStyleEntry getStyleEntry() {
|
||||
|
@ -272,7 +272,7 @@ public class ZLTextPlainModel implements ZLTextModel, ZLTextStyleEntry.Feature {
|
|||
}
|
||||
break;
|
||||
}
|
||||
case ZLTextParagraph.Entry.FBREADER_SPECIAL:
|
||||
case ZLTextParagraph.Entry.EXTENSION:
|
||||
{
|
||||
final short kindLength = (short)data[dataOffset++];
|
||||
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));
|
||||
dataOffset += valueLength;
|
||||
}
|
||||
myFBReaderSpecialEntry = new FBReaderSpecialEntry(kind, map);
|
||||
myExtensionEntry = new ExtensionEntry(kind, map);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -108,9 +108,9 @@ public final class ZLTextParagraphCursor {
|
|||
case ZLTextParagraph.Entry.VIDEO:
|
||||
elements.add(new ZLTextVideoElement(it.getVideoEntry().sources()));
|
||||
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)) {
|
||||
elements.addAll(myView.Holder.getElements(entry.Data));
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue