From 152c6bed75598a6ca5efb7914701157270155833 Mon Sep 17 00:00:00 2001 From: Vincent Richard Date: Sun, 29 Dec 2013 10:02:12 +0100 Subject: Merged source and header files in directory structure. Got rid of SConstruct build. --- src/path.cpp | 190 ----------------------------------------------------------- 1 file changed, 190 deletions(-) delete mode 100644 src/path.cpp (limited to 'src/path.cpp') diff --git a/src/path.cpp b/src/path.cpp deleted file mode 100644 index 3f1bc6af..00000000 --- a/src/path.cpp +++ /dev/null @@ -1,190 +0,0 @@ -// -// VMime library (http://www.vmime.org) -// Copyright (C) 2002-2013 Vincent Richard -// -// This program is free software; you can redistribute it and/or -// modify it under the terms of the GNU General Public License as -// published by the Free Software Foundation; either version 3 of -// the License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// General Public License for more details. -// -// You should have received a copy of the GNU General Public License along -// with this program; if not, write to the Free Software Foundation, Inc., -// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -// -// Linking this library statically or dynamically with other modules is making -// a combined work based on this library. Thus, the terms and conditions of -// the GNU General Public License cover the whole combination. -// - -#include "vmime/path.hpp" -#include "vmime/parserHelpers.hpp" - - -namespace vmime -{ - - -path::path() -{ -} - - -path::path(const string& localPart, const string& domain) - : m_localPart(localPart), m_domain(domain) -{ -} - - -path::path(const path& p) - : headerFieldValue(), m_localPart(p.m_localPart), m_domain(p.m_domain) -{ -} - - -const string& path::getLocalPart() const -{ - return (m_localPart); -} - - -void path::setLocalPart(const string& localPart) -{ - m_localPart = localPart; -} - - -const string& path::getDomain() const -{ - return (m_domain); -} - - -void path::setDomain(const string& domain) -{ - m_domain = domain; -} - - -bool path::operator==(const path& p) const -{ - return (m_localPart == p.m_localPart && - m_domain == p.m_domain); -} - - -bool path::operator!=(const path& p) const -{ - return (m_localPart != p.m_localPart || - m_domain != p.m_domain); -} - - -void path::copyFrom(const component& other) -{ - const path& p = dynamic_cast (other); - - m_localPart = p.m_localPart; - m_domain = p.m_domain; -} - - -shared_ptr path::clone() const -{ - return make_shared (*this); -} - - -path& path::operator=(const path& other) -{ - copyFrom(other); - return (*this); -} - - -const std::vector > path::getChildComponents() -{ - return std::vector >(); -} - - -void path::parseImpl - (const parsingContext& /* ctx */, const string& buffer, const size_t position, - const size_t end, size_t* newPosition) -{ - size_t pos = position; - - while (pos < end && parserHelpers::isSpace(buffer[pos])) - ++pos; - - string addrSpec; - - if (pos < end && buffer[pos] == '<') - { - // Skip '<' - ++pos; - - while (pos < end && parserHelpers::isSpace(buffer[pos])) - ++pos; - - const size_t addrStart = pos; - - while (pos < end && buffer[pos] != '>') - ++pos; - - size_t addrEnd = pos; - - while (addrEnd > addrStart && parserHelpers::isSpace(buffer[addrEnd - 1])) - addrEnd--; - - addrSpec = string(buffer.begin() + addrStart, buffer.begin() + addrEnd); - } - else - { - addrSpec = string(buffer.begin() + position, buffer.begin() + end); - } - - const size_t at = addrSpec.find_first_of('@'); - - if (at != string::npos) - { - m_localPart = string(addrSpec.begin(), addrSpec.begin() + at); - m_domain = string(addrSpec.begin() + at + 1, addrSpec.end()); - } - else - { - m_localPart.clear(); - m_domain = addrSpec; - } - - if (newPosition != NULL) - *newPosition = end; -} - - -void path::generateImpl - (const generationContext& /* ctx */, utility::outputStream& os, - const size_t curLinePos, size_t* newLinePos) const -{ - if (m_localPart.empty() && m_domain.empty()) - { - os << "<>"; - - if (newLinePos) - *newLinePos = curLinePos + 2; - } - else - { - os << "<" << m_localPart << "@" << m_domain << ">"; - - if (newLinePos) - *newLinePos = curLinePos + m_localPart.length() + m_domain.length() + 3; - } -} - - -} // vmime -- cgit v1.2.3