matador::string_cursor Class Reference

#include <string_cursor.hpp>

Public Member Functions

 string_cursor (const char *str)
 
string_cursoroperator= (const char *str)
 
char operator[] (int i) const
 
bool is_null () const
 
const char * operator() () const
 
void sync_cursor (const char *cursor)
 
char skip_whitespace ()
 
char next_char ()
 
char current_char () const
 

Detailed Description

A simple cursor class to traverse forward through a character array.

Constructor & Destructor Documentation

◆ string_cursor()

matador::string_cursor::string_cursor ( const char *  str)
explicit

Initializes the cursor with the given string

Parameters
strString to initialize the cursor with

Member Function Documentation

◆ current_char()

char matador::string_cursor::current_char ( ) const

Returns the current character of the string

Returns
The current character

◆ is_null()

bool matador::string_cursor::is_null ( ) const
inline

Checks if the current cursor is a nullptr

Returns
True if current cursor position is nullptr

◆ next_char()

char matador::string_cursor::next_char ( )

Increments cursor position and returns this character.

Returns
Next character in string

◆ operator()()

const char * matador::string_cursor::operator() ( ) const
inline

Returns the current cursor

Returns
The current cursor

◆ operator=()

string_cursor & matador::string_cursor::operator= ( const char *  str)

Assign a string to the cursor class

Parameters
strString to assign
Returns
The assigned cursor

◆ operator[]()

char matador::string_cursor::operator[] ( int  i) const
inline

Gets the character at position i

Parameters
iRequested character position
Returns
The requested character

◆ skip_whitespace()

char matador::string_cursor::skip_whitespace ( )

Skips whitespace for the cursor and returns the first character not a whitespace

Returns
First character not a whitespace

◆ sync_cursor()

void matador::string_cursor::sync_cursor ( const char *  cursor)
inline

Syncs the cursor with the new given cursor

Parameters
cursorNew cursor

The documentation for this class was generated from the following file:
  • matador/utils/string_cursor.hpp