aboutsummaryrefslogtreecommitdiffstats
path: root/src/messageId.cpp
diff options
context:
space:
mode:
authorVincent Richard <[email protected]>2005-03-27 13:06:45 +0000
committerVincent Richard <[email protected]>2005-03-27 13:06:45 +0000
commit4ab9332ce6269807edb45e69f7e6000aa40d4478 (patch)
tree6f5e4e583ff7d7b88e62dac7b81a90c129a7d3b9 /src/messageId.cpp
parentSome fixes for Visual C++/Windows. (diff)
downloadvmime-4ab9332ce6269807edb45e69f7e6000aa40d4478.tar.gz
vmime-4ab9332ce6269807edb45e69f7e6000aa40d4478.zip
Added new basic type 'messageIdSequence'.
Diffstat (limited to 'src/messageId.cpp')
-rw-r--r--src/messageId.cpp43
1 files changed, 41 insertions, 2 deletions
diff --git a/src/messageId.cpp b/src/messageId.cpp
index 815266d5..9e878c2f 100644
--- a/src/messageId.cpp
+++ b/src/messageId.cpp
@@ -129,19 +129,58 @@ void messageId::parse(const string& buffer, const string::size_type position,
}
+messageId* messageId::parseNext(const string& buffer, const string::size_type position,
+ const string::size_type end, string::size_type* newPosition)
+{
+ string::size_type pos = position;
+
+ while (pos < end && parserHelpers::isSpace(buffer[pos]))
+ ++pos;
+
+ if (pos != end)
+ {
+ const string::size_type begin = pos;
+
+ while (pos < end && !parserHelpers::isSpace(buffer[pos]))
+ ++pos;
+
+ messageId* mid = new messageId();
+ mid->parse(buffer, begin, pos, NULL);
+
+ if (newPosition != NULL)
+ *newPosition = pos;
+
+ return (mid);
+ }
+
+ if (newPosition != NULL)
+ *newPosition = end;
+
+ return (NULL);
+}
+
+
const string messageId::getId() const
{
return (m_left + '@' + m_right);
}
-void messageId::generate(utility::outputStream& os, const string::size_type /* maxLineLength */,
+void messageId::generate(utility::outputStream& os, const string::size_type maxLineLength,
const string::size_type curLinePos, string::size_type* newLinePos) const
{
+ string::size_type pos = curLinePos;
+
+ if (curLinePos + m_left.length() + m_right.length() + 3 > maxLineLength)
+ {
+ os << NEW_LINE_SEQUENCE;
+ pos = NEW_LINE_SEQUENCE_LENGTH;
+ }
+
os << '<' << m_left << '@' << m_right << '>';
if (newLinePos)
- *newLinePos = curLinePos + m_left.length() + m_right.length() + 3;
+ *newLinePos = pos + m_left.length() + m_right.length() + 3;
}