Allow creating 'charset' objects from 'const char*' (for constants).

This commit is contained in:
Vincent Richard 2005-07-20 20:32:48 +00:00
parent 6c324d55ec
commit 0562415aeb
2 changed files with 7 additions and 18 deletions

View File

@ -67,6 +67,12 @@ charset::charset(const string& name)
}
charset::charset(const char* name)
: m_name(name)
{
}
void charset::parse(const string& buffer, const string::size_type position,
const string::size_type end, string::size_type* newPosition)
{
@ -89,16 +95,6 @@ void charset::generate(utility::outputStream& os, const string::size_type /* max
}
struct X
{
X(const char**);
operator const char**() { return x; }
operator char**() { return const_cast <char**>(x); }
const char** x;
};
void charset::convert(utility::inputStream& in, utility::outputStream& out,
const charset& source, const charset& dest)
{
@ -261,13 +257,6 @@ charset& charset::operator=(const charset& other)
}
charset& charset::operator=(const string& name)
{
parse(name);
return (*this);
}
const bool charset::operator==(const charset& value) const
{
return (utility::stringUtils::isStringEqualNoCase(m_name, value.m_name));

View File

@ -38,6 +38,7 @@ public:
charset();
charset(const string& name);
charset(const char* name); // to allow creation from vmime::charsets constants
public:
@ -48,7 +49,6 @@ public:
const string& getName() const;
charset& operator=(const charset& other);
charset& operator=(const string& name);
const bool operator==(const charset& value) const;
const bool operator!=(const charset& value) const;