Xpace
indexparser.h
Go to the documentation of this file.
1 /**************************************************************
2  **
3  ** @file index/indexparser.h
4  **
5  ** Copyright (C) 2016 Xpace, LLC. All rights reserved
6  **
7  ** www.xpace.net
8  **
9  **************************************************************/
10 
11 #if !defined XPACE_INDEXPARSER_H
12 #define XPACE_INDEXPARSER_H
13 
14 #include "unicode/rbbi.h"
15 
16 namespace Xpace
17 {
18 
19 class LoadIndex;
20 struct loadIndexPools;
21 
22 class Parser_Error : public Exception
23 {
24 public:
25  /// @param desc a description
27  (const String& desc);
28 };
29 
30 class LoadIndexParser : public LoadIndex
31 {
32  public :
33  Index::Impl* clone
34  ()
35  const
36  {
37  assert(0);
38  return 0;
39  }
40 
42  (std::unique_ptr<LoadIndex>&,
43  const Configuration&,
44  loadIndexPools*);
45 
46  virtual ~LoadIndexParser
47  ();
48 
49  uint64 getTermCount
50  ()
51  const
52  {
53  return master->getTermCount();
54  };
55 
56  // ---------------------------- Sink --------------------
57 
58  virtual int64 start
59  (uint64) override
60  {
61  return 0;
62  }
63 
64  virtual bool set
65  (uint64 ref,
66  int64 value) override
67  {
68  return master->set(ref, value);
69  }
70 
71  virtual bool set
72  (uint64 ref,
73  const DecimalFloat& value) override
74  {
75  return master->set(ref, value);
76  }
77 
78  virtual bool set
79  (uint64 ref,
80  const String8& value) override;
81 
82  virtual bool set
83  (uint64 ref,
84  const String16& value) override
85  {
86  return master->set(ref, value);
87  }
88 
89  virtual bool set
90  (uint64 ref,
91  const BytesRef& value) override
92  {
93  return master->set(ref, value);
94  }
95 
96  virtual bool set
97  (uint64 ref,
98  Date value) override
99  {
100  return master->set(ref, value);
101  }
102 
103  virtual bool set
104  (uint64 ref,
105  Time value) override
106  {
107  return master->set(ref, value);
108  }
109 
110  // ------------------------------ iters -------------------
111  // (stubs, since this is an input-only filter)
112 
113  virtual Index::Iter::Impl* begin
114  ()
115  const override
116  {
117  return NULL;
118  }
119 
120  virtual Index::Iter::Impl* begin
121  (const String& str,
122  bool*)
123  const override
124  {
125  return NULL;
126  }
127 
128  virtual Index::Iter::Impl* begin
129  (int64 val,
130  bool*)
131  const override
132  {
133  return NULL;
134  }
135 
136  virtual Index::Iter::Impl* begin
137  (const DecimalFloat& str,
138  bool*)
139  const override
140  {
141  return NULL;
142  }
143 
144  virtual Index::Iter::Impl* begin
145  (const BytesRef& str,
146  bool*)
147  const override
148  {
149  return NULL;
150  }
151 
152  virtual Index::Iter::Impl* beginAdd
153  (const String& str,
154  bool* added = 0)
155  {
156  return NULL;
157  }
158 
159  virtual Index::Iter::Impl* end
160  ()
161  const
162  {
163  return NULL;
164  }
165 
166  virtual bool regexOK
167  ()
168  const
169  {
170  return master->regexOK();
171  }
172 
173  virtual String next
174  (const String& key)
175  const
176  {
177  return master->next(key);
178  }
179 
180  virtual std::unique_ptr<Comparator> getComparator
181  ()
182  const override
183  {
184  return master->getComparator();
185  }
186 
187  // ------------------------------ write -------------------
188 
189  // return 0 if index is empty
190  // return File::ErrorPosition if interrupted
191  virtual File::Position write
192  (File* f,
194  {
195  return master->write(f, s);
196  }
197 
198  virtual File::Position writeTemp
199  (File* f,
201  {
202  return master->writeTemp(f, s);
203  }
204 
205  private:
206  std::unique_ptr<LoadIndex> master;
207  std::unique_ptr<icu::RuleBasedBreakIterator> wIter;
208  UText* utext;
209 };
210 
211 }
212 
213 #endif
214 
Each high-level Xpace object has a Configuration.
Definition: config.h:29
const Xpace_Char16 Xpace_Data_Type uint bool * added
Definition: table_c.h:141
A string, Unicode UTF-16 and reference-counted.
Definition: types.h:269
A low-level const data holder.
Definition: types.h:165
A floatimg-point number with explicit mantissa and decimals TODO: normalize.
Definition: decimalfloat.h:33
unsigned long long uint64
Definition: types.h:87
uint64 Position
Definition: file.h:40
uint int64 value
Definition: table_c.h:159
write this index; could take a while status callback
Definition: index.h:97
long long int64
Definition: types.h:86
Xpace project main namespace
Definition: datetime.h:18
Parser_Error(const String &desc)

current as of Wed Jun 10 2026 12:00:05