Rudiments
csvdom.h
1// Copyright (c) 1999-2018 David Muse
2// See the COPYING file for more information.
3
4#ifndef RUDIMENTS_CSVDOM_H
5#define RUDIMENTS_CSVDOM_H
6
7#include <rudiments/private/csvdomincludes.h>
8
53class RUDIMENTS_DLLSPEC csvdom : public csvsax, public dom {
54 public:
55
58
75 csvdom(bool stringcacheenabled);
76
78 virtual ~csvdom();
79
81 virtual const char *getType();
82
84 bool parse(input *in);
85
87 bool parseFile(const char *filename);
88
90 bool parseString(const char *string);
91
95
97 uint64_t getColumnCount();
98
101 const char *getColumnName(uint64_t position);
102
106 bool getColumnPosition(const char *name, uint64_t *position);
107
110 bool upperCaseColumn(uint64_t position);
111
114 bool upperCaseColumn(const char *name);
115
118
121 bool lowerCaseColumn(uint64_t position);
122
125 bool lowerCaseColumn(const char *name);
126
129
132 bool rightTrimColumn(uint64_t position);
133
136 bool rightTrimColumn(const char *name);
137
140
143 bool leftTrimColumn(uint64_t position);
144
147 bool leftTrimColumn(const char *name);
148
151
155 bool bothTrimColumn(uint64_t position);
156
160 bool bothTrimColumn(const char *name);
161
164
169 bool renameColumn(uint64_t position,
170 const char *name, bool quoted);
171
176 bool renameColumn(const char *oldname,
177 const char *newname, bool quoted);
178
184 bool renameColumn(const char * const *oldnames,
185 const char *newname, bool quoted);
186
191 bool renameAllColumns(const char *oldname,
192 const char *newname, bool quoted);
193
199 bool renameAllColumns(const char * const *oldnames,
200 const char *newname, bool quoted);
201
207 bool insertColumnBefore(uint64_t position,
208 const char *name, bool quoted);
209
216 bool insertColumnBefore(const char *name,
217 const char *newname, bool quoted);
218
224 bool insertColumnAfter(uint64_t position,
225 const char *name, bool quoted);
226
233 bool insertColumnAfter(const char *name,
234 const char *newname, bool quoted);
235
240 bool moveColumn(uint64_t oldposition, uint64_t newposition);
241
246 bool moveColumn(const char *name, uint64_t position);
247
250 bool deleteColumn(uint64_t position);
251
254 bool deleteColumn(const char *name);
255
258 bool getColumnIsEmpty(uint64_t position);
259
262 bool getColumnIsEmpty(const char *name);
263
267
269 uint64_t getRecordCount();
270
272 domnode *getRecord(uint64_t position);
273
276 const char *getField(uint64_t record, uint64_t column);
277
280 const char *getField(uint64_t record, const char *column);
281
285 bool setField(uint64_t record, uint64_t column,
286 const char *value, bool quoted);
287
291 bool setField(uint64_t record, const char *column,
292 const char *value, bool quoted);
293
296 bool rightTrimField(uint64_t record, uint64_t column);
297
300 bool rightTrimField(uint64_t record, const char *column);
301
304 bool leftTrimField(uint64_t record, uint64_t column);
305
308 bool leftTrimField(uint64_t record, const char *column);
309
313 bool bothTrimField(uint64_t record, uint64_t column);
314
318 bool bothTrimField(uint64_t record, const char *column);
319
322
325
328
331 bool insertRecordBefore(uint64_t position);
332
335 bool insertRecordAfter(uint64_t position);
336
341 bool moveRecord(uint64_t oldposition, uint64_t newposition);
342
345 bool deleteRecord(uint64_t position);
346
349 bool getRecordIsEmpty(uint64_t position);
350
354
359 void carryValueDown(uint64_t position);
360
365 void carryValueDown(const char *name);
366
371
372 protected:
373
375 virtual bool headerStart();
376
378 virtual bool column(const char *name, bool quoted);
379
381 virtual bool headerEnd();
382
384 virtual bool bodyStart();
385
387 virtual bool recordStart();
388
390 virtual bool field(const char *value, bool quoted);
391
393 virtual bool recordEnd();
394
396 virtual bool bodyEnd();
397
398 #include <rudiments/private/csvdom.h>
399};
400
401#endif
Definition csvdom.h:53
bool moveColumn(uint64_t oldposition, uint64_t newposition)
bool rightTrimField(uint64_t record, uint64_t column)
virtual bool recordStart()
bool rightTrimColumn(const char *name)
bool getColumnIsEmpty(const char *name)
domnode * getRecord(uint64_t position)
bool deleteRecord(uint64_t position)
bool getColumnPosition(const char *name, uint64_t *position)
void leftTrimFields()
bool upperCaseColumns()
bool getColumnIsEmpty(uint64_t position)
void createRootNode()
const char * getField(uint64_t record, uint64_t column)
void carryValueDown(const char *name)
void bothTrimFields()
bool bothTrimColumns()
bool rightTrimColumns()
bool bothTrimField(uint64_t record, uint64_t column)
bool parseFile(const char *filename)
bool deleteEmptyRecords()
bool leftTrimField(uint64_t record, uint64_t column)
bool insertColumnBefore(uint64_t position, const char *name, bool quoted)
bool insertColumnAfter(uint64_t position, const char *name, bool quoted)
virtual bool bodyStart()
virtual bool column(const char *name, bool quoted)
bool moveRecord(uint64_t oldposition, uint64_t newposition)
const char * getField(uint64_t record, const char *column)
bool leftTrimField(uint64_t record, const char *column)
uint64_t getRecordCount()
bool renameColumn(uint64_t position, const char *name, bool quoted)
virtual bool bodyEnd()
void rightTrimFields()
bool lowerCaseColumn(uint64_t position)
bool bothTrimColumn(uint64_t position)
bool insertColumnBefore(const char *name, const char *newname, bool quoted)
bool renameAllColumns(const char *oldname, const char *newname, bool quoted)
bool leftTrimColumn(const char *name)
virtual bool headerEnd()
bool insertRecordAfter(uint64_t position)
bool lowerCaseColumn(const char *name)
bool leftTrimColumn(uint64_t position)
bool setField(uint64_t record, uint64_t column, const char *value, bool quoted)
const char * getColumnName(uint64_t position)
virtual bool headerStart()
bool upperCaseColumn(const char *name)
bool renameColumn(const char *oldname, const char *newname, bool quoted)
void carryValueDown(uint64_t position)
csvdom(bool stringcacheenabled)
bool getRecordIsEmpty(uint64_t position)
virtual bool field(const char *value, bool quoted)
bool setField(uint64_t record, const char *column, const char *value, bool quoted)
bool moveColumn(const char *name, uint64_t position)
void carryAllValuesDown()
uint64_t getColumnCount()
bool lowerCaseColumns()
bool renameColumn(const char *const *oldnames, const char *newname, bool quoted)
bool bothTrimColumn(const char *name)
bool deleteColumn(uint64_t position)
bool renameAllColumns(const char *const *oldnames, const char *newname, bool quoted)
bool deleteEmptyColumns()
virtual bool recordEnd()
bool upperCaseColumn(uint64_t position)
bool parse(input *in)
bool rightTrimField(uint64_t record, const char *column)
bool bothTrimField(uint64_t record, const char *column)
bool deleteColumn(const char *name)
bool insertColumnAfter(const char *name, const char *newname, bool quoted)
virtual ~csvdom()
bool leftTrimColumns()
bool parseString(const char *string)
bool rightTrimColumn(uint64_t position)
virtual const char * getType()
bool insertRecordBefore(uint64_t position)
Definition csvsax.h:12
Definition dom.h:10
Definition domnode.h:122
Definition input.h:11