High Performance OPC UA Server SDK  1.2.0.193
ua_localizedtext Struct Reference

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...
 

Detailed Description

A structure containing a String in a locale-specific translation specified in the identifier for the locale.

Member Function Documentation

int ua_localizedtext_compare ( const struct ua_localizedtext a,
const struct ua_localizedtext b 
)

Compare two ua_localizedtexts.

Returns
Zero if the localizedtexts are the same.
int ua_localizedtext_copy ( struct ua_localizedtext dst,
const struct ua_localizedtext src 
)

Copy the ua_localizedtext src to dst.

Returns
Zero on success or errorcode on failure.
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.

Parameters
tlocalizedtext to set locale and text.
localefor the localizedtext. Zero terminated string, may be NULL to set a null string.
textfor the localizedtext. Zero terminated string, may be NULL to set a null string.
Returns
0 on success or errorcode on failure.
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"
Parameters
dstPointer to preallocated string buffer.
sizeSize of dst in bytes.
tLocalizedText input.
int ua_localizedtext_to_string ( const struct ua_localizedtext t,
struct ua_string dst 
)

Converts the localizedtext into a string.

Example:

struct ua_string tmp;
if (ua_localizedtext_to_string(&t, &tmp) == 0) {
printf("t = %s\n", ua_string_const_data(&tmp));
}
Parameters
tThe localizedtext input.
dstThe 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.
Returns
Zero on success, a negative error code on failure.

Field Documentation

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.


The documentation for this struct was generated from the following files: