Overview

The RoseInputString class is a subclass of RoseInputStream used to feed parsing code with in-memory string data. It works through the string data pointed to by a char* and allows push back characters, even if the original string is in read-only memory.

RoseInputString stream;
stream.name("memory");
stream.data("this is my string to parse");

while ((c=stream.get()) != EOF)
{
    // process the characters
}

ctor()

RoseInputString();
RoseInputString(
	const char * s
	);

The RoseInputString() constructor has two versions. The default contructor leaves the data field unset, while the second one initializes it with a call to data().

Both contructors leave the name() field unset.

data()

void data(const char * s);

The data() function sets the string data processed by the stream. The stream does not immediately copy the memory so the string should remain valid until the stream is finished traversing it.

refill()

virtual size_t refill();

The refill() function simply copies at most io_size() characters from the data() string to the I/0 buffer. It returns the number of characters copied.

This is called automatically by get() when it reaches the end of the buffer. This is a virtual function that is overridden by each stream subtype.