Some fixes for Visual C++/Windows.
This commit is contained in:
parent
433f21263f
commit
d6f67b0a4a
@ -8,6 +8,8 @@ VERSION 0.6.4cvs
|
|||||||
as defined by RFC-3798 and RFC-1892. This is a very first implementation,
|
as defined by RFC-3798 and RFC-1892. This is a very first implementation,
|
||||||
API is subject to changes...
|
API is subject to changes...
|
||||||
|
|
||||||
|
* Some fixes for Visual C++/Windows.
|
||||||
|
|
||||||
2005-03-24 Vincent Richard <vincent@vincent-richard.net>
|
2005-03-24 Vincent Richard <vincent@vincent-richard.net>
|
||||||
|
|
||||||
* Added 'HACKING' file.
|
* Added 'HACKING' file.
|
||||||
|
@ -285,6 +285,8 @@ void propertySet::property::setValue(const string& value)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef VMIME_INLINE_TEMPLATE_SPECIALIZATION
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
void propertySet::property::setValue(const string& value)
|
void propertySet::property::setValue(const string& value)
|
||||||
{
|
{
|
||||||
@ -322,5 +324,7 @@ const bool propertySet::property::getValue() const
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif // VMIME_INLINE_TEMPLATE_SPECIALIZATION
|
||||||
|
|
||||||
|
|
||||||
} // vmime
|
} // vmime
|
||||||
|
@ -25,7 +25,7 @@ namespace vmime
|
|||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
#if !defined(__GNUC__) || ((__GNUC__ >= 3) && (__GNUC_MINOR__ >= 3))
|
#if (!defined(__GNUC__) || ((__GNUC__ >= 3) && (__GNUC_MINOR__ >= 3))) && !defined(_MSC_VER)
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
void typeAdapter <string>::parse(const string& buffer, const string::size_type position,
|
void typeAdapter <string>::parse(const string& buffer, const string::size_type position,
|
||||||
@ -39,7 +39,7 @@ void typeAdapter <string>::parse(const string& buffer, const string::size_type p
|
|||||||
*newPosition = end;
|
*newPosition = end;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // !defined(__GNUC__) || ((__GNUC__ >= 3) && (__GNUC_MINOR__ >= 3))
|
#endif // (!defined(__GNUC__) || ((__GNUC__ >= 3) && (__GNUC_MINOR__ >= 3))) && !defined(_MSC_VER)
|
||||||
|
|
||||||
|
|
||||||
} // vmime
|
} // vmime
|
||||||
|
@ -26,6 +26,13 @@
|
|||||||
#include "vmime/types.hpp"
|
#include "vmime/types.hpp"
|
||||||
|
|
||||||
|
|
||||||
|
// Remove Windows defines of ERROR and WARNING
|
||||||
|
#ifdef WIN32
|
||||||
|
#undef ERROR
|
||||||
|
#undef WARNING
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
namespace vmime
|
namespace vmime
|
||||||
{
|
{
|
||||||
/** Constants for media types. */
|
/** Constants for media types. */
|
||||||
|
@ -75,7 +75,13 @@ public:
|
|||||||
*
|
*
|
||||||
* @param value new value for property
|
* @param value new value for property
|
||||||
*/
|
*/
|
||||||
template <class TYPE> void setValue(const TYPE& value);
|
template <class TYPE> void setValue(const TYPE& value)
|
||||||
|
{
|
||||||
|
std::ostringstream oss;
|
||||||
|
oss << value;
|
||||||
|
|
||||||
|
m_value = oss.str();
|
||||||
|
}
|
||||||
|
|
||||||
/** Get the value of the property as a generic type.
|
/** Get the value of the property as a generic type.
|
||||||
*
|
*
|
||||||
@ -84,7 +90,57 @@ public:
|
|||||||
* converted using std::istringstream)
|
* converted using std::istringstream)
|
||||||
* @return current value of the property
|
* @return current value of the property
|
||||||
*/
|
*/
|
||||||
template <class TYPE> const TYPE getValue() const;
|
template <class TYPE> const TYPE getValue() const
|
||||||
|
{
|
||||||
|
TYPE val = TYPE();
|
||||||
|
|
||||||
|
std::istringstream iss(m_value);
|
||||||
|
iss >> val;
|
||||||
|
|
||||||
|
if (iss.fail())
|
||||||
|
throw exceptions::invalid_property_type();
|
||||||
|
|
||||||
|
return (val);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef VMIME_INLINE_TEMPLATE_SPECIALIZATION
|
||||||
|
|
||||||
|
template <>
|
||||||
|
void propertySet::property::setValue(const string& value)
|
||||||
|
{
|
||||||
|
m_value = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
template <>
|
||||||
|
void propertySet::property::setValue(const bool& value)
|
||||||
|
{
|
||||||
|
m_value = value ? "true" : "false";
|
||||||
|
}
|
||||||
|
|
||||||
|
template <>
|
||||||
|
const string propertySet::property::getValue() const
|
||||||
|
{
|
||||||
|
return (m_value);
|
||||||
|
}
|
||||||
|
|
||||||
|
template <>
|
||||||
|
const bool propertySet::property::getValue() const
|
||||||
|
{
|
||||||
|
if (utility::stringUtils::toLower(m_value) == "true")
|
||||||
|
return true;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
int val = 0;
|
||||||
|
|
||||||
|
std::istringstream iss(m_value);
|
||||||
|
iss >> val;
|
||||||
|
|
||||||
|
return (!iss.fail() && val != 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // VMIME_INLINE_TEMPLATE_SPECIALIZATION
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
@ -300,31 +356,7 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef VMIME_INLINE_TEMPLATE_SPECIALIZATION
|
||||||
template <class TYPE>
|
|
||||||
void propertySet::property::setValue(const TYPE& value)
|
|
||||||
{
|
|
||||||
std::ostringstream oss;
|
|
||||||
oss << value;
|
|
||||||
|
|
||||||
m_value = oss.str();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
template <class TYPE>
|
|
||||||
const TYPE propertySet::property::getValue() const
|
|
||||||
{
|
|
||||||
TYPE val = TYPE();
|
|
||||||
|
|
||||||
std::istringstream iss(m_value);
|
|
||||||
iss >> val;
|
|
||||||
|
|
||||||
if (iss.fail())
|
|
||||||
throw exceptions::invalid_property_type();
|
|
||||||
|
|
||||||
return (val);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
template <> void propertySet::property::setValue(const string& value);
|
template <> void propertySet::property::setValue(const string& value);
|
||||||
template <> void propertySet::property::setValue(const bool& value);
|
template <> void propertySet::property::setValue(const bool& value);
|
||||||
@ -332,6 +364,8 @@ template <> void propertySet::property::setValue(const bool& value);
|
|||||||
template <> const string propertySet::property::getValue() const;
|
template <> const string propertySet::property::getValue() const;
|
||||||
template <> const bool propertySet::property::getValue() const;
|
template <> const bool propertySet::property::getValue() const;
|
||||||
|
|
||||||
|
#endif // VMIME_INLINE_TEMPLATE_SPECIALIZATION
|
||||||
|
|
||||||
|
|
||||||
} // vmime
|
} // vmime
|
||||||
|
|
||||||
|
@ -123,7 +123,7 @@ private:
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
#if defined(__GNUC__) && (__GNUC__ >= 3) && (__GNUC_MINOR__ <= 2)
|
#if (defined(__GNUC__) && (__GNUC__ >= 3) && (__GNUC_MINOR__ <= 2)) || defined(_MSC_VER)
|
||||||
|
|
||||||
// Because of a bug with g++ <= 3.2, we have to put the implementation
|
// Because of a bug with g++ <= 3.2, we have to put the implementation
|
||||||
// of the function inline.
|
// of the function inline.
|
||||||
@ -146,7 +146,7 @@ private:
|
|||||||
(const string& buffer, const string::size_type position,
|
(const string& buffer, const string::size_type position,
|
||||||
const string::size_type end, string::size_type* newPosition);
|
const string::size_type end, string::size_type* newPosition);
|
||||||
|
|
||||||
#endif // defined(__GNUC__) && (__GNUC__ >= 3) && (__GNUC_MINOR__ <= 2)
|
#endif // (defined(__GNUC__) && (__GNUC__ >= 3) && (__GNUC_MINOR__ <= 2)) || defined(_MSC_VER)
|
||||||
|
|
||||||
|
|
||||||
} // vmime
|
} // vmime
|
||||||
|
Loading…
Reference in New Issue
Block a user