|
|
A G2++ record is a sequence of printable ASCII characters consisting of names and values with hierarchical relationships implied by tabs and newlines (see G2++(4C++) for a formal syntax definition with examples). Messages used for interprocess communication or records used for long-term data storage can both be structured as G2++ records.
This component provides two kinds of I/O routines for reading and writing G2++ records:
G2++ typed I/O routines - see typed_io(3C++) These routines are generated by the G2++ compiler, g2++comp(1C++). The compiler reads .g files containing G2++ record definitions. For each .g file, it produces a pair of files: a header file and a code file. The header file declares a type together with stream insertion and extraction operators for that type. By including the header file, clients can read G2++ records into program variables and write G2++ records from program variables, with type translation to and from ASCII handled automatically by the I/O routines.
G2++ untyped I/O routines - see untyped_io(3C++) These are library routines that can be used with arbitrary record types. They map between G2++ records and navigable syntax trees.
In addition, this component provides two auxiliary types used in conjunction with typed I/O:
class Vblock - see Vblock(3C++) If a G2++ record definition (see G2++(4C++) specifies an array, then the corresponding declaration generated by g2++comp(1C++) will contain a Vblock.
class G2Text - see G2Text(3C++) A user-defined type that can be "hooked in" to the typed I/O operations whenever Strings containing non-printable characters must be input or output.