summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/svl/inettype.hxx35
-rw-r--r--include/tools/inetmime.hxx35
-rw-r--r--svl/qa/unit/test_INetContentType.cxx6
-rw-r--r--svl/source/misc/inettype.cxx45
-rw-r--r--tools/source/inet/inetmime.cxx42
-rw-r--r--ucb/source/core/FileAccess.cxx4
6 files changed, 84 insertions, 83 deletions
diff --git a/include/svl/inettype.hxx b/include/svl/inettype.hxx
index b09261eb0dcd..8f251acae5b9 100644
--- a/include/svl/inettype.hxx
+++ b/include/svl/inettype.hxx
@@ -251,41 +251,6 @@ public:
static bool GetExtensionFromURL(OUString const & rURL, OUString & rExtension);
- /** Parse the body of an RFC 2045 Content-Type header field.
-
- @param pBegin The range (that must be valid) from non-null pBegin,
- inclusive. to non-null pEnd, exclusive, forms the body of the
- Content-Type header field. It must be of the form
-
- token "/" token *(";" token "=" (token / quoted-string))
-
- with intervening linear white space and comments (cf. RFCs 822, 2045).
- The RFC 2231 extension are supported. The encoding of rMediaType
- should be US-ASCII, but any Unicode values in the range U+0080..U+FFFF
- are interpretet 'as appropriate.'
-
- @param pType If not null, returns the type (the first of the above
- tokens), in US-ASCII encoding and converted to lower case.
-
- @param pSubType If not null, returns the sub-type (the second of the
- above tokens), in US-ASCII encoding and converted to lower case.
-
- @param pParameters If not null, returns the parameters as a list of
- INetContentTypeParameters (the attributes are in US-ASCII encoding and
- converted to lower case, the values are in Unicode encoding). If
- null, only the syntax of the parameters is checked, but they are not
- returned.
-
- @return Null if the syntax of the field body is incorrect (i.e., does
- not start with type and sub-type tokens). Otherwise, a pointer past the
- longest valid input prefix. If null is returned, none of the output
- parameters will be modified.
- */
- static sal_Unicode const * scan(
- sal_Unicode const *pBegin, sal_Unicode const * pEnd,
- OUString * pType = 0, OUString * pSubType = 0,
- INetContentTypeParameterList * pParameters = 0);
-
static bool parse(OUString const & rMediaType, OUString & rType,
OUString & rSubType,
INetContentTypeParameterList * pParameters = 0);
diff --git a/include/tools/inetmime.hxx b/include/tools/inetmime.hxx
index 04b3141c020d..7190c386d0de 100644
--- a/include/tools/inetmime.hxx
+++ b/include/tools/inetmime.hxx
@@ -356,6 +356,41 @@ public:
INetContentTypeParameterList *
pParameters);
+ /** Parse the body of an RFC 2045 Content-Type header field.
+
+ @param pBegin The range (that must be valid) from non-null pBegin,
+ inclusive. to non-null pEnd, exclusive, forms the body of the
+ Content-Type header field. It must be of the form
+
+ token "/" token *(";" token "=" (token / quoted-string))
+
+ with intervening linear white space and comments (cf. RFCs 822, 2045).
+ The RFC 2231 extension are supported. The encoding of rMediaType
+ should be US-ASCII, but any Unicode values in the range U+0080..U+FFFF
+ are interpretet 'as appropriate.'
+
+ @param pType If not null, returns the type (the first of the above
+ tokens), in US-ASCII encoding and converted to lower case.
+
+ @param pSubType If not null, returns the sub-type (the second of the
+ above tokens), in US-ASCII encoding and converted to lower case.
+
+ @param pParameters If not null, returns the parameters as a list of
+ INetContentTypeParameters (the attributes are in US-ASCII encoding and
+ converted to lower case, the values are in Unicode encoding). If
+ null, only the syntax of the parameters is checked, but they are not
+ returned.
+
+ @return Null if the syntax of the field body is incorrect (i.e., does
+ not start with type and sub-type tokens). Otherwise, a pointer past the
+ longest valid input prefix. If null is returned, none of the output
+ parameters will be modified.
+ */
+ static sal_Unicode const * scanContentType(
+ sal_Unicode const *pBegin, sal_Unicode const * pEnd,
+ OUString * pType = 0, OUString * pSubType = 0,
+ INetContentTypeParameterList * pParameters = 0);
+
static inline rtl_TextEncoding translateToMIME(rtl_TextEncoding
eEncoding);
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) {
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))
diff --git a/ucb/source/core/FileAccess.cxx b/ucb/source/core/FileAccess.cxx
index 158caeb0d06b..8c96d49cd2a8 100644
--- a/ucb/source/core/FileAccess.cxx
+++ b/ucb/source/core/FileAccess.cxx
@@ -434,11 +434,11 @@ OUString OFileAccess::getContentType( const OUString& FileURL )
return aTypeStr;
}
-DateTime OFileAccess::getDateTimeModified( const OUString& FileURL )
+::com::sun::star::util::DateTime OFileAccess::getDateTimeModified( const OUString& FileURL )
throw(CommandAbortedException, Exception, RuntimeException, std::exception)
{
INetURLObject aFileObj( FileURL, INET_PROT_FILE );
- DateTime aDateTime;
+ ::com::sun::star::util::DateTime aDateTime;
Reference< XCommandEnvironment > aCmdEnv;
ucbhelper::Content aYoung( aFileObj.GetMainURL( INetURLObject::NO_DECODE ), aCmdEnv, comphelper::getProcessComponentContext() );