MD::InternalStringT Class

template <typename String, typename Char, typename Latin1Char> class MD::InternalStringT

Internal string, used to get virgin (original) string from transformed string. More...

Header: #include <md4qt/traits.h>
CMake: find_package(md4qt REQUIRED COMPONENTS md4qt)
target_link_libraries(mytarget PRIVATE md4qt::md4qt)

Public Functions

String &asString()
const String &asString() const
const String &fullVirginString() const
MD::InternalStringT<String, Char, Latin1Char> &insert(long long pos, Char ch)
MD::InternalStringT<String, Char, Latin1Char> &insert(long long pos, const String &s)
bool isEmpty() const
long long length() const
MD::InternalStringT<String, Char, Latin1Char> &remove(long long pos, long long size)
MD::InternalStringT<String, Char, Latin1Char> &replace(const String &what, const String &with)
MD::InternalStringT<String, Char, Latin1Char> &replaceOne(long long pos, long long size, const String &with)
MD::InternalStringT<String, Char, Latin1Char> right(long long n) const
MD::InternalStringT<String, Char, Latin1Char> simplified() const
MD::InternalStringT<String, Char, Latin1Char> sliced(long long pos, long long len = -1) const
std::vector<MD::InternalStringT<String, Char, Latin1Char>> split(const MD::InternalStringT<String, Char, Latin1Char> &sep) const
long long virginPos(long long pos, bool end = false) const
String virginSubString(long long pos = 0, long long len = -1) const
Char operator[](long long position) const

Detailed Description

Member Function Documentation

String &InternalStringT::asString()

Returns reference to string.

const String &InternalStringT::asString() const

Returns reference to string.

const String &InternalStringT::fullVirginString() const

Returns full virgin string.

MD::InternalStringT<String, Char, Latin1Char> &InternalStringT::insert(long long pos, Char ch)

Insert one character.

pos Position.

ch Character.

MD::InternalStringT<String, Char, Latin1Char> &InternalStringT::insert(long long pos, const String &s)

Insert string.

pos Position.

s String.

bool InternalStringT::isEmpty() const

Returns whether this string empty?

long long InternalStringT::length() const

Returns length of the string.

MD::InternalStringT<String, Char, Latin1Char> &InternalStringT::remove(long long pos, long long size)

Remove sub-string.

pos Position.

size Length.

MD::InternalStringT<String, Char, Latin1Char> &InternalStringT::replace(const String &what, const String &with)

Replace string.

what What to replace.

with Value to insert.

MD::InternalStringT<String, Char, Latin1Char> &InternalStringT::replaceOne(long long pos, long long size, const String &with)

Replace substring.

pos Position.

size Length.

with Value to insert.

Returns a substring that contains the n rightmost characters of the string.

n Count of characters.

MD::InternalStringT<String, Char, Latin1Char> InternalStringT::simplified() const

Returns simplified string.

MD::InternalStringT<String, Char, Latin1Char> InternalStringT::sliced(long long pos, long long len = -1) const

Returns sliced sub-string.

pos Position.

len Length.

std::vector<MD::InternalStringT<String, Char, Latin1Char>> InternalStringT::split(const MD::InternalStringT<String, Char, Latin1Char> &sep) const

Split string.

sep Separator.

long long InternalStringT::virginPos(long long pos, bool end = false) const

Returns virgin position from transformed.

pos Transformed position.

end If true will be return last virgin position before transformation. For example if in virgin string 2 characters were replaced with 1, we will receive position of second character if end is true.

String InternalStringT::virginSubString(long long pos = 0, long long len = -1) const

Returns virgin sub-string with position and length in the transformed string.

pos Position.

len Length.

Char InternalStringT::operator[](long long position) const

Returns char at a given position position.

position Position.