Mistake on this page?
Report an issue in GitHub or email us
Public Types | Public Member Functions
Text Class Reference

Represent the well known type text. More...

#include <Text.h>

Public Types

Public Member Functions

 Text ()
 Construct an empty text element. More...
 
 Text (encoding_t text_encoding, const Span< const uint8_t > &language_code, const Span< const uint8_t > &text)
 Construct a text element from a data buffer and an encoding. More...
 
 Text (const Text &to_copy)
 Copy construct a text element. More...
 
 ~Text ()
 Destroy a text element. More...
 
Textoperator= (const Text &to_copy)
 Copy assignment of another text element. More...
 
void set_text (encoding_t text_encoding, const Span< const uint8_t > &language_code, const Span< const uint8_t > &text)
 Copy a text from an external buffer. More...
 
encoding_t get_encoding () const
 Get the encoding of the text. More...
 
Span< const uint8_t > get_language_code () const
 Return the language code. More...
 
Span< const uint8_t > get_text () const
 Return the text contained in this object. More...
 
bool append_as_record (MessageBuilder &message_builder, bool is_last_record=false) const
 Append into a message builder. More...
 
size_t get_record_size () const
 Compute the size of this object in a ndef record. More...
 

Detailed Description

Represent the well known type text.

Definition at line 41 of file Text.h.

Member Enumeration Documentation

enum encoding_t

Encoding of the text.

Enumerator
UTF8 

UTF8.

UTF16 

UTF16.

Definition at line 46 of file Text.h.

Constructor & Destructor Documentation

Text ( )

Construct an empty text element.

Text ( encoding_t  text_encoding,
const Span< const uint8_t > &  language_code,
const Span< const uint8_t > &  text 
)

Construct a text element from a data buffer and an encoding.

Parameters
text_encodingThe encoding of the text.
language_codeThe string of the language code.
textThe text buffer.
Note
To remove the NULL terminator of the C-string of the language_code and text parameters, you can use the utility function span_from_cstr.
Text ( const Text to_copy)

Copy construct a text element.

Parameters
to_copy
~Text ( )

Destroy a text element.

Member Function Documentation

bool append_as_record ( MessageBuilder message_builder,
bool  is_last_record = false 
) const

Append into a message builder.

encoding_t get_encoding ( ) const

Get the encoding of the text.

Returns
The encoding of the text.
Span<const uint8_t> get_language_code ( ) const

Return the language code.

Returns
The language code.
size_t get_record_size ( ) const

Compute the size of this object in a ndef record.

Returns
The size of the ndef record required to store this object.
Span<const uint8_t> get_text ( ) const

Return the text contained in this object.

Returns
The text contained in this object.
Text& operator= ( const Text to_copy)

Copy assignment of another text element.

Parameters
to_copyThe Text instance to copy
Returns
a reference to this object.
void set_text ( encoding_t  text_encoding,
const Span< const uint8_t > &  language_code,
const Span< const uint8_t > &  text 
)

Copy a text from an external buffer.

Parameters
text_encodingThe encoding of the text.
language_codeThe language code of the text.
textThe text to copy.
Note
To remove the NULL terminator of the C-string of the language_code and text parameters, you can use the utility function span_from_cstr.
Important Information for this Arm website

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies. If you are not happy with the use of these cookies, please review our Cookie Policy to learn how they can be disabled. By disabling cookies, some features of the site will not work.