![]() |
Safir SDK Core
|
Container for strings (std::wstring). More...
#include <Safir/Dob/Typesystem/ValueContainers.h>
Public Types | |
typedef std::wstring | ContainedType |
Public Member Functions | |
StringContainer () | |
Default constructor. | |
void | SetVal (const std::wstring &value) |
Set the value of the container. | |
const std::wstring & | GetVal () const |
Get the value of the container. | |
bool | IsNull () const override |
Is the container set to null? | |
void | SetNull () override |
Set the container to null. | |
void | Copy (const ContainerBase &that) override |
Virtual assignment. | |
UTF8 encoding methods. | |
These methods are really only meant for the blob serialization and deserialization, but it is quite safe to use them if you really need them. | |
Int32 | Utf8StringLength () const |
Calculate the length needed for this string in UTF8 encoding. | |
const std::string & | Utf8String () const |
Convert the string to a UTF8 encoded std::string. | |
![]() | |
constexpr | ContainerBase () |
Default Constructor. | |
constexpr | ContainerBase (const ContainerBase &)=default |
Copy constructor. | |
virtual | ~ContainerBase () |
Virtual destructor. | |
virtual bool | IsChanged () const |
Is the change flag set on the container? | |
virtual void | SetChanged (const bool changed) |
Set the containers change flag. | |
Friends | |
class | Safir::Dob::Typesystem::Internal::BlobOperations |
Additional Inherited Members | |
![]() | |
ContainerBase & | operator= (const ContainerBase &other) |
Copy assignment operator. | |
![]() | |
bool | m_bIsChanged |
The variable containing the change flag. | |
Container for strings (std::wstring).
This is a container for strings. It differs from the ordinary ValueContainer in that it has methods for converting to UTF8 strings. These are really only meant for blob serialization to use.
typedef std::wstring Safir::Dob::Typesystem::StringContainer::ContainedType |
Safir::Dob::Typesystem::StringContainer::StringContainer | ( | ) |
Default constructor.
Creates a null and not changed container.
|
overridevirtual |
Virtual assignment.
Copy all the members from "that" into "this". Types must be the same for this to work!
that | [in] - The object to copy into this. |
SoftwareViolationException | If the types are not of the same kind. |
Implements Safir::Dob::Typesystem::ContainerBase.
References __WFILE__.
const std::wstring & Safir::Dob::Typesystem::StringContainer::GetVal | ( | ) | const |
Get the value of the container.
NullException | The container is null. |
References __WFILE__.
|
overridevirtual |
Is the container set to null?
Implements Safir::Dob::Typesystem::ContainerBase.
Referenced by Utf8String(), and Utf8StringLength().
|
overridevirtual |
Set the container to null.
Implements Safir::Dob::Typesystem::ContainerBase.
References Safir::Dob::Typesystem::ContainerBase::m_bIsChanged.
void Safir::Dob::Typesystem::StringContainer::SetVal | ( | const std::wstring & | value | ) |
Set the value of the container.
Null and change flags are updated accordingly.
value | [in] - The new value. |
References Safir::Dob::Typesystem::ContainerBase::m_bIsChanged.
const std::string & Safir::Dob::Typesystem::StringContainer::Utf8String | ( | ) | const |
Convert the string to a UTF8 encoded std::string.
This method converts the string to utf8 (and caches it) and returns the result.
NullException | The container is null. |
References __WFILE__, IsNull(), and Safir::Dob::Typesystem::Utilities::ToUtf8().
Int32 Safir::Dob::Typesystem::StringContainer::Utf8StringLength | ( | ) | const |
Calculate the length needed for this string in UTF8 encoding.
This method converts the string to utf8 (and caches it) and returns the length of the converted string.
The returned value includes space for null termination (adds 1 to string length).
References IsNull(), and Safir::Dob::Typesystem::Utilities::ToUtf8().
|
friend |