diff options
author | Vincent Richard <[email protected]> | 2005-11-06 16:12:41 +0000 |
---|---|---|
committer | Vincent Richard <[email protected]> | 2005-11-06 16:12:41 +0000 |
commit | c179a1006858e22a7511e7e1f23f8d0e7d948b42 (patch) | |
tree | 6d7361de38ad2a4751ba75292003c646c827a46d | |
parent | Fixed typos in documentation. (diff) | |
download | vmime-c179a1006858e22a7511e7e1f23f8d0e7d948b42.tar.gz vmime-c179a1006858e22a7511e7e1f23f8d0e7d948b42.zip |
Refactored header field values and parameters.
-rw-r--r-- | vmime/genericField.hpp | 109 | ||||
-rw-r--r-- | vmime/genericParameter.hpp | 109 | ||||
-rw-r--r-- | vmime/standardFields.hpp | 114 | ||||
-rw-r--r-- | vmime/standardParams.hpp | 60 |
4 files changed, 0 insertions, 392 deletions
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 <[email protected]> -// -// 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 VALUE_TYPE> -class genericField : virtual public headerField -{ - friend class vmime::creator; // create ref - -protected: - - genericField() : m_value(vmime::create <VALUE_TYPE>()) { } - - - const ref <const component> getValueImp() const - { - return (m_value); - } - - ref <component> getValueImp() - { - return (m_value); - } - -public: - - genericField <VALUE_TYPE>& operator=(const genericField <VALUE_TYPE>& other) - { - copyFrom(other); - return (*this); - } - - template <class TYPE> - 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 <const VALUE_TYPE&>(value); - *m_value = v; - } - -private: - - ref <VALUE_TYPE> m_value; -}; - - -/** Generic implementation for headerField with a value of type 'string'. - */ - -template <> -class genericField <string> : public genericField <typeAdapter <string> > -{ -}; - - -} // 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 <[email protected]> -// -// 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 VALUE_TYPE> -class genericParameter : public parameter -{ - friend class vmime::creator; // create ref - -protected: - - genericParameter() : m_value(vmime::create <VALUE_TYPE>()) { } - - - const ref <const component> getValueImp() const - { - return m_value; - } - - const ref <component> getValueImp() - { - return m_value; - } - -public: - - genericParameter <VALUE_TYPE>& operator=(const genericParameter <VALUE_TYPE>& other) - { - copyFrom(other); - return (*this); - } - - const VALUE_TYPE& getValue() const - { - return (*m_value); - } - - VALUE_TYPE& getValue() - { - return (*m_value); - } - - template <class TYPE> - void setValue(const TYPE& value) - { - *m_value = value; - } - - void setValue(const component& value) - { - const VALUE_TYPE& v = dynamic_cast <const VALUE_TYPE&>(value); - *m_value = v; - } - -private: - - ref <VALUE_TYPE> m_value; -}; - - -/** Generic implementation for parameter of type 'string'. - */ - -template <> -class genericParameter <string> : public genericParameter <typeAdapter <string> > -{ -}; - - -} // 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 <[email protected]> -// -// 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 <valueTypeClassName> { \ - friend class vmime::creator; \ - protected: \ - fieldClassName() { } \ - fieldClassName(const fieldClassName&) \ - : headerField(), \ - genericField <valueTypeClassName>() { /* Not used */ } \ - } - -#ifdef VMIME_NO_MULTIPLE_INHERITANCE - - template <class TYPE> - class genericParameterizedHeaderField : public genericField <TYPE> - { - }; - - #define DECLARE_STANDARD_FIELD_PARAM(fieldClassName, valueTypeClassName) \ - class fieldClassName : public genericParameterizedHeaderField <valueTypeClassName> { \ - friend class vmime::creator; \ - protected: \ - fieldClassName() { } \ - fieldClassName(const fieldClassName&) \ - : headerField(), \ - genericParameterizedHeaderField <valueTypeClassName>() { /* Not used */ } \ - } - -#else // VMIME_NO_MULTIPLE_INHERITANCE - - #define DECLARE_STANDARD_FIELD_PARAM(fieldClassName, valueTypeClassName) \ - class fieldClassName : public genericField <valueTypeClassName>, \ - public parameterizedHeaderField { \ - friend class vmime::creator; \ - protected: \ - fieldClassName() { } \ - fieldClassName(const fieldClassName&) \ - : headerField(), \ - genericField <valueTypeClassName>(), \ - 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 <[email protected]> -// -// 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 <valueTypeClassName> { \ - friend class vmime::creator; \ - protected: \ - paramClassName() { } \ - paramClassName(const paramClassName&) \ - : genericParameter <valueTypeClassName>() { /* Not used */ } \ - } - - -DECLARE_STANDARD_PARAM(dateParameter, datetime); -DECLARE_STANDARD_PARAM(charsetParameter, charset); - - -#undef DECLARE_STANDARD_PARAM - - -} // vmime - - -#endif // VMIME_STANDARDPARAMS_HPP_INCLUDED |