B2BITS FIX Antenna C++  2.29.0
Public Types | Public Member Functions | Static Public Member Functions | List of all members
Engine::BasicString< CharType > Class Template Reference

Represents ASCII std::string. More...

#include <B2BITS_String.h>

+ Inheritance diagram for Engine::BasicString< CharType >:
+ Collaboration diagram for Engine::BasicString< CharType >:

Public Types

typedef BasicString< value_typeMyT
 
typedef CharType value_type
 Provides access to the template parameter. More...
 
- Public Types inherited from Engine::MemBlock< CharType >
typedef CharType value_type
 Provides access to the template parameter. More...
 

Public Member Functions

 BasicString () throw ()
 Default constructor. More...
 
 BasicString (const value_type *aData, size_t aSize) throw ()
 Constructor Constructs instance from address to memory and size. More...
 
template<typename Iterator >
 BasicString (Iterator aBegin, Iterator aEnd) throw ()
 Constructor Constructs instance from address to memory and size. More...
 
 BasicString (std::basic_string< CharType > const &str) throw ()
 Constructor Constructs instance from std::basic_string. More...
 
 BasicString (value_type const *aData) throw ()
 Constructor Constructs instance from ANSI std::string. More...
 
int compareTo (BasicString rv) const throw ()
 
bool equals (BasicString rv) const throw ()
 
size_t find (value_type val, size_t pos=0) const
 Search a given character in the string. More...
 
size_t find (const value_type *sub, size_t pos, size_t count) const
 Find a given substring in the string. More...
 
template<typename S >
size_t find (const S &sub, size_t pos=0) const
 Find a given substring in the string. More...
 
size_t find (const value_type *sub, size_t pos=0) const
 Find a given substring in the string. More...
 
bool isEmpty () const throw ()
 Returns true if given string is empty (e.g. size equal to 0) More...
 
bool isNull () const throw ()
 Returns true if given string is NULL. More...
 
MyT normalize () const throw ()
 Calculates size of string and returns new object of BasicString. More...
 
BasicString substr (std::size_t offset, std::size_t size) const throw ()
 Returns part of the string by given offset and size. More...
 
int toInt () const throw ()
 Converts string value to int. More...
 
System::i16 toInt16 () const throw ()
 Converts string value to int. More...
 
System::i32 toInt32 () const throw ()
 Converts string value to int. More...
 
System::i64 toInt64 () const throw ()
 Converts string value to int. More...
 
std::basic_string< value_typetoStdString () const
 Converts AsciiString to std::string. More...
 
std::basic_string< value_typetoString () const
 Converts AsciiString to std::string This method creates copy of the stored buffer and returns it as std::string. More...
 
unsigned int toUInt () const throw ()
 Converts string value to int. More...
 
System::u16 toUInt16 () const throw ()
 Converts string value to int. More...
 
System::u32 toUInt32 () const throw ()
 Converts string value to int. More...
 
System::u64 toUInt64 () const throw ()
 Converts string value to int. More...
 
- Public Member Functions inherited from Engine::MemBlock< CharType >
value_type const * begin () const throw ()
 Returns pointer to first character. More...
 
int compareTo (MemBlock rv) const throw ()
 Compares two MemBlock. More...
 
value_type const * data () const throw ()
 Returns pointer to the first character of the block. More...
 
value_type const * end () const throw ()
 Returns pointer to the next after last character. More...
 
 MemBlock (const value_type *aData, size_t aSize) throw ()
 Constructor Constructs instance from address to memory and size. More...
 
 MemBlock (Iterator aBegin, Iterator aEnd) throw ()
 Constructor Constructs instance from address to memory and size. More...
 
 MemBlock () throw ()
 Default constructor. More...
 
value_type const & operator[] (std::size_t index) const throw ()
 Indexer. More...
 
std::size_t size () const throw ()
 Returns size of the block. More...
 

Static Public Member Functions

template<int N>
static MyT fromStr (value_type const (&aData) [N]) throw ()
 Creates instance from array of char. More...
 

Detailed Description

template<typename CharType>
class Engine::BasicString< CharType >

