#include <OTC/text/record.hh> class OTC_Record {
public:
static os_typespec* get_os_typespec();
OTC_Record(OTC_String const& theString);
OTC_Record(OTC_String const& theString, char theFS);
OTC_Record(OTC_String const& theString, OTC_String const& theFS);
OTC_Record(OTC_Record const& theRecord);
OTC_Record& operator=(OTC_Record const& theRecord);
inline u_int numFields() const;
OTC_String const& field(u_int theIndex) const;
inline OTC_String const& operator[](u_int theIndex) const;
inline OTC_Iterator<OTC_String> fields( OTC_Direction theDirection=OTCLIB_FORWARD ) const;
};
0
. The individual
fields once the string has been split are accessable from field
1
upwards.
OTC_Record(OTC_String const& theString);
theString
using whitespace as
the field separator, ie. in the style
of AWK. Note that leading and trailing
whitespace are ignored.
OTC_Record(OTC_String const& theString, char theFS);
theString
using theFS
as the
field separator. Note that this is done in
the style of AWK, ie. multiple instances
of theFS
together are not bunched
together as one field separator. If this
behaviour is required then use the
constructor taking the field separator as
a string. Also, leading and trailing
instances
of the field separator are not discarded.
If theFS
is empty then an exception is
generated.
OTC_Record(OTC_String const& theString, OTC_String const& theFS);
theString
using any of the
characters in theFS
as the field
separator, ie. in the style of
strtok(3)
. Note: that if multiple
instances of field separator characters
are found together then they are
interpreted as one field separator.
Leading and trailing instances of the
field separator are discarded.
If theFS
is 0
then an exception is
generated.
OTC_Record(OTC_Record const& theRecord);
theRecord
to this class.
OTC_Record& operator=(OTC_Record const& theRecord);
theRecord
to this class.
inline u_int numFields() const;
OTC_String const& field(u_int theIndex) const;
theIndex
.
Attempting to access a field which doesn't
exist will result in an exception.
inline OTC_String const& operator[](u_int theIndex) const;
theIndex
.
inline OTC_Iterator<OTC_String> fields(
OTC_Direction theDirection=OTCLIB_FORWARD
) const;
theDirection
, being
set to either OTCLIB_FORWARD
or
OTCLIB_BACKWARD
.