Liblinphone 5.0.0

Public Member Functions | List of all members
linphone::Content Class Reference

This object holds data that can be embedded in a signaling message. More...

`#include <content.hh>`

Inheritance diagram for linphone::Content:

## Public Member Functions
| Content (void *ptr, bool takeRef=true)
LINPHONECXX_PUBLIC _LinphoneContent * | cPtr ()
LINPHONECXX_PUBLIC const uint8_t * | getBuffer () const
| Get the content data buffer, usually a string. More...
LINPHONECXX_PUBLIC std::string | getEncoding () const
| Get the encoding of the data buffer, for example "gzip". More...
LINPHONECXX_PUBLIC void | setEncoding (const std::string &encoding)
| Set the encoding of the data buffer, for example "gzip". More...
LINPHONECXX_PUBLIC std::string | getFilePath () const
| Get the file transfer filepath set for this content (replace linphone_chat_message_get_file_transfer_filepath). More...
LINPHONECXX_PUBLIC void | setFilePath (const std::string &filePath)
| Set the file transfer filepath for this content (replace linphone_chat_message_set_file_transfer_filepath). More...
LINPHONECXX_PUBLIC size_t | getFileSize () const
| Get the file size if content is either a FileContent or a FileTransferContent. More...
LINPHONECXX_PUBLIC bool | isFile () const
| Tells whether or not this content contains a file. More...
LINPHONECXX_PUBLIC bool | isFileEncrypted () const
| Tells whether or not this content contains an encrypted file. More...
LINPHONECXX_PUBLIC bool | isFileTransfer () const
| Tells whether or not this content is a file transfer. More...
LINPHONECXX_PUBLIC bool | isMultipart () const
| Tell whether a content is a multipart content. More...
LINPHONECXX_PUBLIC bool | isText () const
| Tells whether or not this content contains text. More...
LINPHONECXX_PUBLIC std::string | getKey () const
| Get the key associated with a RCS file transfer message if encrypted. More...
LINPHONECXX_PUBLIC size_t | getKeySize () const
| Get the size of key associated with a RCS file transfer message if encrypted. More...
LINPHONECXX_PUBLIC std::string | getName () const
| Get the name associated with a RCS file transfer message. More...
LINPHONECXX_PUBLIC void | setName (const std::string &name)
| Set the name associated with a RCS file transfer message. More...
LINPHONECXX_PUBLIC std::list< std::shared_ptr< linphone::Content > > | getParts () const
| Get all the parts from a multipart content. More...
LINPHONECXX_PUBLIC std::string | getPlainFilePath () const
| If the content is an encrypted file, generate a temporary plain copy of the file and returns its paths The caller is responsible to then delete this temporary copy and the returned string. More...
LINPHONECXX_PUBLIC size_t | getSize () const
| Get the content data buffer size, excluding null character despite null character is always set for convenience. More...
LINPHONECXX_PUBLIC void | setSize (size_t size)
| Set the content data size, excluding null character despite null character is always set for convenience. More...
LINPHONECXX_PUBLIC LINPHONECXX_DEPRECATED std::string | getStringBuffer () const
| Get the string content data buffer. More...
LINPHONECXX_PUBLIC LINPHONECXX_DEPRECATED void | setStringBuffer (const std::string &buffer)
| Set the string content data buffer. More...
LINPHONECXX_PUBLIC std::string | getSubtype () const
| Get the mime subtype of the content data. More...
LINPHONECXX_PUBLIC void | setSubtype (const std::string &subtype)
| Set the mime subtype of the content data. More...
LINPHONECXX_PUBLIC std::string | getType () const
| Get the mime type of the content data. More...
LINPHONECXX_PUBLIC void | setType (const std::string &type)
| Set the mime type of the content data. More...
LINPHONECXX_PUBLIC std::string | getUtf8Text () const
| Get the string content data buffer. More...
LINPHONECXX_PUBLIC void | setUtf8Text (const std::string &buffer)
| Get the string content data buffer. More...
LINPHONECXX_PUBLIC void | addContentTypeParameter (const std::string &name, const std::string &value)
| Adds a parameter to the ContentType header. More...
LINPHONECXX_PUBLIC std::shared_ptr< linphone::Content > | findPartByHeader (const std::string &headerName, const std::string &headerValue) const
| Find a part from a multipart content looking for a part header with a specified value. More...
LINPHONECXX_PUBLIC std::string | getCustomHeader (const std::string &headerName) const
| Get a custom header value of a content. More...
LINPHONECXX_PUBLIC std::shared_ptr< linphone::Content > | getPart (int index) const
| Get a part from a multipart content according to its index. More...
LINPHONECXX_PUBLIC void | setBuffer (const uint8_t *buffer, size_t size)
| Set the content data buffer, usually a string. More...
LINPHONECXX_PUBLIC void | setKey (const std::string &key, const size_t keyLength)
| Set the key associated with a RCS file transfer message if encrypted. More...

## Detailed Description

This object holds data that can be embedded in a signaling message.

Use Core::createContent() to create it, and then you should set at least it's type and subtype and fill the buffer with your data. A Content can be multipart (contain other contents), have file information (name, path, size), be encrypted, have custom headers, etc... It is mainly used to send information through a ChatMessage.

## Member Function Documentation

## ◆ addContentTypeParameter()

LINPHONECXX_PUBLIC void linphone::Content::addContentTypeParameter | ( | const std::string & | name,
|  | const std::string & | value
| ) |  |

Adds a parameter to the ContentType header.

Parameters

  value | the value of the parameter to add.

## ◆ findPartByHeader()

LINPHONECXX_PUBLIC std::shared_ptr< linphone::Content > linphone::Content::findPartByHeader | ( | const std::string & | headerName,
|  | const std::string & | headerValue
| ) |  | const

Find a part from a multipart content looking for a part header with a specified value.

Parameters

  headerValue | The value of the header to look for.

Returns
  A Content object object the part if found, nullptr otherwise.

## ◆ getBuffer()

LINPHONECXX_PUBLIC const uint8_t * linphone::Content::getBuffer | ( |  | ) | const

Get the content data buffer, usually a string.

Returns
  The content data buffer.

## ◆ getCustomHeader()

LINPHONECXX_PUBLIC std::string linphone::Content::getCustomHeader | ( | const std::string & | headerName | ) | const

Get a custom header value of a content.

Parameters

  headerName | The name of the header to get the value from.

Returns
  The value of the header if found, nullptr otherwise.

## ◆ getEncoding()

LINPHONECXX_PUBLIC std::string linphone::Content::getEncoding | ( |  | ) | const

Get the encoding of the data buffer, for example "gzip".

Returns
  The encoding of the data buffer.

## ◆ getFilePath()

LINPHONECXX_PUBLIC std::string linphone::Content::getFilePath | ( |  | ) | const

Get the file transfer filepath set for this content (replace linphone_chat_message_get_file_transfer_filepath).

Returns
  The file path set for this content if it has been set, nullptr otherwise.

## ◆ getFileSize()

LINPHONECXX_PUBLIC size_t linphone::Content::getFileSize | ( |  | ) | const

Get the file size if content is either a FileContent or a FileTransferContent.

Returns
  The represented file size.

## ◆ getKey()

LINPHONECXX_PUBLIC std::string linphone::Content::getKey | ( |  | ) | const

Get the key associated with a RCS file transfer message if encrypted.

Returns
  The key to encrypt/decrypt the file associated to this content.

## ◆ getKeySize()

LINPHONECXX_PUBLIC size_t linphone::Content::getKeySize | ( |  | ) | const

Get the size of key associated with a RCS file transfer message if encrypted.

Returns
  The key size in bytes

## ◆ getName()

LINPHONECXX_PUBLIC std::string linphone::Content::getName | ( |  | ) | const

Get the name associated with a RCS file transfer message.

It is used to store the original filename of the file to be downloaded from server.

Returns
  The name of the content.

## ◆ getPart()

LINPHONECXX_PUBLIC std::shared_ptr< linphone::Content > linphone::Content::getPart | ( | int | index | ) | const

Get a part from a multipart content according to its index.

Parameters

  index | The index of the part to get.

Returns
  A Content object holding the part if found, nullptr otherwise.

## ◆ getParts()

LINPHONECXX_PUBLIC std::list< std::shared_ptr< linphone::Content > > linphone::Content::getParts | ( |  | ) | const

Get all the parts from a multipart content.

Returns
  A object holding the part if found, nullptr otherwise.

## ◆ getPlainFilePath()

LINPHONECXX_PUBLIC std::string linphone::Content::getPlainFilePath | ( |  | ) | const

If the content is an encrypted file, generate a temporary plain copy of the file and returns its paths The caller is responsible to then delete this temporary copy and the returned string.

Returns
  The file path set for this content if it has been set, nullptr otherwise.

## ◆ getSize()

LINPHONECXX_PUBLIC size_t linphone::Content::getSize | ( |  | ) | const

Get the content data buffer size, excluding null character despite null character is always set for convenience.

Returns
  The content data buffer size.

## ◆ getStringBuffer()

LINPHONECXX_PUBLIC LINPHONECXX_DEPRECATED std::string linphone::Content::getStringBuffer | ( |  | ) | const

Get the string content data buffer.

