UMPS
The University of Utah Seismograph Stations Message Passing System.
text.hpp
1 #ifndef UMPS_MESSAGEFORMATS_TEXT_HPP
2 #define UMPS_MESSAGEFORMATS_TEXT_HPP
3 #include <memory>
4 #include "umps/messageFormats/message.hpp"
5 namespace UMPS::MessageFormats
6 {
12 class Text : public IMessage
13 {
14 public:
17 
19  Text();
23  Text(const Text &message);
28  Text(Text &&message) noexcept;
30 
33 
37  Text& operator=(const Text &message);
43  Text& operator=(Text &&message) noexcept;
45 
48  void setContents(const std::string &contents) noexcept;
50  [[nodiscard]] std::string getContents( ) const noexcept;
51 
54 
60  [[nodiscard]] std::string toMessage() const final;
65  void fromMessage(const std::string &message) final;
72  void fromMessage(const char *data, size_t length) final;
74  [[nodiscard]] std::string getMessageType() const noexcept final;
76  [[nodiscard]] std::string getMessageVersion() const noexcept final;
78  [[nodiscard]] std::unique_ptr<UMPS::MessageFormats::IMessage> clone() const final;
80  [[nodiscard]] std::unique_ptr<UMPS::MessageFormats::IMessage> createInstance() const noexcept final;
84 
86  void clear() noexcept;
88  ~Text() override;
90 private:
91  class TextImpl;
92  std::unique_ptr<TextImpl> pImpl;
93 };
94 }
95 #endif
An abstract base class defining the base requirements a message format must satisfy.
Definition: message.hpp:12
Defines a text-based message. For example, this class would allow you to send the contents of a text ...
Definition: text.hpp:13
Text(const Text &message)
Copy constructor.
std::string getMessageType() const noexcept final
void clear() noexcept
Resets the class and releases all memory.
std::string getContents() const noexcept
Text & operator=(Text &&message) noexcept
Move assignment.
std::string getMessageVersion() const noexcept final
void fromMessage(const std::string &message) final
Creates the class from a message.
Text(Text &&message) noexcept
Move constructor.
std::unique_ptr< UMPS::MessageFormats::IMessage > clone() const final
std::string toMessage() const final
Converts the text class to a string message.
void setContents(const std::string &contents) noexcept
Sets the contents of a text message.
Text & operator=(const Text &message)
Copy assignment.
std::unique_ptr< UMPS::MessageFormats::IMessage > createInstance() const noexcept final