29 #ifndef SfiDelimitedRecordSTD_INCLUDED
30 #define SfiDelimitedRecordSTD_INCLUDED
113 if (size == 0 || i < 0 || i >= size)
156 bool insideQuotes =
false;
157 for (i = 0; i < n; i++)
161 insideQuotes = !insideQuotes;
178 const char*
get(
int i)
const
181 if (size == 0 || i < 0 || i >= size)
197 bool insideQuotes =
false;
198 for (i = 0, n =
m_buffer.length(); i < n; i++)
202 insideQuotes = !insideQuotes;
int offset(int n) const
Returns the offset of the n-th field (zero-based) in the original string or -1 if there is no such fi...
void clear()
Clears the record.
SfiVectorLite< int > m_offsets
A record consisting of string fields separated by a delimiter.
int split()
Returns the number of fields in the record. Delimiters inside double quotes are ignored.
void reserve(size_t size)
Resizes the underlying vector, but does not change the perceived size.
void setDelimiter(char delim)
Sets the delimiter character and re-splits the string.
string m_buffer
Buffer with a modified string for fast retrieval.
SfiDelimitedRecordSTD & operator=(const char *str)
Sets the record to a new string (makes a copy).
SfiDelimitedRecordSTD(const SfiDelimitedRecordSTD &rec)
const char * operator[](int i) const
Returns a pointer to the i-th field or an empty string if there are fewer than i fields.
int size() const
Returns the number of fields in the record.
SfiDelimitedRecordSTD & operator=(const SfiDelimitedRecordSTD &rec)
Copies all data from rec.
int length(int n) const
Returns the length of the n-th field (zero-based) or -1 if there is no such field.
SfiVectorLite< int > m_lengths
int size() const
Returns the size of the vector.
void clear()
Sets the number of elements to zero without releasing the memory. Use pack() to also release the memo...
void push_back(const T &t)
Appends t to the end of the vector.
SfiDelimitedRecordSTD(const char *str=0, char delimiter= ',')
int split(char *buf, int n)
Splits the buf in-place, overwriting delimiters with null characters.