Added include guards to header files

master
Aadhavan Srinivasan 10 months ago
parent 195d6c4b4b
commit 26427fa257

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

Loading…
Cancel
Save