ASN1C C/C++ Common Runtime  ASN1C v7.7.x
Public Member Functions | Protected Attributes | List of all members
OSRTString Class Reference

#include <OSRTString.h>

Inheritance diagram for OSRTString:

Public Member Functions

 OSRTString ()
 
 OSRTString (const char *strval)
 
 OSRTString (const OSUTF8CHAR *strval)
 
 OSRTString (const OSRTString &str)
 
virtual ~OSRTString ()
 
virtual OSRTStringIF * clone ()
 
const char * data () const
 
virtual const char * getValue () const
 
virtual const OSUTF8CHAR * getUTF8Value () const
 
int indexOf (char ch) const
 
size_t length () const
 
virtual void print (const char *name)
 
virtual EXTRTMETHOD void setValue (const char *strval)
 
virtual EXTRTMETHOD void setValue (const OSUTF8CHAR *strval)
 
virtual EXTRTMETHOD void setValuePtr (char *strval)
 
bool toInt (OSINT32 &value) const
 
bool toSize (OSSIZE &value) const
 
bool toUInt (OSUINT32 &value) const
 
bool toUInt64 (OSUINT64 &value) const
 
EXTRTMETHOD OSRTStringoperator= (const OSRTString &original)
 
 operator const char * (void) const
 

Protected Attributes

char * mpValue
 

Detailed Description

C++ string class definition. This can be used to hold standard ASCII or UTF-8 strings. The standard C++ 'new' and 'delete' operators are used to allocate/free memory for the strings. All strings are deep-copied.

Constructor & Destructor Documentation

◆ OSRTString() [1/4]

OSRTString::OSRTString ( )

The default constructor creates an empty string.

◆ OSRTString() [2/4]

OSRTString::OSRTString ( const char *  strval)

This constructor initializes the string to contain the given standard ASCII string value.

Parameters
strval- Null-terminated C string value

◆ OSRTString() [3/4]

OSRTString::OSRTString ( const OSUTF8CHAR *  strval)

This constructor initializes the string to contain the given UTF-8 string value.

Parameters
strval- Null-terminated C string value

◆ OSRTString() [4/4]

OSRTString::OSRTString ( const OSRTString str)

Copy constructor.

Parameters
str- C++ string object to be copied.

◆ ~OSRTString()

virtual OSRTString::~OSRTString ( )
virtual

The destructor frees string memory using the standard 'delete' operator.

Member Function Documentation

◆ clone()

virtual OSRTStringIF* OSRTString::clone ( )
inlinevirtual

This method creates a copy of the given string object.

◆ data()

const char* OSRTString::data ( ) const
inline

This method is a synonym for getValue().

◆ getUTF8Value()

virtual const OSUTF8CHAR* OSRTString::getUTF8Value ( ) const
inlinevirtual

This method returns the pointer to UTF-8 null terminated string as a UTF-8 string.

◆ getValue()

virtual const char* OSRTString::getValue ( ) const
inlinevirtual

This method returns the pointer to UTF-8 null terminated string as a standard ASCII string.

◆ indexOf()

int OSRTString::indexOf ( char  ch) const

This method returns the index of the first occurence of the given characetr within the string or -1 if the character is not found.

◆ length()

size_t OSRTString::length ( ) const
inline

This method returns the length of the string.

◆ operator=()

EXTRTMETHOD OSRTString& OSRTString::operator= ( const OSRTString original)

Assignment operator.

◆ print()

virtual void OSRTString::print ( const char *  name)
inlinevirtual

This method prints the string value to standard output.

Parameters
name- Name of generated string variable.

References rtxPrintCharStr().

◆ setValue() [1/2]

virtual EXTRTMETHOD void OSRTString::setValue ( const char *  strval)
virtual

This method sets the string value to the given string.

Parameters
str- C null-terminated string.

◆ setValue() [2/2]

virtual EXTRTMETHOD void OSRTString::setValue ( const OSUTF8CHAR *  strval)
virtual

This method sets the string value to the given UTF-8 string value.

Parameters
str- C null-terminated UTF-8 string.

◆ setValuePtr()

virtual EXTRTMETHOD void OSRTString::setValuePtr ( char *  strval)
virtual

This method sets the string value to the given string value pointer. This is assumed to be a mutable string allocated with the new operator. This class will assume ownership of the string memory.

Parameters
str- Mutable null-terminated string allocated with new.

◆ toInt()

bool OSRTString::toInt ( OSINT32 &  value) const

This method converts the string to a signed 32-bit integer value.

Parameters
valueReference to variable to receive converted integer value.
Returns
Boolean result, true if successful or false if failed.

◆ toSize()

bool OSRTString::toSize ( OSSIZE &  value) const

This method converts the string to a size typed (site_t) value.

Parameters
valueReference to variable to receive converted integer value.
Returns
Boolean result, true if successful or false if failed.

◆ toUInt()

bool OSRTString::toUInt ( OSUINT32 &  value) const

This method converts the string to an unsigned 32-bit integer value.

Parameters
valueReference to variable to receive converted integer value.
Returns
Boolean result, true if successful or false if failed.

◆ toUInt64()

bool OSRTString::toUInt64 ( OSUINT64 &  value) const

This method converts the string to an unsigned 64-bit integer value.

Parameters
valueReference to variable to receive converted integer value.
Returns
Boolean result, true if successful or false if failed.

The documentation for this class was generated from the following file: