Defines a text-based message. For example, this class would allow you to send the contents of a text file.
More...
#include "umps/messageFormats/text.hpp"
Defines a text-based message. For example, this class would allow you to send the contents of a text file.
- Copyright
- Ben Baker (University of Utah) distributed under the MIT license.
◆ Text() [1/2]
UMPS::MessageFormats::Text::Text |
( |
const Text & |
message | ) |
|
Copy constructor.
- Parameters
-
[in] | message | The text message class from which to initialize this class. |
◆ Text() [2/2]
UMPS::MessageFormats::Text::Text |
( |
Text && |
message | ) |
|
|
noexcept |
Move constructor.
- Parameters
-
[in,out] | message | The text message class from which to initialize this class. On exit, message's behavior is undefined. |
◆ clone()
◆ createInstance()
◆ fromMessage() [1/2]
void UMPS::MessageFormats::Text::fromMessage |
( |
const char * |
data, |
|
|
size_t |
length |
|
) |
| |
|
finalvirtual |
Creates the class from a message.
- Parameters
-
[in] | data | The contents of the message. This is an array whose dimension is [length] |
[in] | length | The length of data. |
- Exceptions
-
std::runtime_error | if the message is invalid. |
std::invalid_argument | if data is NULL or length is 0.
|
Implements UMPS::MessageFormats::IMessage.
◆ fromMessage() [2/2]
void UMPS::MessageFormats::Text::fromMessage |
( |
const std::string & |
message | ) |
|
|
finalvirtual |
Creates the class from a message.
- Parameters
-
[in] | message | The contents of the message. |
- Exceptions
-
std::runtime_error | if the message is invalid. |
std::invalid_argument | if data.empty() is true. |
Implements UMPS::MessageFormats::IMessage.
◆ getContents()
std::string UMPS::MessageFormats::Text::getContents |
( |
| ) |
const |
|
noexcept |
- Returns
- The contents of the text message.
◆ getMessageType()
std::string UMPS::MessageFormats::Text::getMessageType |
( |
| ) |
const |
|
finalvirtualnoexcept |
◆ getMessageVersion()
std::string UMPS::MessageFormats::Text::getMessageVersion |
( |
| ) |
const |
|
finalvirtualnoexcept |
◆ operator=() [1/2]
Text& UMPS::MessageFormats::Text::operator= |
( |
const Text & |
message | ) |
|
Copy assignment.
- Parameters
-
[in] | message | The text message class to copy to this. |
- Returns
- A deep copy of the text message.
◆ operator=() [2/2]
Text& UMPS::MessageFormats::Text::operator= |
( |
Text && |
message | ) |
|
|
noexcept |
Move assignment.
- Parameters
-
[in,out] | message | The text message class whose memory will be moved to this. On exit, messages's behavior is undefined. |
- Returns
- The memory from message moved to this.
◆ setContents()
void UMPS::MessageFormats::Text::setContents |
( |
const std::string & |
contents | ) |
|
|
noexcept |
Sets the contents of a text message.
- Parameters
-
[in] | contents | The text-based contents of the message to set. |
◆ toMessage()
std::string UMPS::MessageFormats::Text::toMessage |
( |
| ) |
const |
|
finalvirtual |
Converts the text class to a string message.
- Returns
- The class expressed as a string message.
- Exceptions
-
std::runtime_error | if the required information is not set. |
- Note
- Though the container is a string the message need not be human readable.
Implements UMPS::MessageFormats::IMessage.
The documentation for this class was generated from the following file: