aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorVincent Richard <[email protected]>2014-01-15 23:15:21 +0000
committerVincent Richard <[email protected]>2014-01-15 23:15:21 +0000
commitd0ffbb60e654d39b6e22dc2be1693d9d676c997f (patch)
tree8003bcecb529cbe0f82ccd3a1dfc78a0f1b5f73c /src
parentReset line length after encoding a hard line break in QP encoding. (diff)
downloadvmime-d0ffbb60e654d39b6e22dc2be1693d9d676c997f.tar.gz
vmime-d0ffbb60e654d39b6e22dc2be1693d9d676c997f.zip
Use equivalence instead of strict equality for path components.
Diffstat (limited to 'src')
-rw-r--r--src/vmime/utility/path.cpp9
-rw-r--r--src/vmime/word.cpp6
-rw-r--r--src/vmime/word.hpp8
3 files changed, 18 insertions, 5 deletions
diff --git a/src/vmime/utility/path.cpp b/src/vmime/utility/path.cpp
index 9f746d54..59685866 100644
--- a/src/vmime/utility/path.cpp
+++ b/src/vmime/utility/path.cpp
@@ -134,8 +134,7 @@ bool path::operator==(const path& p) const
bool equal = true;
for ( ; equal && i != m_list.end() ; ++i, ++j)
- //equal = (*i == *j);
- equal = ((*i).getBuffer() == (*j).getBuffer());
+ equal = ((*i).isEquivalent(*j));
return (equal);
}
@@ -197,7 +196,7 @@ bool path::isDirectParentOf(const path& p) const
bool equal = true;
for (list::size_type i = 0 ; equal && i < m_list.size() ; ++i)
- equal = (m_list[i] == p.m_list[i]);
+ equal = (m_list[i].isEquivalent(p.m_list[i]));
return (equal);
}
@@ -211,7 +210,7 @@ bool path::isParentOf(const path& p) const
bool equal = true;
for (list::size_type i = 0 ; equal && i < m_list.size() ; ++i)
- equal = (m_list[i] == p.m_list[i]);
+ equal = (m_list[i].isEquivalent(p.m_list[i]));
return (equal);
}
@@ -226,7 +225,7 @@ void path::renameParent(const path& oldPath, const path& newPath)
list::size_type i;
for (i = 0 ; equal && i < oldPath.m_list.size() ; ++i)
- equal = (m_list[i] == oldPath.m_list[i]);
+ equal = (m_list[i].isEquivalent(oldPath.m_list[i]));
if (i != oldPath.m_list.size())
return;
diff --git a/src/vmime/word.cpp b/src/vmime/word.cpp
index 2ee4d3e7..4b99fbc3 100644
--- a/src/vmime/word.cpp
+++ b/src/vmime/word.cpp
@@ -723,6 +723,12 @@ bool word::operator!=(const word& w) const
}
+bool word::isEquivalent(const word& other) const
+{
+ return getConvertedText(charset(charsets::UTF_8)) == other.getConvertedText(charset(charsets::UTF_8));
+}
+
+
const string word::getConvertedText(const charset& dest, const charsetConverterOptions& opts) const
{
string out;
diff --git a/src/vmime/word.hpp b/src/vmime/word.hpp
index a6e2402e..4122228d 100644
--- a/src/vmime/word.hpp
+++ b/src/vmime/word.hpp
@@ -85,6 +85,14 @@ public:
*/
void setCharset(const charset& ch);
+ /** Returns whether two words actually represent the same text,
+ * regardless of their charset.
+ *
+ * @param other word to compare to
+ * @return true if the two words represent the same text, or false otherwise
+ */
+ bool isEquivalent(const word& other) const;
+
word& operator=(const word& w);
word& operator=(const string& s);