Class CTokenRange#

Class Documentation#

class CTokenRange#

The token range is used to identify the initial and the final token belonging to a collection. All intermediate tokens are then part of the collection.

Public Functions

CTokenRange() = delete#

The default constructor is deleted.

CTokenRange(const CToken &rTokenBegin)#

Start a token range using the begin token.

Remark

The end token is automatically set to one token beyond the last token in the list. This can be changed by assigning the end token.

Parameters:

rTokenBegin[in] Reference to the first token in this range.

CTokenRange(const CToken &rTokenBegin, const CToken &rTokenEnd)#

Directly assign a token range.

Remark

If the begin token and the end token are identical, the range doesn’t contain any tokens.

Parameters:
  • rTokenBegin[in] Reference to the first token in this range.

  • rTokenEnd[in] Reference to one token beyond the last token in this range.

void ReassignBeginToken(const CToken &rTokenBegin)#

Reassign the first token in the range. This will set the end token to the one beyond the last token in the list.

Parameters:

rTokenBegin[in] Reference to the first token in this range.

void ReassignTokenRange(const CToken &rTokenBegin, const CToken &rTokenEnd)#

Reassign the token range.

Remark

If the begin token and the end token are identical, the range doesn’t contain any tokens.

Parameters:
  • rTokenBegin[in] Reference to the first token in the range.

  • rTokenEnd[in] Reference to one token beyond the last token in the range.

void AssignEndToken(const CToken &rTokenEnd, bool bIncludeEnd = true)#

Assign or overwrite an end token.

Parameters:
  • rTokenEnd[in] Reference to the last token in this range.

  • bIncludeEnd[in] When set, the token belongs to the range; if not, the token points past the last range token.

const CToken &Begin() const#

Get the initial token in the range.

Returns:

Reference to the smart pointer containing the first token in this range.

const CToken &End() const#

Get one token beyond the final token in the range.

Remark

The end token can be one token beyond the last token in the list. This token will return ‘false’ when tested and can be used for navigation.

Returns:

Reference to the smart pointer containing one token beyond the final token in this range.

std::list<CToken> TokenListSLice() const#

Create a copy of the token list part identified by the start and end token (not including the end token).

Returns:

The token list containing the slice.

operator bool() const#

Does the token range contain a valid range of at least one token.

Returns:

Returns whether the token range is valid.