diff options
author | Tobias Markmann <tm@ayena.de> | 2014-10-23 12:24:36 (GMT) |
---|---|---|
committer | Tobias Markmann <tm@ayena.de> | 2014-10-23 12:24:36 (GMT) |
commit | fa67c2b239d9c7fc508205ea17724322011194f4 (patch) | |
tree | 33c09d0a38bbf2a61b9f0dbadc048d7665542972 /Sluift/Helpers.cpp | |
parent | 052190912463d8ea36979fd5a5e9a298588dce4f (diff) | |
download | swift-contrib-fa67c2b239d9c7fc508205ea17724322011194f4.zip swift-contrib-fa67c2b239d9c7fc508205ea17724322011194f4.tar.bz2 |
Fix code in response to clang warnings.
Removes some unused private members and restructure switch statement to handle
all cases.
Test-Information:
Fixed code does not emit the clang warnings anymore.
Change-Id: I06a9036b307014e2f882e3cee45a6881b24c3f70
Diffstat (limited to 'Sluift/Helpers.cpp')
-rw-r--r-- | Sluift/Helpers.cpp | 35 |
1 files changed, 19 insertions, 16 deletions
diff --git a/Sluift/Helpers.cpp b/Sluift/Helpers.cpp index 29e2b04..756ae59 100644 --- a/Sluift/Helpers.cpp +++ b/Sluift/Helpers.cpp @@ -12,21 +12,14 @@ using namespace Swift; -template<class T> std::string Swift::getCommonErrorString(T& error) { - std::string reason = "Disconnected: "; - switch(error.getType()) { - case T::UnknownError: reason += "Unknown Error"; break; - case T::ConnectionError: reason += "Error connecting to server"; break; - case T::ConnectionReadError: reason += "Error while receiving server data"; break; - case T::ConnectionWriteError: reason += "Error while sending data to the server"; break; - case T::XMLError: reason += "Error parsing server data"; break; - case T::AuthenticationFailedError: reason += "Login/password invalid"; break; - case T::UnexpectedElementError: reason += "Unexpected response"; break; - } - return reason; -} - std::string Swift::getErrorString(const ClientError& error) { - std::string reason = getCommonErrorString(error); + std::string reason = "Disconnected: "; switch(error.getType()) { + case ClientError::UnknownError: reason += "Unknown Error"; break; + case ClientError::ConnectionError: reason += "Error connecting to server"; break; + case ClientError::ConnectionReadError: reason += "Error while receiving server data"; break; + case ClientError::ConnectionWriteError: reason += "Error while sending data to the server"; break; + case ClientError::XMLError: reason += "Error parsing server data"; break; + case ClientError::AuthenticationFailedError: reason += "Login/password invalid"; break; + case ClientError::UnexpectedElementError: reason += "Unexpected response"; break; case ClientError::DomainNameResolveError: reason += "Unable to find server"; break; case ClientError::CompressionFailedError: reason += "Error while compressing stream"; break; @@ -58,5 +51,15 @@ std::string Swift::getErrorString(const ClientError& error) { std::string Swift::getErrorString(const ComponentError& error) { - return getCommonErrorString(error); + std::string reason = "Disconnected: "; + switch(error.getType()) { + case ComponentError::UnknownError: reason += "Unknown Error"; break; + case ComponentError::ConnectionError: reason += "Error connecting to server"; break; + case ComponentError::ConnectionReadError: reason += "Error while receiving server data"; break; + case ComponentError::ConnectionWriteError: reason += "Error while sending data to the server"; break; + case ComponentError::XMLError: reason += "Error parsing server data"; break; + case ComponentError::AuthenticationFailedError: reason += "Login/password invalid"; break; + case ComponentError::UnexpectedElementError: reason += "Unexpected response"; break; + } + return reason; } |