Added include guards to header files
This commit is contained in:
		| @@ -1,3 +1,5 @@ | ||||
| #ifndef _BASE_HELP | ||||
| #define _BASE_HELP | ||||
| #include <string> | ||||
| #include <cmath> | ||||
| #include <iostream> | ||||
| @@ -46,3 +48,4 @@ std::string base_convert(std::string num, int from_base, int to_base) { | ||||
|  | ||||
| 	return result; | ||||
| } | ||||
| #endif | ||||
|   | ||||
| @@ -1,7 +1,10 @@ | ||||
| #include "sock.hpp" | ||||
| #ifndef _CLIENT_H | ||||
| #define _CLIENT_H | ||||
|  | ||||
| #include "includes/sock.hpp" | ||||
| #include "includes/exception_consts.hpp" | ||||
| /* | ||||
| Client class - Defines a TCP/UDP client. | ||||
| - The constructor takes in a **remote** address and port, and connects the client to that address/port. | ||||
| Client class - Inherits from 'Sock' class - Defines a TCP/UDP client. The only method that is overriden is the 'create_socket' method. | ||||
| */ | ||||
|  | ||||
| class Client : public Sock { | ||||
| @@ -25,3 +28,4 @@ public: | ||||
|  | ||||
| /* TODO - Add comments to better explain the inheritance and polymorphism going on */ | ||||
| }; | ||||
| #endif | ||||
|   | ||||
| @@ -1,10 +1,12 @@ | ||||
| #ifndef _CONNECT_HELP | ||||
| #define _CONNECT_HELP | ||||
| #include <iostream> | ||||
| #include <string> | ||||
| #include <cstring> | ||||
| #include <vector> | ||||
| #include <cstdint> | ||||
| #include <iomanip> | ||||
| #include <base-helpers.hpp> | ||||
| #include "includes/base-helpers.hpp" | ||||
|  | ||||
| namespace connect_code { | ||||
| 	namespace { /* Since these are internal function, I have wrapped them in an anonymous namespace, to prevent outside access to them */ | ||||
| @@ -84,3 +86,4 @@ namespace connect_code { | ||||
| 	} | ||||
|  | ||||
| } | ||||
| #endif | ||||
|   | ||||
| @@ -1,5 +1,8 @@ | ||||
| #ifndef _MATH_HELP | ||||
| #define _MATH_HELP | ||||
| int signum(int num) { | ||||
| 	int retval = 0; | ||||
| 	(num > 0) ? retval = 1 : retval = -1; | ||||
| 	return retval; | ||||
| } | ||||
| #endif | ||||
|   | ||||
| @@ -1,4 +1,7 @@ | ||||
| #include "sock.hpp" | ||||
| #ifndef _SERVER | ||||
| #define _SERVER | ||||
| #include "includes/sock.hpp" | ||||
| #include "includes/exception_consts.hpp" | ||||
|  | ||||
| /* | ||||
| Server class - Defines a TCP/UDP server. | ||||
| @@ -26,3 +29,4 @@ public: | ||||
|  | ||||
| /* TODO - Add comments to better explain the inheritance and polymorphism going on */ | ||||
| }; | ||||
| #endif | ||||
|   | ||||
		Reference in New Issue
	
	Block a user