/usr/include/lttoolbox-3.3/lttoolbox/expander.h is in lttoolbox-dev 3.3.3~r68466-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 | /*
* Copyright (C) 2005 Universitat d'Alacant / Universidad de Alicante
*
* 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, see <http://www.gnu.org/licenses/>.
*/
#ifndef _EXPANDER_
#define _EXPANDER_
#include <lttoolbox/ltstr.h>
#include <list>
#include <map>
#include <libxml/xmlreader.h>
#include <string>
using namespace std;
typedef list<pair<wstring, wstring> > EntList;
/**
* An expander of dictionaries
*/
class Expander
{
private:
/**
* The libxml2's XML reader
*/
xmlTextReaderPtr reader;
/**
* The alt value
*/
wstring alt;
/**
* The variant value (monodix)
*/
wstring variant;
/**
* The variant value (left side of bidix)
*/
wstring variant_left;
/**
* The variant value (right side of bidix)
*/
wstring variant_right;
/**
* The paradigm being compiled
*/
wstring current_paradigm;
/**
* The direction of the compilation, 'lr' (left-to-right) or 'rl'
* (right-to-left)
*/
wstring direction;
/**
* Paradigms
*/
map<wstring, EntList, Ltstr> paradigm;
map<wstring, EntList, Ltstr> paradigm_lr;
map<wstring, EntList, Ltstr> paradigm_rl;
/**
* Method to parse an XML Node
*/
void procNode(FILE *output);
/**
* Parse the <pardef> element
*/
void procParDef();
/**
* Parse the <e> element
*/
void procEntry(FILE *output);
/**
* Parse the <re> element
* @return the string representing the regular expression
*/
wstring procRegexp();
/**
* Gets an attribute value with their name and the current context
* @param name the name of the attribute
* @return the value of the attribute
*/
wstring attrib(wstring const &name);
/**
* Parse the <p< element
* @return a pair of string, left part and right part of a transduction
*/
pair<wstring, wstring> procTransduction();
/**
* Parse the <i< element
* @return a string from the dictionary's entry
*/
wstring procIdentity();
/**
* Parse the <par> element
* @return the name of the paradigm
*/
wstring procPar();
/**
* Skip all document #text nodes before "elem"
* @param name the name of the node
* @param elem the name of the expected node
*/
void skip(wstring &name, wstring const &elem);
/**
* Skip all blank #text nodes before "name"
* @param name the name of the node
*/
void skipBlanks(wstring &name);
void readString(wstring &result, wstring const &name);
/**
* Force an element to be empty, and check for it
* @param name the element
*/
void requireEmptyError(wstring const &name);
/**
* Force an attribute to be specified, amd check for it
* @param value the value of the attribute
* @param attrname the name of the attribute
* @param elemname the parent of the attribute
*/
void requireAttribute(wstring const &value, wstring const &attrname,
wstring const &elemname);
/**
* True if all the elements in the current node are blanks
* @return true if all are blanks
*/
bool allBlanks();
/**
* Append a list of endings to a list of current transductions.
* @param result the current partial transductions, and after calling
* this method, the result of concatenations.
* @param endings the endings to be appended.
*/
static void append(list<pair<wstring, wstring> > &result,
list<pair<wstring, wstring> > const &endings);
/**
* Append a list of endings to a list of current transductions.
* @param result the current partial transductions, and after calling
* this method, the result of concatenations.
* @param endings the endings to be appended.
*/
static void append(list<pair<wstring, wstring> > &result,
wstring const &endings);
/**
* Append a list of endings to a list of current transductions.
* @param result the current partial transductions, and after calling
* this method, the result of concatenations.
* @param endings the endings to be appended.
*/
static void append(list<pair<wstring, wstring> > &result,
pair<wstring, wstring> const &endings);
public:
/**
* Constructor
*/
Expander();
/**
* Destructor
*/
~Expander();
/**
* Compile dictionary to letter transducers
*/
void expand(string const &fichero, FILE *output);
/**
* Set the alt value to use in compilation
* @param a the value
*/
void setAltValue(string const &a);
/**
* Set the variant value to use in expansion
* @param v the value
*/
void setVariantValue(string const &v);
/**
* Set the variant_left value to use in expansion
* @param v the value
*/
void setVariantLeftValue(string const &v);
/**
* Set the variant_right value to use in expansion
* @param v the value
*/
void setVariantRightValue(string const &v);
};
#endif
|