45 enum {
FMT_UNKNOWN = 0,
FMT_PLAIN,
FMT_THML,
FMT_GBF,
FMT_HTML,
FMT_HTMLHREF,
FMT_RTF,
FMT_OSIS,
FMT_WEBIF,
FMT_TEI,
FMT_XHTML,
FMT_LATEX};
54 #define SWMODULE_OPERATORS \
55 operator SWBuf() { return renderText(); } \
56 operator SWKey &() { return *getKey(); } \
57 operator SWKey *() { return getKey(); } \
58 SWModule &operator <<(const char *inbuf) { setEntry(inbuf); return *this; } \
59 SWModule &operator <<(const SWKey *sourceKey) { linkEntry(sourceKey); return *this; } \
60 SWModule &operator -=(int steps) { decrement(steps); return *this; } \
61 SWModule &operator +=(int steps) { increment(steps); return *this; } \
62 SWModule &operator ++(int) { return *this += 1; } \
63 SWModule &operator --(int) { return *this -= 1; } \
64 SWModule &operator =(SW_POSITION p) { setPosition(p); return *this; } \
68 SWDEPRECATED operator const char *() { static SWBuf unsafeTmp = renderText(); return unsafeTmp.c_str(); }
74 typedef std::map < SWBuf, AttributeValue, std::less < SWBuf > >
AttributeList;
77 #define SWTextDirection char
78 #define SWTextEncoding char
79 #define SWTextMarkup char
160 static void prepText(
SWBuf &buf);
204 virtual char popError();
230 virtual const char *getConfigEntry(
const char *key)
const;
238 virtual SWBuf getBibliography(
unsigned char bibFormat =
BIB_BIBTEX)
const;
251 virtual char setKey(
const SWKey *ikey);
260 inline char setKeyText(
const char *keyText) { getKey()->setText(keyText);
return key->getError(); }
285 virtual SWKey *getKey()
const;
297 SWDEPRECATED const char *
KeyText(
const char *ikeytext = 0) {
if (ikeytext) setKey(ikeytext);
return *getKey(); }
309 virtual long getIndex()
const {
return entryIndex; }
310 virtual void setIndex(
long iindex) { entryIndex = iindex; }
324 virtual char display();
340 virtual void setDisplay(
SWDisplay * idisp);
351 const char *getName()
const;
369 const char *getDescription()
const;
387 const char *getType()
const;
401 SWDEPRECATED const char *
Type(
const char *imodtype) { setType(imodtype);
return getType(); }
407 virtual char getDirection()
const;
411 SWDEPRECATED char Direction(
signed char newdir = -1) {
char retVal = getDirection();
if (newdir != -1)
return direction = newdir;
return retVal; }
421 SWDEPRECATED char Encoding(
signed char enc = -1) {
char retVal = getEncoding();
if (enc != -1) encoding = enc;
return retVal; }
431 SWDEPRECATED char Markup(
signed char imarkup = -1) {
char retVal = getMarkup();
if (imarkup != -1) markup = imarkup;
return retVal; }
441 SWDEPRECATED const char *
Lang(
char *imodlang = 0) {
if (imodlang != 0)
stdstr(&modlang, imodlang);
return getLanguage(); }
467 virtual ListKey &
search(
const char *istr,
int searchType = 0,
int flags = 0,
469 bool *justCheckIfSupported = 0,
470 void (*percent) (
char,
void *) = &nullPercent,
471 void *percentUserData = 0);
478 SWDEPRECATED ListKey &
Search(
const char *istr,
int searchType = 0,
int flags = 0,
SWKey * scope = 0,
bool * justCheckIfSupported = 0,
void (*percent) (
char,
void *) = &nullPercent,
void *percentUserData = 0) {
return search(istr, searchType, flags, scope, justCheckIfSupported, percent, percentUserData); }
488 virtual SWKey *createKey()
const;
498 virtual SWBuf &getRawEntryBuf()
const = 0;
500 const char *
getRawEntry()
const {
return getRawEntryBuf().c_str(); }
512 static signed char createModule(
const char *path);
516 virtual void setEntry(
const char *inbuf,
long len= -1);
521 virtual void linkEntry(
const SWKey *sourceKey);
532 virtual void decrement(
int steps = 1);
537 virtual void increment(
int steps = 1);
565 renderFilters->push_back(newFilter);
578 return *renderFilters;
586 renderFilters->remove(oldFilter);
600 FilterList::iterator iter;
601 for (iter = renderFilters->begin(); iter != renderFilters->end(); iter++) {
602 if (*iter == oldFilter)
617 filterBuffer(renderFilters, buf, key);
628 encodingFilters->push_back(newFilter);
641 encodingFilters->remove(oldFilter);
655 FilterList::iterator iter;
656 for (iter = encodingFilters->begin(); iter != encodingFilters->end(); iter++) {
657 if (*iter == oldFilter)
672 filterBuffer(encodingFilters, buf, key);
682 stripFilters->push_back(newFilter);
695 rawFilters->push_back(newFilter);
708 filterBuffer(stripFilters, buf, key);
717 filterBuffer(rawFilters, buf, key);
728 optionFilters->push_back(newFilter);
743 filterBuffer(optionFilters, buf, key);
754 virtual const char *stripText(
const char *buf = 0,
int len = -1);
768 SWBuf renderText(
const char *buf,
int len = -1,
bool render =
true)
const;
773 SWDEPRECATED const char *
RenderText(
const char *buf = 0,
int len = -1,
bool render =
true) {
return renderText(buf, len, render); }
779 virtual const char *getRenderHeader()
const;
785 virtual const char *stripText(
const SWKey *tmpKey);
837 void (*percent) (
char,
void *) = &nullPercent,
838 void *percentUserData = 0);
SWDEPRECATED char SetKey(const SWKey &ikey)
const char * getLanguage() const
#define SWORD_NAMESPACE_START
virtual bool isUnicode() const
virtual void renderFilter(SWBuf &buf, const SWKey *key) const
virtual SWModule & addEncodingFilter(SWFilter *newFilter)
virtual void setIndex(long iindex)
virtual void rawFilter(SWBuf &buf, const SWKey *key) const
virtual void deleteSearchFramework()
virtual void deleteEntry()
virtual SWModule & addRenderFilter(SWFilter *newFilter)
virtual void optionFilter(SWBuf &buf, const SWKey *key) const
std::map< SWBuf, AttributeList, std::less< SWBuf > > AttributeTypeList
static StdOutDisplay rawdisp
FilterList * stripFilters
SWDEPRECATED const char * Lang(char *imodlang=0)
std::list< SWOptionFilter * > OptionFilterList
SWDEPRECATED bool getSkipConsecutiveLinks()
virtual ListKey & search(const char *istr, int searchType=0, int flags=0, SWKey *scope=0, bool *justCheckIfSupported=0, void(*percent)(char, void *)=&nullPercent, void *percentUserData=0)=0
SWDEPRECATED SWModule & RemoveEncodingFilter(SWFilter *oldFilter)
virtual int getEntrySize() const
virtual void setSkipConsecutiveLinks(bool val)
SWBuf renderText(const char *buf, int len=-1, bool render=true) const
virtual signed char createSearchFramework(void(*percent)(char, void *)=&nullPercent, void *percentUserData=0)
virtual void encodingFilter(SWBuf &buf, const SWKey *key) const
virtual SWModule & replaceEncodingFilter(SWFilter *oldFilter, SWFilter *newFilter)
virtual bool isLinked(const SWKey *, const SWKey *) const
SWDEPRECATED const char * Description(const char *imoddesc)
SWDEPRECATED SWModule & RemoveRenderFilter(SWFilter *oldFilter)
SWDEPRECATED const char * Type() const
SWDEPRECATED char Direction(signed char newdir=-1)
std::map< SWBuf, SWBuf, std::less< SWBuf > > AttributeValue
SWORD_NAMESPACE_START char * stdstr(char **ipstr, const char *istr, unsigned int memPadFactor=1)
static const signed int SEARCHTYPE_MULTIWORD
char setKey(const SWKey &ikey)
SWDEPRECATED const char * KeyText(const char *ikeytext=0)
SWDEPRECATED ListKey & Search(const char *istr, int searchType=0, int flags=0, SWKey *scope=0, bool *justCheckIfSupported=0, void(*percent)(char, void *)=&nullPercent, void *percentUserData=0)
SWDEPRECATED SWModule & ReplaceEncodingFilter(SWFilter *oldFilter, SWFilter *newFilter)
virtual long getIndex() const
virtual SWDEPRECATED char Error()
virtual bool hasSearchFramework()
SWDEPRECATED const char * RenderText(const char *buf=0, int len=-1, bool render=true)
virtual const FilterList & getRenderFilters() const
std::list< SWFilter * > FilterList
static const signed int SEARCHTYPE_REGEX
static const signed int SEARCHTYPE_EXTERNAL
virtual bool isWritable() const
bool skipConsecutiveLinks
AttributeTypeList entryAttributes
SWDEPRECATED char Key(const SWKey &ikey)
virtual const OptionFilterList & getOptionFilters() const
FilterList * renderFilters
SWDEPRECATED long Index(long iindex)
virtual SWModule & addOptionFilter(SWOptionFilter *newFilter)
virtual bool hasEntry(const SWKey *) const
virtual SWModule & removeRenderFilter(SWFilter *oldFilter)
SWDEPRECATED const char * Description() const
virtual SWModule & addRawFilter(SWFilter *newFilter)
FilterList * encodingFilters
virtual SWModule & addStripFilter(SWFilter *newFilter)
virtual bool isProcessEntryAttributes() const
virtual AttributeTypeList & getEntryAttributes() const
virtual void setProcessEntryAttributes(bool val) const
virtual const char * getKeyText() const
SWDEPRECATED long Index() const
SWDEPRECATED const char * Name() const
SWDEPRECATED const char * StripText(const char *buf=0, int len=-1)
SWDEPRECATED const char * Type(const char *imodtype)
#define SWMODULE_OPERATORS
SWORD_NAMESPACE_START typedef multimapwithdefault< SWBuf, SWBuf, std::less< SWBuf > > ConfigEntMap
SWDEPRECATED SWModule & AddEncodingFilter(SWFilter *newFilter)
char setKeyText(const char *keyText)
SWDEPRECATED char Display()
static const signed int SEARCHFLAG_MATCHWHOLEENTRY
SWDEPRECATED const char * Name(const char *imodname)
#define SWORD_NAMESPACE_END
OptionFilterList * optionFilters
SWDEPRECATED SWKey & Key() const
void setType(const char *imodtype)
const char * getRawEntry() const
virtual SWModule & removeEncodingFilter(SWFilter *oldFilter)
char display(SWModule &imodule)
std::map< SWBuf, AttributeValue, std::less< SWBuf > > AttributeList
SWDEPRECATED SWDisplay * Disp(SWDisplay *idisp=0)
SWDEPRECATED SWModule & AddOptionFilter(SWOptionFilter *newFilter)
SWDEPRECATED void processEntryAttributes(bool val) const
SWDEPRECATED char SetKey(const SWKey *ikey)
SWDEPRECATED SWKey * CreateKey() const
virtual bool isSkipConsecutiveLinks()
virtual void stripFilter(SWBuf &buf, const SWKey *key) const
SWDEPRECATED char Encoding(signed char enc=-1)
virtual const ConfigEntMap & getConfig() const
SWDEPRECATED SWModule & AddStripFilter(SWFilter *newFilter)
SWDEPRECATED SWModule & AddRawFilter(SWFilter *newFilter)
static const signed int SEARCHTYPE_PHRASE
SWDEPRECATED SWModule & ReplaceRenderFilter(SWFilter *oldFilter, SWFilter *newFilter)
SWDEPRECATED SWModule & AddRenderFilter(SWFilter *newFilter)
SWDEPRECATED char Markup(signed char imarkup=-1)
static const signed int SEARCHTYPE_ENTRYATTR
virtual SWModule & replaceRenderFilter(SWFilter *oldFilter, SWFilter *newFilter)
static const signed int SEARCHFLAG_STRICTBOUNDARIES