Class CNodeTokenRange#

Class Documentation#

class CNodeTokenRange#

Node token range used to regenerate the source from the node entries.

A node can have several token ranges identifying code that belongs to the node or precedes or succeeds the node. The following ranges can be identified:

  • code before the node, not belonging to another node

  • code before the node with comments belonging to the node

  • the first part of the node

  • the in between part, which might contain other nodes (in case of an inline node collection)

  • the second part of the node finishing the node (in case of an inline node collection)

  • code behind the node with comments belonging to the node

  • code behind the node, not belonging to another node (this is the code until the end of the node list)

Public Functions

CNodeTokenRange(const CToken &rInitialToken)#

Initialize the range with the first initial token. Any token before that belong to the token range of the previous node.

Parameters:

rInitialToken[in] The initial token that defines/starts the range.

CNodeTokenRange(const CTokenRange &rrangeNodeMain)#

Construct a node range with the main node token range.

Parameters:

rrangeNodeMain[in] Reference to the token range holding the main node tokens.

void LinesBeforeNode(const CToken &rTokenBegin)#

Set the token identifying the area before the extended node. Will start before or at and end at the extended node range.

Remark

Setting the begin will not change the extended node range. If starting within the extended node range, the begin of the extended node range determines the begin of the lines before.

Parameters:

rTokenBegin[in] Reference to the token identifying the begin of the lines before the extended node range.

CTokenRange LinesBeforeNode() const#

Get the lines before range, being located before the extended node range.

Returns:

The token range with begin and end token of the lines before. If identical, there are no lines before.

void ExtendedNode(const CTokenRange &rRange)#

Set the token range identifying the extended node range. Will start before or at and end behind or at the main node ranges (incl. the finish range).

Remark

If the range starts or ends within the main node range, the extended node range is adapted to the main node range. If the lines before or behind the node fall within the extended node range, the lines will be adapted to the extended node range.

Parameters:

rRange[in] Token range holding the begin and end of the extended node range.

CTokenRange ExtendedNode() const#

Get the extended node range. The range includes the main node ranges (including the node finish range).

Returns:

The token range with begin and end token of the extended node range.

CTokenRange NodeCommentsBefore() const#

Get the node comments part before the node definition, which is the difference between the beginning of the extended node and the main node.

Returns:

The token range with begin and end token of the node comments range.

void NodeMain(const CTokenRange &rRange)#

Set the main node range.

Remark

If the main node finish range starts within or before the main node range, the main node finish range will be updated. If the extended node range does not include the main range completely (incl. finish node range), the extended node range will be updated.

Parameters:

rRange[in] Token range holding the begin and end of the main node range.

CTokenRange NodeMain() const#

Get the main node range.

Returns:

The token range with begin and end token of the main node range.

void NodeMainFinish(const CTokenRange &rRange)#

Set the main node finish range (for inline tables and arrays).

Remark

If the main node finish range starts within or before the main node range, the main node finish range will be updated. If the extended node range does not include the main range completely (incl. finish node range), the extended node range will be updated.

Parameters:

rRange[in] Token range holding the begin and end of the main node finish range.

CTokenRange NodeMainFinish() const#

Get the main node finish range.

Returns:

The token range with begin and end token of the main node finish range.

CTokenRange NodeCommentsBehind() const#

Get the node comments part behind the node definition, which is the difference between the end of the main node and the end of the extended node.

Returns:

The token range with begin and end token of the node comments range.

void LinesBehindNode(const CToken &rTokenEnd)#

Set the token identifying the area behind the extended node. Will start at and end behind or at the extended node range.

Remark

Setting the end will not change the extended node range. If ending within the extended node range, the end of the extended node range determines the end of the lines before.

Parameters:

rTokenEnd[in] Reference to the token identifying the end of the lines behind the extended node range.

CTokenRange LinesBehindNode() const#

Get the lines behind range, being located behind the extended node range.

Returns:

The token range with begin and end token of the lines behind. If identical, there are no lines behind.