Represents ASCII std::string.

Member Typedef Documentation

◆ MyT

template<typename CharType>
typedef BasicString<value_type> Engine::BasicString< CharType >::MyT

◆ value_type

template<typename CharType>
typedef CharType Engine::BasicString< CharType >::value_type

Provides access to the template parameter.

Constructor & Destructor Documentation

◆ BasicString() [1/5]

template<typename CharType>
Engine::BasicString< CharType >::BasicString ( )
throw (
)
inline

Default constructor.

Referenced by Engine::BasicString< CharType >::substr().

◆ BasicString() [2/5]

template<typename CharType>
Engine::BasicString< CharType >::BasicString ( const value_type aData,
size_t  aSize 
)
throw (
)
inline

Constructor Constructs instance from address to memory and size.

Parameters
aDataaddress to the block
aSizesize of the block

◆ BasicString() [3/5]

template<typename CharType>
template<typename Iterator >
Engine::BasicString< CharType >::BasicString ( Iterator  aBegin,
Iterator  aEnd 
)
throw (
)
inline

Constructor Constructs instance from address to memory and size.

Parameters
aBeginaddress to the first byte of the block
aEndaddress of the byte after last byte of the block

◆ BasicString() [4/5]

template<typename CharType>
Engine::BasicString< CharType >::BasicString ( std::basic_string< CharType > const &  str)
throw (
)
inline

Constructor Constructs instance from std::basic_string.

Parameters
strSource std::string

◆ BasicString() [5/5]

template<typename CharType>
Engine::BasicString< CharType >::BasicString ( value_type const *  aData)
throw (
)
inline

Constructor Constructs instance from ANSI std::string.

Parameters
aDataaddress to the ASCII std::string

Member Function Documentation

◆ compareTo()

template<typename CharType>
int Engine::BasicString< CharType >::compareTo ( BasicString< CharType >  rv) const
throw (
)
inline

◆ equals()

template<typename CharType>
bool Engine::BasicString< CharType >::equals ( BasicString< CharType >  rv) const
throw (
)
inline

◆ find() [1/4]

template<typename CharType>
size_t Engine::BasicString< CharType >::find ( value_type  val,
size_t  pos = 0 
) const
inline

Search a given character in the string.

Parameters
valvalue to find
posposition to start the search
Returns
position of matching element, if found, otherwise std::string::npos
AsciiString abcd("abcd");
size_t pos = abcd.find('b');

References Engine::MemBlock< CharType >::data(), and Engine::MemBlock< CharType >::size().

Referenced by Engine::BasicString< CharType >::find().

◆ find() [2/4]

template<typename CharType>
size_t Engine::BasicString< CharType >::find ( const value_type sub,
size_t  pos,
size_t  count 
) const
inline

Find a given substring in the string.

Parameters
subsubstring to look for as a raw pointer
posposition where the search starts
countlength of the substring to look for
Returns
if found, offset to the first element of sub, otherwise std::string::npos
AsciiString abcd("abcd");
char name[] = "ab";
size_t pos = abcd.find(name, 0, sizeof(name) - 1);

References Engine::MemBlock< CharType >::data(), and Engine::MemBlock< CharType >::size().

◆ find() [3/4]

template<typename CharType>
template<typename S >
size_t Engine::BasicString< CharType >::find ( const S &  sub,
size_t  pos = 0 
) const
inline

Find a given substring in the string.

Parameters
subsubstring to look for
posposition where the search starts
Returns
if found, offset to the first element of sub, otherwise std::string::npos
AsciiString abcd("abcd");
std::string ab("ab");
size_t pos = abcd.find(ab);

References Engine::BasicString< CharType >::find().

◆ find() [4/4]

template<typename CharType>
size_t Engine::BasicString< CharType >::find ( const value_type sub,
size_t  pos = 0 
) const
inline

Find a given substring in the string.

Parameters
subsubstring to look for as a null terminated character array
posposition where the search starts
Returns
if found, offset to the first element of sub, otherwise std::string::npos
AsciiString abcd("abcd");
const char* ab = "ab";
size_t pos = abcd.find(ab);

