StringCount Class Reference

#include <string.h>

Detailed Description

Class to store the character count for a string operation. StringCount allows you to specify a character count for operations like Insert or GetPart. However it also allows you to specify a StringPosition instead (implicitly defining the count).

Here an example for GetPart. The first parameter of GetPart is the class StringPosition, the second StringCount.

res = str.GetPart(2, 3); // copy from position 2 on three characters
res = str.GetPart(2, StringPosition(3)); // copy from position 2 to position 3 (two characters)

Public Member Functions

MAXON_IMPLICIT StringCount (Int count)
 
MAXON_IMPLICIT StringCount (StringPosition pos)
 
MAXON_ATTRIBUTE_FORCE_INLINE Int ResolvePosition (Int startPos, Int length) const
 
MAXON_ATTRIBUTE_FORCE_INLINE Int ResolveCount (Int startPos, Int length) const
 

Private Attributes

Int _value
 

Static Private Attributes

static const Int STRING_COUNT_BIT
 

Constructor & Destructor Documentation

◆ StringCount() [1/2]

Constructor.

Parameters
[in]countThe number of characters.

◆ StringCount() [2/2]

Constructor from a StringPosition.

Parameters
[in]posThe string position from the beginning or the end.

Member Function Documentation

◆ ResolvePosition()

MAXON_ATTRIBUTE_FORCE_INLINE Int ResolvePosition ( Int  startPos,
Int  length 
) const

Calculates the end position of a range based on a given start position and a string length.

Parameters
[in]startPosThe starting position of the range.
[in]lengthThe length of the string.
Returns
The end position of the range.

◆ ResolveCount()

MAXON_ATTRIBUTE_FORCE_INLINE Int ResolveCount ( Int  startPos,
Int  length 
) const

Calculates the character count of a range based on a given start position and a string length.

Parameters
[in]startPosThe starting position of the range.
[in]lengthThe length of the string.
Returns
The character count.

Member Data Documentation

◆ STRING_COUNT_BIT

const Int STRING_COUNT_BIT
staticprivate

◆ _value

Int _value
private