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
10 class RUDIMENTS_DLLSPEC csvdom : public csvsax, public dom {
11 public:
12
14 csvdom();
15
32 csvdom(bool stringcacheenabled);
33
35 virtual ~csvdom();
36
38 bool parseFile(const char *filename);
39
41 bool parseString(const char *string);
42
45 void createRootNode();
46
48 uint64_t getColumnCount();
49
52 const char *getColumnName(uint64_t position);
53
57 bool getColumnPosition(const char *name, uint64_t *position);
58
61 bool upperCaseColumn(uint64_t position);
62
65 bool upperCaseColumn(const char *name);
66
68 bool upperCaseColumns();
69
72 bool lowerCaseColumn(uint64_t position);
73
76 bool lowerCaseColumn(const char *name);
77
79 bool lowerCaseColumns();
80
83 bool rightTrimColumn(uint64_t position);
84
87 bool rightTrimColumn(const char *name);
88
90 bool rightTrimColumns();
91
94 bool leftTrimColumn(uint64_t position);
95
98 bool leftTrimColumn(const char *name);
99
101 bool leftTrimColumns();
102
106 bool bothTrimColumn(uint64_t position);
107
111 bool bothTrimColumn(const char *name);
112
114 bool bothTrimColumns();
115
120 bool renameColumn(uint64_t position,
121 const char *name, bool quoted);
122
127 bool renameColumn(const char *oldname,
128 const char *newname, bool quoted);
129
135 bool renameColumn(const char * const *oldnames,
136 const char *newname, bool quoted);
137
142 bool renameAllColumns(const char *oldname,
143 const char *newname, bool quoted);
144
150 bool renameAllColumns(const char * const *oldnames,
151 const char *newname, bool quoted);
152
158 bool insertColumnBefore(uint64_t position,
159 const char *name, bool quoted);
160
167 bool insertColumnBefore(const char *name,
168 const char *newname, bool quoted);
169
175 bool insertColumnAfter(uint64_t position,
176 const char *name, bool quoted);
177
184 bool insertColumnAfter(const char *name,
185 const char *newname, bool quoted);
186
191 bool moveColumn(uint64_t oldposition, uint64_t newposition);
192
197 bool moveColumn(const char *name, uint64_t position);
198
201 bool deleteColumn(uint64_t position);
202
205 bool deleteColumn(const char *name);
206
209 bool getColumnIsEmpty(uint64_t position);
210
213 bool getColumnIsEmpty(const char *name);
214
217 bool deleteEmptyColumns();
218
220 uint64_t getRowCount();
221
223 domnode *getRow(uint64_t position);
224
227 const char *getField(uint64_t row, uint64_t column);
228
231 const char *getField(uint64_t row, const char *column);
232
236 bool setField(uint64_t row, uint64_t column,
237 const char *value, bool quoted);
238
242 bool setField(uint64_t row, const char *column,
243 const char *value, bool quoted);
244
247 bool rightTrimField(uint64_t row, uint64_t column);
248
251 bool rightTrimField(uint64_t row, const char *column);
252
255 bool leftTrimField(uint64_t row, uint64_t column);
256
259 bool leftTrimField(uint64_t row, const char *column);
260
264 bool bothTrimField(uint64_t row, uint64_t column);
265
269 bool bothTrimField(uint64_t row, const char *column);
270
272 void rightTrimFields();
273
275 void leftTrimFields();
276
278 void bothTrimFields();
279
282 bool insertRowBefore(uint64_t position);
283
286 bool insertRowAfter(uint64_t position);
287
292 bool moveRow(uint64_t oldposition, uint64_t newposition);
293
296 bool deleteRow(uint64_t position);
297
300 bool getRowIsEmpty(uint64_t position);
301
304 bool deleteEmptyRows();
305
310 void carryValueDown(uint64_t position);
311
316 void carryValueDown(const char *name);
317
321 void carryAllValuesDown();
322
328 bool write(output *out, bool indent) const;
329
330 protected:
331
333 virtual bool headerStart();
334
336 virtual bool column(const char *name, bool quoted);
337
339 virtual bool headerEnd();
340
342 virtual bool bodyStart();
343
345 virtual bool rowStart();
346
348 virtual bool field(const char *value, bool quoted);
349
351 virtual bool rowEnd();
352
354 virtual bool bodyEnd();
355
356 #include <rudiments/private/csvdom.h>
357 };
358
359 #endif
csvdom
Definition: csvdom.h:10
csvdom::write
bool write(output *out, bool indent) const
csvdom::getRowIsEmpty
bool getRowIsEmpty(uint64_t position)
csvdom::moveColumn
bool moveColumn(uint64_t oldposition, uint64_t newposition)
csvdom::getRowCount
uint64_t getRowCount()
csvdom::rightTrimColumn
bool rightTrimColumn(const char *name)
csvdom::getColumnIsEmpty
bool getColumnIsEmpty(const char *name)
csvdom::getColumnPosition
bool getColumnPosition(const char *name, uint64_t *position)
csvdom::insertRowAfter
bool insertRowAfter(uint64_t position)
csvdom::leftTrimFields
void leftTrimFields()
csvdom::deleteEmptyRows
bool deleteEmptyRows()
csvdom::rightTrimField
bool rightTrimField(uint64_t row, uint64_t column)
csvdom::deleteRow
bool deleteRow(uint64_t position)
csvdom::upperCaseColumns
bool upperCaseColumns()
csvdom::getColumnIsEmpty
bool getColumnIsEmpty(uint64_t position)
csvdom::setField
bool setField(uint64_t row, uint64_t column, const char *value, bool quoted)
csvdom::createRootNode
void createRootNode()
csvdom::leftTrimField
bool leftTrimField(uint64_t row, const char *column)
csvdom::carryValueDown
void carryValueDown(const char *name)
csvdom::bothTrimFields
void bothTrimFields()
csvdom::getField
const char * getField(uint64_t row, const char *column)
csvdom::bothTrimColumns
bool bothTrimColumns()
csvdom::rightTrimColumns
bool rightTrimColumns()
csvdom::parseFile
bool parseFile(const char *filename)
csvdom::leftTrimField
bool leftTrimField(uint64_t row, uint64_t column)
csvdom::insertColumnBefore
bool insertColumnBefore(uint64_t position, const char *name, bool quoted)
csvdom::insertColumnAfter
bool insertColumnAfter(uint64_t position, const char *name, bool quoted)
csvdom::bodyStart
virtual bool bodyStart()
csvdom::column
virtual bool column(const char *name, bool quoted)
csvdom::rowStart
virtual bool rowStart()
csvdom::getColumnName
const char * getColumnName(uint64_t position)
csvdom::renameColumn
bool renameColumn(uint64_t position, const char *name, bool quoted)
csvdom::rowEnd
virtual bool rowEnd()
csvdom::bodyEnd
virtual bool bodyEnd()
csvdom::getField
const char * getField(uint64_t row, uint64_t column)
csvdom::rightTrimFields
void rightTrimFields()
csvdom::lowerCaseColumn
bool lowerCaseColumn(uint64_t position)
csvdom::bothTrimColumn
bool bothTrimColumn(uint64_t position)
csvdom::insertColumnBefore
bool insertColumnBefore(const char *name, const char *newname, bool quoted)
csvdom::renameAllColumns
bool renameAllColumns(const char *oldname, const char *newname, bool quoted)
csvdom::leftTrimColumn
bool leftTrimColumn(const char *name)
csvdom::headerEnd
virtual bool headerEnd()
csvdom::getRow
domnode * getRow(uint64_t position)
csvdom::lowerCaseColumn
bool lowerCaseColumn(const char *name)
csvdom::leftTrimColumn
bool leftTrimColumn(uint64_t position)
csvdom::headerStart
virtual bool headerStart()
csvdom::upperCaseColumn
bool upperCaseColumn(const char *name)
csvdom::bothTrimField
bool bothTrimField(uint64_t row, const char *column)
csvdom::renameColumn
bool renameColumn(const char *oldname, const char *newname, bool quoted)
csvdom::carryValueDown
void carryValueDown(uint64_t position)
csvdom::insertRowBefore
bool insertRowBefore(uint64_t position)
csvdom::csvdom
csvdom(bool stringcacheenabled)
csvdom::field
virtual bool field(const char *value, bool quoted)
csvdom::rightTrimField
bool rightTrimField(uint64_t row, const char *column)
csvdom::moveColumn
bool moveColumn(const char *name, uint64_t position)
csvdom::carryAllValuesDown
void carryAllValuesDown()
csvdom::bothTrimField
bool bothTrimField(uint64_t row, uint64_t column)
csvdom::getColumnCount
uint64_t getColumnCount()
csvdom::lowerCaseColumns
bool lowerCaseColumns()
csvdom::renameColumn
bool renameColumn(const char *const *oldnames, const char *newname, bool quoted)
csvdom::bothTrimColumn
bool bothTrimColumn(const char *name)
csvdom::deleteColumn
bool deleteColumn(uint64_t position)
csvdom::renameAllColumns
bool renameAllColumns(const char *const *oldnames, const char *newname, bool quoted)
csvdom::deleteEmptyColumns
bool deleteEmptyColumns()
csvdom::upperCaseColumn
bool upperCaseColumn(uint64_t position)
csvdom::setField
bool setField(uint64_t row, const char *column, const char *value, bool quoted)
csvdom::deleteColumn
bool deleteColumn(const char *name)
csvdom::insertColumnAfter
bool insertColumnAfter(const char *name, const char *newname, bool quoted)
csvdom::csvdom
csvdom()
csvdom::moveRow
bool moveRow(uint64_t oldposition, uint64_t newposition)
csvdom::~csvdom
virtual ~csvdom()
csvdom::leftTrimColumns
bool leftTrimColumns()
csvdom::parseString
bool parseString(const char *string)
csvdom::rightTrimColumn
bool rightTrimColumn(uint64_t position)
csvsax
Definition: csvsax.h:12
dom
Definition: dom.h:10
domnode
Definition: domnode.h:122
output
Definition: output.h:9