Mbed OS Reference
Loading...
Searching...
No Matches
Mime Class Reference

Represent a mime object. More...

#include <Mime.h>

Public Member Functions

 Mime ()
 Construct an empty Mime object. More...
 
 Mime (const Span< const uint8_t > &mime_type, const Span< const uint8_t > &content)
 Construct a mime object from its type and content. More...
 
 Mime (const Mime &other)
 Copy construct a Mime object. More...
 
 ~Mime ()
 Destroy a Mime object. More...
 
Mimeoperator= (const Mime &other)
 Copy assign a Mime object. More...
 
void set_mime (const Span< const uint8_t > &mime_type, const Span< const uint8_t > &content)
 Set all attributes of a mime object. More...
 
Span< const uint8_t > get_mime_type () const
 Return the mime type. More...
 
Span< const uint8_t > get_mime_content () const
 Return the content of the mime 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 Mime object in a ndef record. More...
 

Detailed Description

Represent a mime object.

Definition at line 41 of file Mime.h.

Constructor & Destructor Documentation

◆ Mime() [1/3]

Mime ( )

Construct an empty Mime object.

◆ Mime() [2/3]

Mime ( const Span< const uint8_t > &  mime_type,
const Span< const uint8_t > &  content 
)

Construct a mime object from its type and content.

Parameters
mime_typeThe mime type of the object.
contentThe content of the object.
Note
To remove the NULL terminator of the C-string of the mime_type parameter, you can use the utility function span_from_cstr.

◆ Mime() [3/3]

Mime ( const Mime other)

Copy construct a Mime object.

Parameters
otherThe Mime object copied.

◆ ~Mime()

~Mime ( )

Destroy a Mime object.

Member Function Documentation

◆ operator=()

Mime & operator= ( const Mime other)

Copy assign a Mime object.

Parameters
otherThe Mime object to copy.
Returns
a reference to this object

◆ set_mime()

void set_mime ( const Span< const uint8_t > &  mime_type,
const Span< const uint8_t > &  content 
)

Set all attributes of a mime object.

Parameters
mime_typeType of the mime object.
contentContent of the mime object.
Note
To remove the NULL terminator of the C-string of the mime_type parameter, you can use the utility function span_from_cstr.

◆ get_mime_type()

Span< const uint8_t > get_mime_type ( ) const

Return the mime type.

Returns
The mime type.

◆ get_mime_content()

Span< const uint8_t > get_mime_content ( ) const

Return the content of the mime object.

Returns
the content of the mime object.

◆ append_as_record()

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

Append into a message builder.

◆ get_record_size()

size_t get_record_size ( ) const

Compute the size of this Mime object in a ndef record.

Returns
The size of the ndef record required to store this object.