High Performance OPC UA Server SDK
1.2.0.193
|
A structure containing a String in a locale-specific translation specified in the identifier for the locale. More...
#include <localizedtext.h>
Public Member Functions | |
void | ua_localizedtext_init (struct ua_localizedtext *t) |
Initialize an ua_localizedtext with a null locale and text. | |
void | ua_localizedtext_clear (struct ua_localizedtext *t) |
Clear an ua_localizedtext and set locale and text to null. | |
int | ua_localizedtext_set (struct ua_localizedtext *t, const char *locale, const char *text) |
Set the locale and text fields of a localizedtext t . More... | |
int | ua_localizedtext_compare (const struct ua_localizedtext *a, const struct ua_localizedtext *b) |
Compare two ua_localizedtexts. More... | |
int | ua_localizedtext_copy (struct ua_localizedtext *dst, const struct ua_localizedtext *src) |
Copy the ua_localizedtext src to dst . More... | |
int | ua_localizedtext_to_string (const struct ua_localizedtext *t, struct ua_string *dst) |
Converts the localizedtext into a string. More... | |
int | ua_localizedtext_snprintf (char *dst, size_t size, const struct ua_localizedtext *t) |
Print the localizedtext t into the string buffer dst . More... | |
int | ua_localizedtext_from_string (struct ua_localizedtext *t, const struct ua_string *src) |
Creates a localizedtext t from the string src . More... | |
Data Fields | |
struct ua_string | locale |
The identifier for the locale, for instance “en-US”. More... | |
struct ua_string | text |
The text in the language given by Locale. More... | |
A structure containing a String in a locale-specific translation specified in the identifier for the locale.
int ua_localizedtext_compare | ( | const struct ua_localizedtext * | a, |
const struct ua_localizedtext * | b | ||
) |
Compare two ua_localizedtexts.
int ua_localizedtext_copy | ( | struct ua_localizedtext * | dst, |
const struct ua_localizedtext * | src | ||
) |
Copy the ua_localizedtext src
to dst
.
int ua_localizedtext_from_string | ( | struct ua_localizedtext * | t, |
const struct ua_string * | src | ||
) |
Creates a localizedtext t
from the string src
.
The locale comes first in src
and is separated from the text by a semicolon. The semicolon may be omitted if there is no locale. The text may also be omitted, but in this case the semicolon must be present. Omitted locale or text will produce a null string in t
.
int ua_localizedtext_set | ( | struct ua_localizedtext * | t, |
const char * | locale, | ||
const char * | text | ||
) |
Set the locale and text fields of a localizedtext t
.
Creates a copy of the locale
and text
strings, so the caller is responsible to clear t
.
t | localizedtext to set locale and text. |
locale | for the localizedtext. Zero terminated string, may be NULL to set a null string. |
text | for the localizedtext. Zero terminated string, may be NULL to set a null string. |
int ua_localizedtext_snprintf | ( | char * | dst, |
size_t | size, | ||
const struct ua_localizedtext * | t | ||
) |
Print the localizedtext t
into the string buffer dst
.
Writes at most size
characters. Null and empty strings are omitted. Returns the number of bytes written to dst
or if dst
is too small the number of bytes that would have been written to dst
. The text format contains an optional locale separated from the text by a semicolon. The locale itself cannot contain a semicolon. Examples:
"en-US;Hello World" "de-DE;Hallo Welt" "Hello World"
dst | Pointer to preallocated string buffer. |
size | Size of dst in bytes. |
t | LocalizedText input. |
int ua_localizedtext_to_string | ( | const struct ua_localizedtext * | t, |
struct ua_string * | dst | ||
) |
Converts the localizedtext into a string.
Example:
t | The localizedtext input. |
dst | The formatted string output. This can be an unitialized string variable, it will be allocated using ua_string_allocate internally if the operation succeeds. Your must call ua_string_clear to free these resources. |
struct ua_string locale |
The identifier for the locale, for instance “en-US”.
struct ua_string text |
The text in the language given by Locale.