Now I can describe how I am trying to implement mentioned features. I have not finished my code yet, I am just showing my current plans. All suggestions are welcome.
Classes- sf::Client (abstract class)
- sf::Server (abstract class)
- sf::Message (abstract class)
- sf::Request (inherited from sf::Message, abstract class)
- sf::Response (inherited from sf::Message, abstract class)
- sf::TcpClient (inherited from sf::Client)
- sf::TcpServer (inherited from sf::Server)
- sf::UdpClient (inherited from sf::Client)
- sf::UdpServer (inherited from sf::Server)
- sf::Http (inherited from sf::Message, friends: sf::Http::Request, sf::Http::Response)
- sf::Http::Request (inherited from sf::Request)
- sf::Http::Response (inherited from sf::Response)
- sf::Http::Client (inherited from sf::TcpClient)
- sf::Http::Server (inherited from sf::TcpServer)
DescriptionThese classes allow other classes inherited from them sending and receiving plain text (std::string). Data are placed in sf::Request and sf::Response classes.
Base class for all requests and responses. It contains plain text (std::string). It allows only to read it (const std::string&), changing it is protected - only other classes inherited from this class can do it.
They contain functions for changing data between plain text and formatted text.
- sf::TcpClient
- sf::TcpServer
- sf::UdpClient
- sf::UdpServer
They are using TCP and UDP protocols to send and receive data.
Contain data used in both, HTTP requests and responses.
- sf::Http::Request
- sf::Http::Response
They contain only their own data, not stored in sf::Http. These classes can do more than in current version. They allow to read all fields, also these with unknown names. I also changed methods' names (for example getField() to findField()). Case sensivity is an option - you do not have to use it if you do not need it.
I am not sure, but only implementation and inheritation diagram for this class should be different. New features are placed in other classes.
Only basic HTTP server, not something like apache. Not much more advanced than client.