Returns
  The string content data buffer.

Deprecated:
  2020-07-01. Use getUtf8Text() instead.

## ◆ getSubtype()

LINPHONECXX_PUBLIC std::string linphone::Content::getSubtype | ( |  | ) | const

Get the mime subtype of the content data.

Returns
  The mime subtype of the content data, for example "html".

## ◆ getType()

LINPHONECXX_PUBLIC std::string linphone::Content::getType | ( |  | ) | const

Get the mime type of the content data.

Returns
  The mime type of the content data, for example "application".

## ◆ getUtf8Text()

LINPHONECXX_PUBLIC std::string linphone::Content::getUtf8Text | ( |  | ) | const

Get the string content data buffer.

Introduced in 01/07/2020

Returns
  The string content data buffer in UTF8.

## ◆ isFile()

LINPHONECXX_PUBLIC bool linphone::Content::isFile | ( |  | ) | const

Tells whether or not this content contains a file.

Returns
  true if this content contains a file, false otherwise.

## ◆ isFileEncrypted()

LINPHONECXX_PUBLIC bool linphone::Content::isFileEncrypted | ( |  | ) | const

Tells whether or not this content contains an encrypted file.

Returns
  True is this content contains a file and this file is encrypted, false otherwise.

## ◆ isFileTransfer()

LINPHONECXX_PUBLIC bool linphone::Content::isFileTransfer | ( |  | ) | const

Tells whether or not this content is a file transfer.

Returns
  true if this content is a file transfer, false otherwise.

## ◆ isMultipart()

LINPHONECXX_PUBLIC bool linphone::Content::isMultipart | ( |  | ) | const

Tell whether a content is a multipart content.

Returns
  A boolean value telling whether the content is multipart or not.

## ◆ isText()

LINPHONECXX_PUBLIC bool linphone::Content::isText | ( |  | ) | const

Tells whether or not this content contains text.

Returns
  true if this content contains plain text, false otherwise.

## ◆ setBuffer()

LINPHONECXX_PUBLIC void linphone::Content::setBuffer | ( | const uint8_t * | buffer,
|  | size_t | size
| ) |  |

Set the content data buffer, usually a string.

Parameters

  size | The size of the content data buffer.

## ◆ setEncoding()

LINPHONECXX_PUBLIC void linphone::Content::setEncoding | ( | const std::string & | encoding | ) |

Set the encoding of the data buffer, for example "gzip".

Parameters

  encoding | The encoding of the data buffer.

## ◆ setFilePath()

LINPHONECXX_PUBLIC void linphone::Content::setFilePath | ( | const std::string & | filePath | ) |

Set the file transfer filepath for this content (replace linphone_chat_message_set_file_transfer_filepath).

Parameters

  filePath | the file transfer filepath.

## ◆ setKey()

LINPHONECXX_PUBLIC void linphone::Content::setKey | ( | const std::string & | key,
|  | const size_t | keyLength
| ) |  |

Set the key associated with a RCS file transfer message if encrypted.

Parameters

  keyLength | The lengh of the key.

## ◆ setName()

LINPHONECXX_PUBLIC void linphone::Content::setName | ( | const std::string & | name | ) |

Set the name associated with a RCS file transfer message.

It is used to store the original filename of the file to be downloaded from server.

Parameters

  name | The name of the content.

## ◆ setSize()

LINPHONECXX_PUBLIC void linphone::Content::setSize | ( | size_t | size | ) |

Set the content data size, excluding null character despite null character is always set for convenience.

Parameters

  size | The content data buffer size.

## ◆ setStringBuffer()

LINPHONECXX_PUBLIC LINPHONECXX_DEPRECATED void linphone::Content::setStringBuffer | ( | const std::string & | buffer | ) |

Set the string content data buffer.

Parameters

  buffer | The string content data buffer in UTF8.

Deprecated:
  2020-07-01. Use setUtf8Text() instead.

## ◆ setSubtype()

LINPHONECXX_PUBLIC void linphone::Content::setSubtype | ( | const std::string & | subtype | ) |

Set the mime subtype of the content data.

Parameters

  subtype | The mime subtype of the content data, for example "html".

## ◆ setType()

LINPHONECXX_PUBLIC void linphone::Content::setType | ( | const std::string & | type | ) |

Set the mime type of the content data.

Parameters

  type | The mime type of the content data, for example "application".

## ◆ setUtf8Text()

LINPHONECXX_PUBLIC void linphone::Content::setUtf8Text | ( | const std::string & | buffer | ) |

Get the string content data buffer.

Introduced in 01/07/2020

Parameters

  buffer | The string content data buffer in UTF8.

The documentation for this class was generated from the following file:

- content.hh