diff options
author | Norbert Thiebaud <nthiebaud@gmail.com> | 2015-07-15 20:41:18 -0500 |
---|---|---|
committer | Norbert Thiebaud <nthiebaud@gmail.com> | 2015-07-15 22:28:42 -0500 |
commit | ec243f43411290bb7f56176e29cb92929dab2953 (patch) | |
tree | 78d1e3d4b0e86b1246f035ca60f94b29e5254f84 /include/tools | |
parent | 578969c51cb7b012fb522d4296c8069a611de29d (diff) |
Revert "tools: replace boost::ptr_vector with std::unordered_map"
This reverts commit 218be53fe00aebed43df0b041de609b30f99ce95.
MacOSX breaker
Diffstat (limited to 'include/tools')
-rw-r--r-- | include/tools/inetmime.hxx | 148 |
1 files changed, 77 insertions, 71 deletions
diff --git a/include/tools/inetmime.hxx b/include/tools/inetmime.hxx index f1b2081bb6b2..57666605b2f0 100644 --- a/include/tools/inetmime.hxx +++ b/include/tools/inetmime.hxx @@ -19,6 +19,8 @@ #ifndef INCLUDED_TOOLS_INETMIME_HXX #define INCLUDED_TOOLS_INETMIME_HXX +#include <boost/ptr_container/ptr_vector.hpp> + #include <tools/toolsdllapi.h> #include <rtl/alloc.h> #include <rtl/character.hxx> @@ -29,81 +31,11 @@ #include <tools/debug.hxx> #include <tools/errcode.hxx> -#include <unordered_map> - class DateTime; +class INetContentTypeParameterList; class INetMIMECharsetList_Impl; class INetMIMEOutputSink; -struct INetContentTypeParameter -{ - /** The name of the attribute, in US-ASCII encoding and converted to lower - case. If a parameter value is split as described in RFC 2231, there - will only be one item for the complete parameter, with the attribute - name lacking any section suffix. - */ - const OString m_sAttribute; - - /** The optional character set specification (see RFC 2231), in US-ASCII - encoding and converted to lower case. - */ - const OString m_sCharset; - - /** The optional language specification (see RFC 2231), in US-ASCII - encoding and converted to lower case. - */ - const OString m_sLanguage; - - /** The attribute value. If the value is a quoted-string, it is - 'unpacked.' If a character set is specified, and the value can be - converted to Unicode, this is done. Also, if no character set is - specified, it is first tried to convert the value from UTF-8 encoding - to Unicode, and if that doesn't work (because the value is not in - UTF-8 encoding), it is converted from ISO-8859-1 encoding to Unicode - (which will always work). But if a character set is specified and the - value cannot be converted from that character set to Unicode, special - action is taken to produce a value that can possibly be transformed - back into its original form: Any 8-bit character from a non-encoded - part of the original value is directly converted to Unicode - (effectively handling it as if it was ISO-8859-1 encoded), and any - 8-bit character from an encoded part of the original value is mapped - to the range U+F800..U+F8FF at the top of the Corporate Use Subarea - within Unicode's Private Use Area (effectively adding 0xF800 to the - character's numeric value). - */ - const OUString m_sValue; - - /** This is true if the value is successfully converted to Unicode, and - false if the value is a special mixture of ISO-LATIN-1 characters and - characters from Unicode's Private Use Area. - */ - const bool m_bConverted; - - INetContentTypeParameter(const OString& rTheAttribute, - const OString& rTheCharset, const OString& rTheLanguage, - const OUString& rTheValue, bool bTheConverted) - : m_sAttribute(rTheAttribute) - , m_sCharset(rTheCharset) - , m_sLanguage(rTheLanguage) - , m_sValue(rTheValue) - , m_bConverted(bTheConverted) - { - } -}; - -struct OString_equalsIgnoreAsciiCase -{ - bool operator()(const OString& r1, const OString& r2) const - { - return r1.equalsIgnoreAsciiCase(r2); - } -}; - -// the key is the m_sAttribute again -typedef std::unordered_map<OString, INetContentTypeParameter, OStringHash, - OString_equalsIgnoreAsciiCase> INetContentTypeParameterList; - - class TOOLS_DLLPUBLIC INetMIME { public: @@ -1003,6 +935,80 @@ inline bool INetMIMEEncodedWordOutputSink::flush() return m_ePrevCoding != CODING_NONE; } +struct INetContentTypeParameter +{ + /** The name of the attribute, in US-ASCII encoding and converted to lower + case. If a parameter value is split as described in RFC 2231, there + will only be one item for the complete parameter, with the attribute + name lacking any section suffix. + */ + const OString m_sAttribute; + + /** The optional character set specification (see RFC 2231), in US-ASCII + encoding and converted to lower case. + */ + const OString m_sCharset; + + /** The optional language specification (see RFC 2231), in US-ASCII + encoding and converted to lower case. + */ + const OString m_sLanguage; + + /** The attribute value. If the value is a quoted-string, it is + 'unpacked.' If a character set is specified, and the value can be + converted to Unicode, this is done. Also, if no character set is + specified, it is first tried to convert the value from UTF-8 encoding + to Unicode, and if that doesn't work (because the value is not in + UTF-8 encoding), it is converted from ISO-8859-1 encoding to Unicode + (which will always work). But if a character set is specified and the + value cannot be converted from that character set to Unicode, special + action is taken to produce a value that can possibly be transformed + back into its original form: Any 8-bit character from a non-encoded + part of the original value is directly converted to Unicode + (effectively handling it as if it was ISO-8859-1 encoded), and any + 8-bit character from an encoded part of the original value is mapped + to the range U+F800..U+F8FF at the top of the Corporate Use Subarea + within Unicode's Private Use Area (effectively adding 0xF800 to the + character's numeric value). + */ + const OUString m_sValue; + + /** This is true if the value is successfully converted to Unicode, and + false if the value is a special mixture of ISO-LATIN-1 characters and + characters from Unicode's Private Use Area. + */ + const bool m_bConverted; + + INetContentTypeParameter(const OString& rTheAttribute, + const OString& rTheCharset, const OString& rTheLanguage, + const OUString& rTheValue, bool bTheConverted) + : m_sAttribute(rTheAttribute) + , m_sCharset(rTheCharset) + , m_sLanguage(rTheLanguage) + , m_sValue(rTheValue) + , m_bConverted(bTheConverted) + { + } +}; + +class TOOLS_DLLPUBLIC INetContentTypeParameterList +{ +public: + + void Clear(); + + void Append(INetContentTypeParameter *pParameter) + { + maEntries.push_back(pParameter); + } + + const INetContentTypeParameter * find(const OString& rAttribute) const; + +private: + + boost::ptr_vector<INetContentTypeParameter> maEntries; +}; + #endif /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |