The SWORD Project  1.9.0.svnversion
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
GBFPlain Class Reference

#include <gbfplain.h>

+ Inheritance diagram for GBFPlain:
+ Collaboration diagram for GBFPlain:

Public Member Functions

 GBFPlain ()
 
virtual const char * getHeader () const
 
virtual char processText (SWBuf &text, const SWKey *key=0, const SWModule *module=0)
 

Detailed Description

This filter converts GBF text to plain text

Definition at line 32 of file gbfplain.h.

Constructor & Destructor Documentation

SWORD_NAMESPACE_START GBFPlain::GBFPlain ( )

Definition at line 32 of file gbfplain.cpp.

32  {
33 }

Member Function Documentation

virtual const char* SWFilter::getHeader ( ) const
inlinevirtualinherited

This method can supply a header associated with the processing done with this filter. A typical example is a suggested CSS style block for classed containers.

Reimplemented in OSISLaTeX, OSISXHTML, ThMLLaTeX, ThMLXHTML, TEIXHTML, GBFLaTeX, and GBFXHTML.

Definition at line 62 of file swfilter.h.

62 { return ""; }
char GBFPlain::processText ( SWBuf text,
const SWKey key = 0,
const SWModule module = 0 
)
virtual

This method processes and appropriately modifies the text given it for a particular filter task

Parameters
textThe text to be filtered/converted
keyCurrent key That was used.
moduleCurrent module.
Returns
0

Implements SWFilter.

Definition at line 36 of file gbfplain.cpp.

37 {
38  char token[2048];
39  int tokpos = 0;
40  bool intoken = false;
41  SWBuf orig = text;
42  const char* from = orig.c_str();
43 
44  for (text = ""; *from; ++from) {
45  if (*from == '<') {
46  intoken = true;
47  tokpos = 0;
48  token[0] = 0;
49  token[1] = 0;
50  token[2] = 0;
51  continue;
52  }
53  if (*from == '>') {
54  intoken = false;
55  // process desired tokens
56  switch (*token) {
57  case 'W': // Strongs
58  switch(token[1]) {
59  case 'G': // Greek
60  case 'H': // Hebrew
61  case 'T': // Tense
62  text.append(" <");
63  //for (char *tok = token + 2; *tok; tok++)
64  // text += *tok;
65  text.append(token+2);
66  text.append("> ");
67  continue;
68  }
69  break;
70  case 'R':
71  switch(token[1]) {
72  case 'F': // footnote begin
73  text.append(" [");
74  continue;
75  case 'f': // footnote end
76  text.append("] ");
77  continue;
78  }
79  break;
80  case 'C':
81  switch(token[1]) {
82  case 'A': // ASCII value
83  text.append((char)atoi(&token[2]));
84  continue;
85  case 'G':
86  text.append('>');
87  continue;
88 /* Bug in WEB
89  case 'L':
90  *to++ = '<';
91  continue;
92 */
93  case 'L': // Bug in WEB. Use above entry when fixed
94  case 'N': // new line
95  text.append('\n');
96  continue;
97  case 'M': // new paragraph
98  text.append("\n\n");
99  continue;
100  }
101  break;
102  }
103  continue;
104  }
105  if (intoken) {
106  if (tokpos < 2045) {
107  token[tokpos++] = *from;
108  // TODO: why is this + 2 ?
109  token[tokpos+2] = 0;
110  }
111  }
112  else text.append(*from);
113  }
114  return 0;
115 }
Definition: swbuf.h:47
const char * c_str() const
Definition: swbuf.h:158
SWBuf & append(const char *str, long max=-1)
Definition: swbuf.h:274

The documentation for this class was generated from the following files: