From c179a1006858e22a7511e7e1f23f8d0e7d948b42 Mon Sep 17 00:00:00 2001 From: Vincent Richard Date: Sun, 6 Nov 2005 16:12:41 +0000 Subject: [PATCH] Refactored header field values and parameters. --- vmime/genericField.hpp | 109 ----------------------------------- vmime/genericParameter.hpp | 109 ----------------------------------- vmime/standardFields.hpp | 114 ------------------------------------- vmime/standardParams.hpp | 60 ------------------- 4 files changed, 392 deletions(-) delete mode 100644 vmime/genericField.hpp delete mode 100644 vmime/genericParameter.hpp delete mode 100644 vmime/standardFields.hpp delete mode 100644 vmime/standardParams.hpp diff --git a/vmime/genericField.hpp b/vmime/genericField.hpp deleted file mode 100644 index 93de70c0..00000000 --- a/vmime/genericField.hpp +++ /dev/null @@ -1,109 +0,0 @@ -// -// VMime library (http://www.vmime.org) -// Copyright (C) 2002-2005 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 2 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. -// - -#ifndef VMIME_GENERICFIELD_HPP_INCLUDED -#define VMIME_GENERICFIELD_HPP_INCLUDED - - -#include "vmime/headerField.hpp" -#include "vmime/headerFieldFactory.hpp" - -#include "vmime/typeAdapter.hpp" - - -namespace vmime -{ - - -/** Generic implementation for headerField. - */ - -template -class genericField : virtual public headerField -{ - friend class vmime::creator; // create ref - -protected: - - genericField() : m_value(vmime::create ()) { } - - - const ref getValueImp() const - { - return (m_value); - } - - ref getValueImp() - { - return (m_value); - } - -public: - - genericField & operator=(const genericField & other) - { - copyFrom(other); - return (*this); - } - - template - void setValue(const TYPE& value) - { - *m_value = value; - } - - VALUE_TYPE& getValue() - { - return *m_value; - } - - const VALUE_TYPE& getValue() const - { - return *m_value; - } - - void setValue(const component& value) - { - const VALUE_TYPE& v = dynamic_cast (value); - *m_value = v; - } - -private: - - ref m_value; -}; - - -/** Generic implementation for headerField with a value of type 'string'. - */ - -template <> -class genericField : public genericField > -{ -}; - - -} // vmime - - -#endif // VMIME_GENERICFIELD_HPP_INCLUDED diff --git a/vmime/genericParameter.hpp b/vmime/genericParameter.hpp deleted file mode 100644 index a66509cf..00000000 --- a/vmime/genericParameter.hpp +++ /dev/null @@ -1,109 +0,0 @@ -// -// VMime library (http://www.vmime.org) -// Copyright (C) 2002-2005 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 2 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. -// - -#ifndef VMIME_GENERICPARAMETER_HPP_INCLUDED -#define VMIME_GENERICPARAMETER_HPP_INCLUDED - - -#include "vmime/parameter.hpp" -#include "vmime/parameterFactory.hpp" - -#include "vmime/typeAdapter.hpp" - - -namespace vmime -{ - - -/** Generic implementation for parameter. - */ - -template -class genericParameter : public parameter -{ - friend class vmime::creator; // create ref - -protected: - - genericParameter() : m_value(vmime::create ()) { } - - - const ref getValueImp() const - { - return m_value; - } - - const ref getValueImp() - { - return m_value; - } - -public: - - genericParameter & operator=(const genericParameter & other) - { - copyFrom(other); - return (*this); - } - - const VALUE_TYPE& getValue() const - { - return (*m_value); - } - - VALUE_TYPE& getValue() - { - return (*m_value); - } - - template - void setValue(const TYPE& value) - { - *m_value = value; - } - - void setValue(const component& value) - { - const VALUE_TYPE& v = dynamic_cast (value); - *m_value = v; - } - -private: - - ref m_value; -}; - - -/** Generic implementation for parameter of type 'string'. - */ - -template <> -class genericParameter : public genericParameter > -{ -}; - - -} // vmime - - -#endif // VMIME_GENERICPARAMETER_HPP_INCLUDED diff --git a/vmime/standardFields.hpp b/vmime/standardFields.hpp deleted file mode 100644 index 45318b17..00000000 --- a/vmime/standardFields.hpp +++ /dev/null @@ -1,114 +0,0 @@ -// -// VMime library (http://www.vmime.org) -// Copyright (C) 2002-2005 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 2 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. -// - -#ifndef VMIME_STANDARDFIELDS_HPP_INCLUDED -#define VMIME_STANDARDFIELDS_HPP_INCLUDED - - -#include "vmime/genericField.hpp" -#include "vmime/parameterizedHeaderField.hpp" -#include "vmime/headerFieldFactory.hpp" - -// Inclusion for field value types -#include "vmime/addressList.hpp" -#include "vmime/encoding.hpp" -#include "vmime/dateTime.hpp" -#include "vmime/text.hpp" -#include "vmime/messageId.hpp" -#include "vmime/relay.hpp" -#include "vmime/mailboxList.hpp" -#include "vmime/disposition.hpp" -#include "vmime/path.hpp" -#include "vmime/messageIdSequence.hpp" - - -namespace vmime -{ - - -#define DECLARE_STANDARD_FIELD(fieldClassName, valueTypeClassName) \ - class fieldClassName : public genericField { \ - friend class vmime::creator; \ - protected: \ - fieldClassName() { } \ - fieldClassName(const fieldClassName&) \ - : headerField(), \ - genericField () { /* Not used */ } \ - } - -#ifdef VMIME_NO_MULTIPLE_INHERITANCE - - template - class genericParameterizedHeaderField : public genericField - { - }; - - #define DECLARE_STANDARD_FIELD_PARAM(fieldClassName, valueTypeClassName) \ - class fieldClassName : public genericParameterizedHeaderField { \ - friend class vmime::creator; \ - protected: \ - fieldClassName() { } \ - fieldClassName(const fieldClassName&) \ - : headerField(), \ - genericParameterizedHeaderField () { /* Not used */ } \ - } - -#else // VMIME_NO_MULTIPLE_INHERITANCE - - #define DECLARE_STANDARD_FIELD_PARAM(fieldClassName, valueTypeClassName) \ - class fieldClassName : public genericField , \ - public parameterizedHeaderField { \ - friend class vmime::creator; \ - protected: \ - fieldClassName() { } \ - fieldClassName(const fieldClassName&) \ - : headerField(), \ - genericField (), \ - parameterizedHeaderField() { /* Not used */ } \ - } - -#endif // VMIME_NO_MULTIPLE_INHERITANCE - - - -DECLARE_STANDARD_FIELD(addressListField, addressList); -DECLARE_STANDARD_FIELD_PARAM(contentEncodingField, encoding); -DECLARE_STANDARD_FIELD(dateField, datetime); -DECLARE_STANDARD_FIELD(textField, text); -DECLARE_STANDARD_FIELD(messageIdField, messageId); -DECLARE_STANDARD_FIELD(defaultField, string); -DECLARE_STANDARD_FIELD(relayField, relay); -DECLARE_STANDARD_FIELD(mailboxListField, mailboxList); -DECLARE_STANDARD_FIELD(dispositionField, disposition); -DECLARE_STANDARD_FIELD(pathField, path); -DECLARE_STANDARD_FIELD(messageIdSequenceField, messageIdSequence); - - -#undef DECLARE_STANDARD_FIELD -#undef DECLARE_STANDARD_FIELD_PARAM - - -} // vmime - - -#endif // VMIME_STANDARDFIELDS_HPP_INCLUDED diff --git a/vmime/standardParams.hpp b/vmime/standardParams.hpp deleted file mode 100644 index 45606ef5..00000000 --- a/vmime/standardParams.hpp +++ /dev/null @@ -1,60 +0,0 @@ -// -// VMime library (http://www.vmime.org) -// Copyright (C) 2002-2005 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 2 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. -// - -#ifndef VMIME_STANDARDPARAMS_HPP_INCLUDED -#define VMIME_STANDARDPARAMS_HPP_INCLUDED - - -#include "vmime/genericParameter.hpp" -#include "vmime/defaultParameter.hpp" - -// Inclusion for field value types -#include "vmime/dateTime.hpp" -#include "vmime/charset.hpp" - - -namespace vmime -{ - - -#define DECLARE_STANDARD_PARAM(paramClassName, valueTypeClassName) \ - class paramClassName : public genericParameter { \ - friend class vmime::creator; \ - protected: \ - paramClassName() { } \ - paramClassName(const paramClassName&) \ - : genericParameter () { /* Not used */ } \ - } - - -DECLARE_STANDARD_PARAM(dateParameter, datetime); -DECLARE_STANDARD_PARAM(charsetParameter, charset); - - -#undef DECLARE_STANDARD_PARAM - - -} // vmime - - -#endif // VMIME_STANDARDPARAMS_HPP_INCLUDED