summaryrefslogtreecommitdiff
path: root/src/address.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/address.cc')
-rw-r--r--src/address.cc21
1 files changed, 12 insertions, 9 deletions
diff --git a/src/address.cc b/src/address.cc
index eff4ccd..33d216e 100644
--- a/src/address.cc
+++ b/src/address.cc
@@ -1,35 +1,38 @@
-/** -------------------------------------------------------------------
+/**
* @file address.cc
* @brief Implementation of the Address class
* @author Andreas Aardal Hanssen
* @date 2005
- * ---------------------------------------------------------------- **/
+ */
+
#include "address.h"
#include "convert.h"
#include <string>
-using namespace ::std;
using namespace Binc;
+using std::string;
-//------------------------------------------------------------------------
Address::Address(const string &name, const string &addr)
{
- string::size_type pos = addr.find('@');
+ auto pos = addr.find('@');
+
this->name = name;
+
if (pos != string::npos) {
this->local = addr.substr(0, pos);
this->host = addr.substr(pos + 1);
- } else
+ } else {
this->local = addr;
+ }
}
-//------------------------------------------------------------------------
Address::Address(const string &wholeaddress)
{
- string::size_type start = wholeaddress.find('<');
+ auto start = wholeaddress.find('<');
string addr;
+
if (start != string::npos)
addr = wholeaddress.substr(start + 1);
else
@@ -41,6 +44,7 @@ Address::Address(const string &wholeaddress)
name = wholeaddress.substr(0, start);
else
name = "";
+
trim(name);
trim(name, "\"");
@@ -53,7 +57,6 @@ Address::Address(const string &wholeaddress)
trim(name);
}
-//------------------------------------------------------------------------
string Address::toParenList(void) const
{
string tmp = "(";