B2BITS FIX Antenna C++ 2.33.0
Loading...
Searching...
No Matches
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.
 
- Public Types inherited from Engine::MemBlock< CharType >
typedef CharType value_type
 Provides access to the template parameter.
 

Public Member Functions

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

Static Public Member Functions

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

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 >
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);
Represents ASCII std::string.
Definition B2BITS_String.h:158

References 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 >
V12_API size_t Engine::BasicString< CharType >::find ( const value_type * sub,
size_t pos = 0 ) const

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);

◆ find() [4/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().

◆ 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 >
V12_API int Engine::BasicString< CharType >::toInt ( ) const
throw ( )

Converts string value to int.

◆ toInt16()

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

Converts string value to int.

◆ toInt32()

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

Converts string value to int.

◆ toInt64()

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

Converts string value to int.

◆ 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 >
V12_API unsigned int Engine::BasicString< CharType >::toUInt ( ) const
throw ( )

Converts string value to int.

◆ toUInt16()

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

Converts string value to int.

◆ toUInt32()

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

Converts string value to int.

◆ toUInt64()

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

Converts string value to int.