diff options
author | Chr. Rossmanith <ChrRossmanith@gmx.de> | 2014-05-08 12:00:30 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2014-05-09 16:01:30 +0200 |
commit | 2c9d68ff56d02350eda752d699f5ba0425e06142 (patch) | |
tree | e20bd75d3ce7b42de192ebbfaca66aa86a53a436 /svl | |
parent | 797c8e71e9c7e0e99d3aa396804d2e56b1740f4f (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 'svl')
-rw-r--r-- | svl/qa/unit/test_INetContentType.cxx | 6 | ||||
-rw-r--r-- | svl/source/misc/inettype.cxx | 45 |
2 files changed, 5 insertions, 46 deletions
diff --git a/svl/qa/unit/test_INetContentType.cxx b/svl/qa/unit/test_INetContentType.cxx index a2ce362a10a0..b7aa71cd6e66 100644 --- a/svl/qa/unit/test_INetContentType.cxx +++ b/svl/qa/unit/test_INetContentType.cxx @@ -41,7 +41,7 @@ void Test::testBad() { OUString in("foo=bar"); CPPUNIT_ASSERT_EQUAL( static_cast<sal_Unicode const *>(0), - INetContentTypes::scan(in.getStr(), in.getStr() + in.getLength())); + INetMIME::scanContentType(in.getStr(), in.getStr() + in.getLength())); OUString t; OUString s; INetContentTypeParameterList ps; @@ -56,7 +56,7 @@ void Test::testFull() { OUString in("foo/bar;baz=boz"); CPPUNIT_ASSERT_EQUAL( in.getStr() + in.getLength(), - INetContentTypes::scan(in.getStr(), in.getStr() + in.getLength())); + INetMIME::scanContentType(in.getStr(), in.getStr() + in.getLength())); OUString t; OUString s; INetContentTypeParameterList ps; @@ -72,7 +72,7 @@ void Test::testFollow() { OUString in("foo/bar;baz=boz;base64,"); CPPUNIT_ASSERT_EQUAL( in.getStr() + std::strlen("foo/bar;baz=boz"), - INetContentTypes::scan(in.getStr(), in.getStr() + in.getLength())); + INetMIME::scanContentType(in.getStr(), in.getStr() + in.getLength())); OUString t; OUString s; INetContentTypeParameterList ps; diff --git a/svl/source/misc/inettype.cxx b/svl/source/misc/inettype.cxx index bfd812e3da15..074889c05cd2 100644 --- a/svl/source/misc/inettype.cxx +++ b/svl/source/misc/inettype.cxx @@ -18,6 +18,7 @@ */ #include <tools/wldcrd.hxx> +#include <tools/inetmime.hxx> #include <rtl/instance.hxx> #include <svl/inettype.hxx> #include <svl/svl.hrc> @@ -778,48 +779,6 @@ bool INetContentTypes::GetExtensionFromURL(OUString const & rURL, return false; } -// static -sal_Unicode const * INetContentTypes::scan( - 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); -} - bool INetContentTypes::parse( OUString const & rMediaType, OUString & rType, OUString & rSubType, INetContentTypeParameterList * pParameters) @@ -829,7 +788,7 @@ bool INetContentTypes::parse( OUString t; OUString s; INetContentTypeParameterList p; - if (scan(b, e, &t, &s, pParameters == 0 ? 0 : &p) == e) { + if (INetMIME::scanContentType(b, e, &t, &s, pParameters == 0 ? 0 : &p) == e) { rType = t; rSubType = s; if (pParameters != 0) { |