Fragment

class ReflectExport(reflect) Fragment

A Fragment is the most basic string type in the reflect string suite.

It consists of a pointer and a length.  It does not own its data.  It can and should provide any const std::string functions we need that do not require a NUL terminator.

Summary
FragmentA Fragment is the most basic string type in the reflect string suite.
Functions
FragmentConstructs a piece string from a character pointer to NUL terminated data.
find_first_ofFinds any of a set of characters in the string.
rfindFinds a string in the string, in reverse.
rfindFinds a string in the string, in reverse.
find_last_ofFinds a character in the string, in reverse.
find_last_ofFinds any of a set of characters in the string, in reverse.
substrMakes a substr fragment from this one.
empty
compare

Functions

Fragment

Fragment(const char *s)

Constructs a piece string from a character pointer to NUL terminated data. length is found by strlen() @param s the string to make into a piece string.

find_first_of

size_type find_first_of(const Fragment &,  
size_type pos =  0) const

Finds any of a set of characters in the string.

Parameters

sthe set of characters to search for
posthe position to start from

Returns

index of s in string or npos if not found.

rfind

size_type rfind(const char *s,  
size_type pos =  npos,
size_type length =  npos) const

Finds a string in the string, in reverse.

Parameters

sthe string to search for
posthe position to start from

Returns

index of the begining of s in string or npos if not found.

rfind

size_type rfind(const Fragment &s,  
size_type pos =  npos) const

Finds a string in the string, in reverse.

Parameters

sthe string to search for
posthe position to start from

Returns

index of the begining of s in string or npos if not found.

find_last_of

size_type find_last_of(char ch,  
size_type pos =  npos) const

Finds a character in the string, in reverse.

Parameters

chthe character to search for
posthe position to start from

Returns

index of the last character in string matching ch or npos if not found.

find_last_of

size_type find_last_of(const Fragment &s,  
size_type pos =  npos) const

Finds any of a set of characters in the string, in reverse.

Parameters

sthe set of characters to search for
posthe position to start from

Returns

index of the last character in string contained in s or npos if not found.

substr

Fragment substr(size_type index,  
size_type amount =  npos) const

Makes a substr fragment from this one.  The substr’s storage is the same as the fragment’s storage.

Parameters

indexthe begining of the substring
amountthe maximum length of the substring

Returns

  • a Fragment substring

empty

bool empty() const

compare

int compare(const Fragment &other) const

Returns

(+1, 0, or -1)if the string is (greater, equal, or less) than the other string.
class ReflectExport(reflect) Fragment
A Fragment is the most basic string type in the reflect string suite.
Fragment(const char *s)
Constructs a piece string from a character pointer to NUL terminated data.
size_type find_first_of(const Fragment &,  
size_type pos =  0) const
Finds any of a set of characters in the string.
size_type rfind(const char *s,  
size_type pos =  npos,
size_type length =  npos) const
Finds a string in the string, in reverse.
size_type find_last_of(char ch,  
size_type pos =  npos) const
Finds a character in the string, in reverse.
Fragment substr(size_type index,  
size_type amount =  npos) const
Makes a substr fragment from this one.
bool empty() const
int compare(const Fragment &other) const
Close