summaryrefslogtreecommitdiff
path: root/tools/source/inet/inetmime.cxx
diff options
context:
space:
mode:
authorChr. Rossmanith <ChrRossmanith@gmx.de>2014-05-08 12:00:30 +0200
committerStephan Bergmann <sbergman@redhat.com>2014-05-09 16:01:30 +0200
commit2c9d68ff56d02350eda752d699f5ba0425e06142 (patch)
treee20bd75d3ce7b42de192ebbfaca66aa86a53a436 /tools/source/inet/inetmime.cxx
parent797c8e71e9c7e0e99d3aa396804d2e56b1740f4f (diff)
move INetContentTypes::scan() to INetMIME::scanContentType()
to avoid circular dependencies between svl and tools when using INetContentType::scan functionality for future handling of data urls in urlobj.cxx Change-Id: Iad13286769e8906aebf8208e4f532151ff2f3d13 Signed-off-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'tools/source/inet/inetmime.cxx')
-rw-r--r--tools/source/inet/inetmime.cxx42
1 files changed, 42 insertions, 0 deletions
diff --git a/tools/source/inet/inetmime.cxx b/tools/source/inet/inetmime.cxx
index 98f146823a72..ff67d01d2a20 100644
--- a/tools/source/inet/inetmime.cxx
+++ b/tools/source/inet/inetmime.cxx
@@ -956,6 +956,48 @@ sal_Unicode const * INetMIME::scanParameters(sal_Unicode const * pBegin,
}
// static
+sal_Unicode const * INetMIME::scanContentType(
+ sal_Unicode const * pBegin, sal_Unicode const * pEnd, OUString * pType,
+ OUString * pSubType, INetContentTypeParameterList * pParameters)
+{
+ sal_Unicode const * p = INetMIME::skipLinearWhiteSpaceComment(pBegin, pEnd);
+ sal_Unicode const * pTypeBegin = p;
+ while (p != pEnd && INetMIME::isTokenChar(*p))
+ {
+ ++p;
+ }
+ if (p == pTypeBegin)
+ return 0;
+ sal_Unicode const * pTypeEnd = p;
+
+ p = INetMIME::skipLinearWhiteSpaceComment(p, pEnd);
+ if (p == pEnd || *p++ != '/')
+ return 0;
+
+ p = INetMIME::skipLinearWhiteSpaceComment(p, pEnd);
+ sal_Unicode const * pSubTypeBegin = p;
+ while (p != pEnd && INetMIME::isTokenChar(*p))
+ {
+ ++p;
+ }
+ if (p == pSubTypeBegin)
+ return 0;
+ sal_Unicode const * pSubTypeEnd = p;
+
+ if (pType != 0)
+ {
+ *pType = OUString(pTypeBegin, pTypeEnd - pTypeBegin).toAsciiLowerCase();
+ }
+ if (pSubType != 0)
+ {
+ *pSubType = OUString(pSubTypeBegin, pSubTypeEnd - pSubTypeBegin)
+ .toAsciiLowerCase();
+ }
+
+ return INetMIME::scanParameters(p, pEnd, pParameters);
+}
+
+// static
const sal_Char * INetMIME::getCharsetName(rtl_TextEncoding eEncoding)
{
if (rtl_isOctetTextEncoding(eEncoding))