StringPosition Class Reference 系统

#include <string.h>

Inheritance diagram for StringPosition:

详细描述

Class to store the position in a string for a string operation. StringPosition just consists of an integer value. If it is positive, it indicates the absolute position. If it is negative it indicates the position from the end, e.g. -1 refers to the last character.

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

res = str.GetPart(4, 3); // copy from position 4 on 3 characters
res = str.GetPart(-4, 3); // copy from the position that is 4 characters from the end of the string on 3 characters

公共成员函数

MAXON_IMPLICIT   StringPosition ( Int pos)
MAXON_ATTRIBUTE_FORCE_INLINE Int   ResolvePosition ( Int length) const

Protected Attributes

Int   _value

Friends

class  StringCount

构造函数 & 析构函数文档编制

◆  StringPosition()

MAXON_IMPLICIT StringPosition ( Int   pos )

Constructor.

参数
[in] pos If pos is >= 0 it designates the absolute position. If pos is negative it relative to the end. E.g. -1 refers to the last character.

成员函数文档编制

◆  ResolvePosition()

MAXON_ATTRIBUTE_FORCE_INLINE Int ResolvePosition ( Int   length ) const

Calculates the absolute position in a string based on the contents of this class and a given string length.

参数
[in] length The length of the string.
返回
The absolute position in the string.

Friends And Related Function Documentation

◆  StringCount

friend class StringCount
friend

Member Data Documentation

◆  _value

Int _value
protected