References Engine::BasicString< CharType >::find().

◆ fromStr()

template<typename CharType>
template<int N>
static MyT Engine::BasicString< CharType >::fromStr ( value_type const (&)  aData[N])
throw (
)
inlinestatic

Creates instance from array of char.

Parameters
aDataArray of chars

◆ isEmpty()

template<typename CharType>
bool Engine::BasicString< CharType >::isEmpty ( ) const
throw (
)
inline

Returns true if given string is empty (e.g. size equal to 0)

References Engine::MemBlock< CharType >::data(), and Engine::MemBlock< CharType >::size().

◆ isNull()

template<typename CharType>
bool Engine::BasicString< CharType >::isNull ( ) const
throw (
)
inline

Returns true if given string is NULL.

References Engine::MemBlock< CharType >::data().

◆ normalize()

template<typename CharType>
MyT Engine::BasicString< CharType >::normalize ( ) const
throw (
)
inline

Calculates size of string and returns new object of BasicString.

References Engine::MemBlock< CharType >::data(), and Engine::MemBlock< CharType >::size().

◆ substr()

template<typename CharType>
BasicString Engine::BasicString< CharType >::substr ( std::size_t  offset,
std::size_t  size 
) const
throw (
)
inline

◆ toInt()

template<typename CharType>
int Engine::BasicString< CharType >::toInt ( ) const
throw (
)
inline

Converts string value to int.

References Engine::MemBlock< CharType >::data(), and Engine::MemBlock< CharType >::size().

◆ toInt16()

template<typename CharType>
System::i16 Engine::BasicString< CharType >::toInt16 ( ) const
throw (
)
inline

Converts string value to int.

References Engine::MemBlock< CharType >::data(), and Engine::MemBlock< CharType >::size().

◆ toInt32()

template<typename CharType>
System::i32 Engine::BasicString< CharType >::toInt32 ( ) const
throw (
)
inline

Converts string value to int.

References Engine::MemBlock< CharType >::data(), and Engine::MemBlock< CharType >::size().

◆ toInt64()

template<typename CharType>
System::i64 Engine::BasicString< CharType >::toInt64 ( ) const
throw (
)
inline

Converts string value to int.

References Engine::MemBlock< CharType >::data(), and Engine::MemBlock< CharType >::size().

◆ toStdString()

template<typename CharType>
std::basic_string<value_type> Engine::BasicString< CharType >::toStdString ( ) const
inline

Converts AsciiString to std::string.

This method creates copy of the stored buffer and returns it as std::string.

References Engine::MemBlock< CharType >::data(), and Engine::MemBlock< CharType >::size().

◆ toString()

template<typename CharType>
std::basic_string<value_type> Engine::BasicString< CharType >::toString ( ) const
inline

Converts AsciiString to std::string This method creates copy of the stored buffer and returns it as std::string.

Deprecated:
Use Engine::AsciiString::toStdString instead

References Engine::MemBlock< CharType >::data(), and Engine::MemBlock< CharType >::size().

◆ toUInt()

template<typename CharType>
unsigned int Engine::BasicString< CharType >::toUInt ( ) const
throw (
)
inline

Converts string value to int.

References Engine::MemBlock< CharType >::data(), and Engine::MemBlock< CharType >::size().

◆ toUInt16()

template<typename CharType>
System::u16 Engine::BasicString< CharType >::toUInt16 ( ) const
throw (
)
inline

Converts string value to int.

References Engine::MemBlock< CharType >::data(), and Engine::MemBlock< CharType >::size().

◆ toUInt32()

template<typename CharType>
System::u32 Engine::BasicString< CharType >::toUInt32 ( ) const
throw (
)
inline

Converts string value to int.

References Engine::MemBlock< CharType >::data(), and Engine::MemBlock< CharType >::size().

◆ toUInt64()

template<typename CharType>
System::u64 Engine::BasicString< CharType >::toUInt64 ( ) const
throw (
)
inline

Converts string value to int.

References Engine::MemBlock< CharType >::data(), and Engine::MemBlock< CharType >::size().