summaryrefslogtreecommitdiff
path: root/src/address.cc
diff options
context:
space:
mode:
authorJannis M. Hoffmann <jannis@fehcom.de>2023-10-07 22:33:50 +0200
committerJannis M. Hoffmann <jannis@fehcom.de>2023-10-08 11:35:51 +0200
commit1978c49bea5b439d993067c055cec47e70db8fd6 (patch)
tree255caea96a13f95564e6b631be9a4ac55ce33cd9 /src/address.cc
parent3b1278f5459514a6d6364f068ff97b8a0432057b (diff)
minor refactoring
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 = "(";