Pegmatite
Public Member Functions | List of all members
pegmatite::StringInput Class Reference

A concrete Input subclass that wraps a std::string, providing access to the underlying characters. More...

#include <parser.hh>

Inheritance diagram for pegmatite::StringInput:
pegmatite::Input

Public Member Functions

const std::string & getString ()
 Returns an immutable reference to the vector. More...
 
 StringInput (std::string &&s, const std::string &name="")
 Constructs the wrapper from a string (s). More...
 
 StringInput (const std::string &s, const std::string &name="")
 Constructs the wrapper from a string (s). More...
 
bool fillBuffer (Index start, Index &length, char32_t *&b) override
 Provides direct access to the underlying string's storage.
 
Index size () const override
 Returns the size of the string.
 
- Public Member Functions inherited from pegmatite::Input
iterator begin ()
 Returns an iterator for the start of the input.
 
iterator end ()
 Returns an iterator for the end of the input.
 
const std::string & name () const
 Returns a user-meaningful name (typically a filename).
 
char32_t operator[] (Index n)
 Fetch the character at the specified index. More...
 
 Input (const std::string &name)
 Default constructor, sets the buffer start to be after the buffer end, so that the first request will trigger a fetch from the underlying storage. More...
 

Additional Inherited Members

- Public Types inherited from pegmatite::Input
typedef size_t Index
 The type of indexes into the buffer.
 
- Static Public Attributes inherited from pegmatite::Input
static const Index npos = static_cast<Index>(-1)
 
- Protected Member Functions inherited from pegmatite::Input
virtual ~Input ()
 Virtual destructor.
 
 Input (const Input &)
 Copy constructor.
 
- Static Protected Attributes inherited from pegmatite::Input
static const std::size_t static_buffer_size = 512
 Size for the static buffer. More...
 

Detailed Description

A concrete Input subclass that wraps a std::string, providing access to the underlying characters.

Constructor & Destructor Documentation

pegmatite::StringInput::StringInput ( std::string &&  s,
const std::string &  name = "" 
)
inline

Constructs the wrapper from a string (s).

The new object takes ownership of the character data in the string.

pegmatite::StringInput::StringInput ( const std::string &  s,
const std::string &  name = "" 
)
inline

Constructs the wrapper from a string (s).

The new object is copy-constructed from the string argument.

Member Function Documentation

const std::string& pegmatite::StringInput::getString ( )
inline

Returns an immutable reference to the vector.

The returned value is guaranteed to remain valid and not be modified for as long as the input object exists.


The documentation for this class was generated from the following file: