Преглед на файлове

Removed "using namespace std" from header files.


git-svn-id: https://svn.microneil.com/svn/CodeDweller/branches/adeniz_1@58 d34b734f-a00e-4b39-a726-e4eeb87269ab
adeniz_1
adeniz преди 10 години
родител
ревизия
9c0bba99ad
променени са 3 файла, в които са добавени 32 реда и са изтрити 32 реда
  1. 2
    0
      networking.cpp
  2. 28
    30
      networking.hpp
  3. 2
    2
      networking.inline.hpp

+ 2
- 0
networking.cpp Целия файл

@@ -24,6 +24,8 @@

#include "networking.hpp"

using namespace std;

namespace CodeDweller {

Networking Network; // Finally creating the Network instance.

+ 28
- 30
networking.hpp Целия файл

@@ -34,14 +34,10 @@
#include <sstream>
#include <cstring>

using namespace std;

#include <cstdlib>
#include <cstdio>
#include <cerrno>

namespace CodeDweller {

//// Platform specific includes...

#if defined(WIN32) || defined(_WIN32) || defined(WIN64) || defined(_WIN64)
@@ -64,6 +60,8 @@ typedef SOCKET hSocket;
#include <unistd.h>
#include <fcntl.h>

namespace CodeDweller {

typedef int hSocket; // *nix uses int to handle a Socket.
const hSocket INVALID_SOCKET = -1; // -1 is the invalid Socket.

@@ -105,14 +103,14 @@ class IP4Address {
IP4Address(const IP4Address&); // Constructor given an IP4Address

IP4Address(const char* newIP); // Construcing with a cstring.
IP4Address(const string& newIP); // Constructing with a cppstring.
IP4Address(const std::string& newIP); // Constructing with a cppstring.

IP4Address& operator=(const unsigned long int Right); // Convert from unsigned long int.
IP4Address& operator=(const char* Right); // Convert from c string.
IP4Address& operator=(const string& Right); // Convert from cpp string.
IP4Address& operator=(const std::string& Right); // Convert from cpp string.

operator unsigned long int() const;
operator string() const;
operator std::string() const;

bool operator<(const IP4Address Right) const; // < Comparison.
bool operator>(const IP4Address Right) const; // > Comparison.
@@ -153,41 +151,41 @@ class Networking {

public:

class NotSupportedError : public runtime_error { // Thrown when something can't be done.
public: NotSupportedError(const string& w):runtime_error(w) {}
class NotSupportedError : public std::runtime_error { // Thrown when something can't be done.
public: NotSupportedError(const std::string& w):std::runtime_error(w) {}
};
class InitializationError : public runtime_error { // Thrown if initialization fails.
public: InitializationError(const string& w):runtime_error(w) {}
class InitializationError : public std::runtime_error { // Thrown if initialization fails.
public: InitializationError(const std::string& w):std::runtime_error(w) {}
};
class ControlError : public runtime_error { // Thrown if control functions fail.
public: ControlError(const string& w):runtime_error(w) {}
class ControlError : public std::runtime_error { // Thrown if control functions fail.
public: ControlError(const std::string& w):std::runtime_error(w) {}
};
class SocketCreationError : public runtime_error { // Thrown if a call to socket() fails.
public: SocketCreationError(const string& w):runtime_error(w) {}
class SocketCreationError : public std::runtime_error { // Thrown if a call to socket() fails.
public: SocketCreationError(const std::string& w):std::runtime_error(w) {}
};
class SocketSetSockOptError : public runtime_error {
public: SocketSetSockOptError(const string& w):runtime_error(w) {} // Thrown if a call to setsockopt() fails.
class SocketSetSockOptError : public std::runtime_error {
public: SocketSetSockOptError(const std::string& w):std::runtime_error(w) {} // Thrown if a call to setsockopt() fails.
};
class SocketBindError : public runtime_error { // Thrown if a call to bind() fails.
public: SocketBindError(const string& w):runtime_error(w) {}
class SocketBindError : public std::runtime_error { // Thrown if a call to bind() fails.
public: SocketBindError(const std::string& w):std::runtime_error(w) {}
};
class SocketListenError : public runtime_error { // Thrown if a call to listen() fails.
public: SocketListenError(const string& w):runtime_error(w) {}
class SocketListenError : public std::runtime_error { // Thrown if a call to listen() fails.
public: SocketListenError(const std::string& w):std::runtime_error(w) {}
};
class SocketConnectError : public runtime_error { // Thrown if a call to connect() fails.
public: SocketConnectError(const string& w):runtime_error(w) {}
class SocketConnectError : public std::runtime_error { // Thrown if a call to connect() fails.
public: SocketConnectError(const std::string& w):std::runtime_error(w) {}
};
class SocketAcceptError : public runtime_error { // Thrown if a call to accept() fails.
public: SocketAcceptError(const string& w):runtime_error(w) {}
class SocketAcceptError : public std::runtime_error { // Thrown if a call to accept() fails.
public: SocketAcceptError(const std::string& w):std::runtime_error(w) {}
};
class SocketReadError : public runtime_error { // Thrown if a socket read call fails.
public: SocketReadError(const string& w):runtime_error(w) {}
class SocketReadError : public std::runtime_error { // Thrown if a socket read call fails.
public: SocketReadError(const std::string& w):std::runtime_error(w) {}
};
class SocketWriteError : public runtime_error { // Thrown if a socket write call fails.
public: SocketWriteError(const string& w):runtime_error(w) {}
class SocketWriteError : public std::runtime_error { // Thrown if a socket write call fails.
public: SocketWriteError(const std::string& w):std::runtime_error(w) {}
};

static string DescriptiveError(string Msg, int Errno); // Form a descriptive error w/ errno.
static std::string DescriptiveError(std::string Msg, int Errno); // Form a descriptive error w/ errno.

Networking();
~Networking();

+ 2
- 2
networking.inline.hpp Целия файл

@@ -109,7 +109,7 @@ inline IP4Address::IP4Address(const unsigned long int newIP):IP(newIP){}
inline IP4Address::IP4Address(const IP4Address& newIP):IP(newIP.IP){} // Constructor given an IP4Address

inline IP4Address::IP4Address(const char* newIP) { (*this) = newIP; } // Construcing with a cstring.
inline IP4Address::IP4Address(const string& newIP) { (*this) = newIP; } // Constructing with a cppstring.
inline IP4Address::IP4Address(const std::string& newIP) { (*this) = newIP; } // Constructing with a cppstring.

inline IP4Address&
IP4Address::operator=(const unsigned long int Right) { // Convert from unsigned long int.
@@ -122,7 +122,7 @@ inline IP4Address& IP4Address::operator=(const char* Right) {
return *this;
}

inline IP4Address& IP4Address::operator=(const string& Right) { // Convert from cpp string.
inline IP4Address& IP4Address::operator=(const std::string& Right) { // Convert from cpp string.
IP = ntohl(inet_addr(Right.c_str()));
return *this;
}

Loading…
Отказ
Запис