diff options
author | Oliver Bolte <obo@openoffice.org> | 2004-03-19 12:21:57 +0000 |
---|---|---|
committer | Oliver Bolte <obo@openoffice.org> | 2004-03-19 12:21:57 +0000 |
commit | 100c6467d70eb59ac05f837a2244ea9a5193330d (patch) | |
tree | 0208b65fbef3b787f801c260dc2ebff977ecc8ad /stoc | |
parent | f2855525d69370d9db0003d8c7c472d5f47fceb9 (diff) |
INTEGRATION: CWS sb15 (1.2.14); FILE MERGED
2004/02/25 16:01:02 sb 1.2.14.1: #i24436# Adapted to new XVndSunStarScriptUrlReference; changed stoc::uriproc::UriReference from a base class to an implementation helper class.
Diffstat (limited to 'stoc')
-rw-r--r-- | stoc/source/uriproc/UriReference.hxx | 70 | ||||
-rw-r--r-- | stoc/source/uriproc/UriReferenceFactory.cxx | 95 | ||||
-rw-r--r-- | stoc/source/uriproc/UriSchemeParser_vndDOTsunDOTstarDOTscript.cxx | 138 | ||||
-rw-r--r-- | stoc/source/uriproc/makefile.mk | 6 |
4 files changed, 203 insertions, 106 deletions
diff --git a/stoc/source/uriproc/UriReference.hxx b/stoc/source/uriproc/UriReference.hxx index 4faf5d197479..5f761598c7b7 100644 --- a/stoc/source/uriproc/UriReference.hxx +++ b/stoc/source/uriproc/UriReference.hxx @@ -2,9 +2,9 @@ * * $RCSfile: UriReference.hxx,v $ * - * $Revision: 1.2 $ + * $Revision: 1.3 $ * - * last change: $Author: kz $ $Date: 2004-01-19 18:28:41 $ + * last change: $Author: obo $ $Date: 2004-03-19 13:21:17 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -63,8 +63,6 @@ #define INCLUDED_stoc_source_uriproc_UriReference_hxx #include "com/sun/star/uno/RuntimeException.hpp" -#include "com/sun/star/uri/XUriReference.hpp" -#include "cppuhelper/implbase1.hxx" #include "osl/mutex.hxx" #include "rtl/ustring.hxx" #include "sal/types.h" @@ -73,77 +71,53 @@ namespace rtl { class OUStringBuffer; } namespace stoc { namespace uriproc { -class UriReference: - public cppu::WeakImplHelper1< com::sun::star::uri::XUriReference > -{ +class UriReference { public: UriReference( rtl::OUString const & scheme, bool isHierarchical, bool hasAuthority, rtl::OUString const & authority, rtl::OUString const & path, bool hasQuery, rtl::OUString const & query); - virtual rtl::OUString SAL_CALL getUriReference() - throw (com::sun::star::uno::RuntimeException); + ~UriReference(); - virtual sal_Bool SAL_CALL isAbsolute() + rtl::OUString getUriReference() throw (com::sun::star::uno::RuntimeException); - virtual rtl::OUString SAL_CALL getScheme() - throw (com::sun::star::uno::RuntimeException); + sal_Bool isAbsolute() throw (com::sun::star::uno::RuntimeException); - virtual rtl::OUString SAL_CALL getSchemeSpecificPart() - throw (com::sun::star::uno::RuntimeException); + rtl::OUString getScheme() throw (com::sun::star::uno::RuntimeException); - virtual sal_Bool SAL_CALL isHierarchical() + rtl::OUString getSchemeSpecificPart() throw (com::sun::star::uno::RuntimeException); - virtual sal_Bool SAL_CALL hasAuthority() - throw (com::sun::star::uno::RuntimeException); + sal_Bool isHierarchical() throw (com::sun::star::uno::RuntimeException); - virtual rtl::OUString SAL_CALL getAuthority() - throw (com::sun::star::uno::RuntimeException); + sal_Bool hasAuthority() throw (com::sun::star::uno::RuntimeException); - virtual rtl::OUString SAL_CALL getPath() - throw (com::sun::star::uno::RuntimeException); + rtl::OUString getAuthority() throw (com::sun::star::uno::RuntimeException); - virtual sal_Bool SAL_CALL hasRelativePath() - throw (com::sun::star::uno::RuntimeException); + rtl::OUString getPath() throw (com::sun::star::uno::RuntimeException); - virtual sal_Int32 SAL_CALL getPathSegmentCount() - throw (com::sun::star::uno::RuntimeException); + sal_Bool hasRelativePath() throw (com::sun::star::uno::RuntimeException); - virtual rtl::OUString SAL_CALL getPathSegment(sal_Int32 index) + sal_Int32 getPathSegmentCount() throw (com::sun::star::uno::RuntimeException); - virtual sal_Bool SAL_CALL hasQuery() + rtl::OUString getPathSegment(sal_Int32 index) throw (com::sun::star::uno::RuntimeException); - virtual rtl::OUString SAL_CALL getQuery() - throw (com::sun::star::uno::RuntimeException); + sal_Bool hasQuery() throw (com::sun::star::uno::RuntimeException); - virtual sal_Bool SAL_CALL hasFragment() - throw (com::sun::star::uno::RuntimeException); + rtl::OUString getQuery() throw (com::sun::star::uno::RuntimeException); - virtual rtl::OUString SAL_CALL getFragment() - throw (com::sun::star::uno::RuntimeException); + sal_Bool hasFragment() throw (com::sun::star::uno::RuntimeException); - virtual void SAL_CALL setFragment(rtl::OUString const & fragment) - throw (com::sun::star::uno::RuntimeException); + rtl::OUString getFragment() throw (com::sun::star::uno::RuntimeException); - virtual void SAL_CALL clearFragment() + void setFragment(rtl::OUString const & fragment) throw (com::sun::star::uno::RuntimeException); -protected: - UriReference(); - - virtual ~UriReference(); - - void initialize( - rtl::OUString const & scheme, bool isHierarchical, bool hasAuthority, - rtl::OUString const & authority, rtl::OUString const & path, - bool hasQuery, rtl::OUString const & query); - - void appendSchemeSpecificPart(rtl::OUStringBuffer & buffer) const; + void clearFragment() throw (com::sun::star::uno::RuntimeException); osl::Mutex m_mutex; rtl::OUString m_scheme; @@ -159,6 +133,8 @@ protected: private: UriReference(UriReference &); // not implemented void operator =(UriReference); // not implemented + + void appendSchemeSpecificPart(rtl::OUStringBuffer & buffer) const; }; } } diff --git a/stoc/source/uriproc/UriReferenceFactory.cxx b/stoc/source/uriproc/UriReferenceFactory.cxx index a4b9a6c369d8..e52b6f79f5ec 100644 --- a/stoc/source/uriproc/UriReferenceFactory.cxx +++ b/stoc/source/uriproc/UriReferenceFactory.cxx @@ -2,9 +2,9 @@ * * $RCSfile: UriReferenceFactory.cxx,v $ * - * $Revision: 1.2 $ + * $Revision: 1.3 $ * - * last change: $Author: kz $ $Date: 2004-01-19 18:28:58 $ + * last change: $Author: obo $ $Date: 2004-03-19 13:21:31 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -78,6 +78,7 @@ #include "com/sun/star/uri/XUriReference.hpp" #include "com/sun/star/uri/XUriReferenceFactory.hpp" #include "com/sun/star/uri/XUriSchemeParser.hpp" +#include "cppuhelper/implbase1.hxx" #include "cppuhelper/implbase2.hxx" #include "cppuhelper/weak.hxx" #include "osl/diagnose.h" @@ -162,6 +163,94 @@ sal_Int32 parseScheme(rtl::OUString const & uriReference) { return -1; } +class UriReference: public cppu::WeakImplHelper1< css::uri::XUriReference > { +public: + UriReference( + rtl::OUString const & scheme, bool isHierarchical, bool hasAuthority, + rtl::OUString const & authority, rtl::OUString const & path, + bool hasQuery, rtl::OUString const & query): + m_base( + scheme, isHierarchical, hasAuthority, authority, path, hasQuery, + query) + {} + + virtual rtl::OUString SAL_CALL getUriReference() + throw (com::sun::star::uno::RuntimeException) + { return m_base.getUriReference(); } + + virtual sal_Bool SAL_CALL isAbsolute() + throw (com::sun::star::uno::RuntimeException) + { return m_base.isAbsolute(); } + + virtual rtl::OUString SAL_CALL getScheme() + throw (com::sun::star::uno::RuntimeException) + { return m_base.getScheme(); } + + virtual rtl::OUString SAL_CALL getSchemeSpecificPart() + throw (com::sun::star::uno::RuntimeException) + { return m_base.getSchemeSpecificPart(); } + + virtual sal_Bool SAL_CALL isHierarchical() + throw (com::sun::star::uno::RuntimeException) + { return m_base.isHierarchical(); } + + virtual sal_Bool SAL_CALL hasAuthority() + throw (com::sun::star::uno::RuntimeException) + { return m_base.hasAuthority(); } + + virtual rtl::OUString SAL_CALL getAuthority() + throw (com::sun::star::uno::RuntimeException) + { return m_base.getAuthority(); } + + virtual rtl::OUString SAL_CALL getPath() + throw (com::sun::star::uno::RuntimeException) + { return m_base.getPath(); } + + virtual sal_Bool SAL_CALL hasRelativePath() + throw (com::sun::star::uno::RuntimeException) + { return m_base.hasRelativePath(); } + + virtual sal_Int32 SAL_CALL getPathSegmentCount() + throw (com::sun::star::uno::RuntimeException) + { return m_base.getPathSegmentCount(); } + + virtual rtl::OUString SAL_CALL getPathSegment(sal_Int32 index) + throw (com::sun::star::uno::RuntimeException) + { return m_base.getPathSegment(index); } + + virtual sal_Bool SAL_CALL hasQuery() + throw (com::sun::star::uno::RuntimeException) + { return m_base.hasQuery(); } + + virtual rtl::OUString SAL_CALL getQuery() + throw (com::sun::star::uno::RuntimeException) + { return m_base.getQuery(); } + + virtual sal_Bool SAL_CALL hasFragment() + throw (com::sun::star::uno::RuntimeException) + { return m_base.hasFragment(); } + + virtual rtl::OUString SAL_CALL getFragment() + throw (com::sun::star::uno::RuntimeException) + { return m_base.getFragment(); } + + virtual void SAL_CALL setFragment(rtl::OUString const & fragment) + throw (com::sun::star::uno::RuntimeException) + { m_base.setFragment(fragment); } + + virtual void SAL_CALL clearFragment() + throw (com::sun::star::uno::RuntimeException) + { m_base.clearFragment(); } + +private: + UriReference(UriReference &); // not implemented + void operator =(UriReference); // not implemented + + virtual ~UriReference() {} + + stoc::uriproc::UriReference m_base; +}; + // throws std::bad_alloc css::uno::Reference< css::uri::XUriReference > parseGeneric( rtl::OUString const & scheme, rtl::OUString const & schemeSpecificPart) @@ -207,7 +296,7 @@ css::uno::Reference< css::uri::XUriReference > parseGeneric( } path = schemeSpecificPart; } - return new stoc::uriproc::UriReference( + return new UriReference( scheme, isHierarchical, hasAuthority, authority, path, hasQuery, query); } diff --git a/stoc/source/uriproc/UriSchemeParser_vndDOTsunDOTstarDOTscript.cxx b/stoc/source/uriproc/UriSchemeParser_vndDOTsunDOTstarDOTscript.cxx index 8174ec958bf5..91a28ac69c4f 100644 --- a/stoc/source/uriproc/UriSchemeParser_vndDOTsunDOTstarDOTscript.cxx +++ b/stoc/source/uriproc/UriSchemeParser_vndDOTsunDOTstarDOTscript.cxx @@ -2,9 +2,9 @@ * * $RCSfile: UriSchemeParser_vndDOTsunDOTstarDOTscript.cxx,v $ * - * $Revision: 1.2 $ + * $Revision: 1.3 $ * - * last change: $Author: kz $ $Date: 2004-01-19 18:29:27 $ + * last change: $Author: obo $ $Date: 2004-03-19 13:21:45 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -71,7 +71,8 @@ #include "com/sun/star/uno/XInterface.hpp" #include "com/sun/star/uri/XUriReference.hpp" #include "com/sun/star/uri/XUriSchemeParser.hpp" -#include "com/sun/star/uri/XVndSunStarScriptUrl.hpp" +#include "com/sun/star/uri/XVndSunStarScriptUrlReference.hpp" +#include "cppuhelper/implbase1.hxx" #include "cppuhelper/implbase2.hxx" #include "cppuhelper/weak.hxx" #include "osl/mutex.hxx" @@ -206,21 +207,81 @@ bool parseSchemeSpecificPart(rtl::OUString const & part) { } class UrlReference: - public cppu::ImplInheritanceHelper2< - stoc::uriproc::UriReference, css::lang::XServiceInfo, - css::uri::XVndSunStarScriptUrl > + public cppu::WeakImplHelper1< css::uri::XVndSunStarScriptUrlReference > { public: - UrlReference(rtl::OUString const & scheme, rtl::OUString const & path); + UrlReference(rtl::OUString const & scheme, rtl::OUString const & path): + m_base( + scheme, false, false, rtl::OUString(), path, false, rtl::OUString()) + {} - virtual rtl::OUString SAL_CALL getImplementationName() - throw (css::uno::RuntimeException); + virtual rtl::OUString SAL_CALL getUriReference() + throw (com::sun::star::uno::RuntimeException) + { return m_base.getUriReference(); } - virtual sal_Bool SAL_CALL supportsService(rtl::OUString const & serviceName) - throw (css::uno::RuntimeException); + virtual sal_Bool SAL_CALL isAbsolute() + throw (com::sun::star::uno::RuntimeException) + { return m_base.isAbsolute(); } - virtual css::uno::Sequence< rtl::OUString > SAL_CALL - getSupportedServiceNames() throw (css::uno::RuntimeException); + virtual rtl::OUString SAL_CALL getScheme() + throw (com::sun::star::uno::RuntimeException) + { return m_base.getScheme(); } + + virtual rtl::OUString SAL_CALL getSchemeSpecificPart() + throw (com::sun::star::uno::RuntimeException) + { return m_base.getSchemeSpecificPart(); } + + virtual sal_Bool SAL_CALL isHierarchical() + throw (com::sun::star::uno::RuntimeException) + { return m_base.isHierarchical(); } + + virtual sal_Bool SAL_CALL hasAuthority() + throw (com::sun::star::uno::RuntimeException) + { return m_base.hasAuthority(); } + + virtual rtl::OUString SAL_CALL getAuthority() + throw (com::sun::star::uno::RuntimeException) + { return m_base.getAuthority(); } + + virtual rtl::OUString SAL_CALL getPath() + throw (com::sun::star::uno::RuntimeException) + { return m_base.getPath(); } + + virtual sal_Bool SAL_CALL hasRelativePath() + throw (com::sun::star::uno::RuntimeException) + { return m_base.hasRelativePath(); } + + virtual sal_Int32 SAL_CALL getPathSegmentCount() + throw (com::sun::star::uno::RuntimeException) + { return m_base.getPathSegmentCount(); } + + virtual rtl::OUString SAL_CALL getPathSegment(sal_Int32 index) + throw (com::sun::star::uno::RuntimeException) + { return m_base.getPathSegment(index); } + + virtual sal_Bool SAL_CALL hasQuery() + throw (com::sun::star::uno::RuntimeException) + { return m_base.hasQuery(); } + + virtual rtl::OUString SAL_CALL getQuery() + throw (com::sun::star::uno::RuntimeException) + { return m_base.getQuery(); } + + virtual sal_Bool SAL_CALL hasFragment() + throw (com::sun::star::uno::RuntimeException) + { return m_base.hasFragment(); } + + virtual rtl::OUString SAL_CALL getFragment() + throw (com::sun::star::uno::RuntimeException) + { return m_base.getFragment(); } + + virtual void SAL_CALL setFragment(rtl::OUString const & fragment) + throw (com::sun::star::uno::RuntimeException) + { m_base.setFragment(fragment); } + + virtual void SAL_CALL clearFragment() + throw (com::sun::star::uno::RuntimeException) + { m_base.clearFragment(); } virtual rtl::OUString SAL_CALL getName() throw (css::uno::RuntimeException); @@ -237,74 +298,45 @@ private: virtual ~UrlReference() {} sal_Int32 findParameter(rtl::OUString const & key); -}; -UrlReference::UrlReference( - rtl::OUString const & scheme, rtl::OUString const & path) -{ - initialize(scheme, false, false, rtl::OUString(), path, false, - rtl::OUString()); -} - -rtl::OUString UrlReference::getImplementationName() - throw (css::uno::RuntimeException) -{ - return rtl::OUString::createFromAscii( - "com.sun.star.comp.uri.UriSchemeParser_vndDOTsunDOTstarDOTscript." - "UrlReference"); //TODO: has this service an implementation name? -} - -sal_Bool UrlReference::supportsService(rtl::OUString const & serviceName) - throw (css::uno::RuntimeException) -{ - return stoc::uriproc::supportsService( - getSupportedServiceNames(), serviceName); -} - -css::uno::Sequence< rtl::OUString > UrlReference::getSupportedServiceNames() - throw (css::uno::RuntimeException) -{ - css::uno::Sequence< rtl::OUString > s(1); - s[0] = rtl::OUString::createFromAscii( - "com.sun.star.uri.VndSunStarScriptUrlReference"); - return s; -} + stoc::uriproc::UriReference m_base; +}; rtl::OUString UrlReference::getName() throw (css::uno::RuntimeException) { - osl::MutexGuard g(m_mutex); + osl::MutexGuard g(m_base.m_mutex); sal_Int32 i = 0; - return parsePart(m_path, true, &i); + return parsePart(m_base.m_path, true, &i); } sal_Bool UrlReference::hasParameter(rtl::OUString const & key) throw (css::uno::RuntimeException) { - osl::MutexGuard g(m_mutex); + osl::MutexGuard g(m_base.m_mutex); return findParameter(key) >= 0; } rtl::OUString UrlReference::getParameter(rtl::OUString const & key) throw (css::uno::RuntimeException) { - osl::MutexGuard g(m_mutex); + osl::MutexGuard g(m_base.m_mutex); sal_Int32 i = findParameter(key); - return i >= 0 ? parsePart(m_path, false, &i) : rtl::OUString(); + return i >= 0 ? parsePart(m_base.m_path, false, &i) : rtl::OUString(); } sal_Int32 UrlReference::findParameter(rtl::OUString const & key) { sal_Int32 i = 0; - parsePart(m_path, true, &i); // skip name + parsePart(m_base.m_path, true, &i); // skip name for (;;) { - if (i == m_path.getLength()) { + if (i == m_base.m_path.getLength()) { return -1; } ++i; // skip '?' or '&' - rtl::OUString k = parsePart(m_path, false, &i); + rtl::OUString k = parsePart(m_base.m_path, false, &i); ++i; // skip '=' if (k == key) { return i; } - parsePart(m_path, false, &i); // skip value + parsePart(m_base.m_path, false, &i); // skip value } } diff --git a/stoc/source/uriproc/makefile.mk b/stoc/source/uriproc/makefile.mk index 23877cd05d96..45c6ad3f0a21 100644 --- a/stoc/source/uriproc/makefile.mk +++ b/stoc/source/uriproc/makefile.mk @@ -2,9 +2,9 @@ # # $RCSfile: makefile.mk,v $ # -# $Revision: 1.2 $ +# $Revision: 1.3 $ # -# last change: $Author: kz $ $Date: 2004-01-19 18:30:13 $ +# last change: $Author: obo $ $Date: 2004-03-19 13:21:57 $ # # The Contents of this file are made available subject to the terms of # either of the following licenses @@ -81,7 +81,7 @@ UNOTYPES = \ com.sun.star.uri.XUriReference \ com.sun.star.uri.XUriReferenceFactory \ com.sun.star.uri.XUriSchemeParser \ - com.sun.star.uri.XVndSunStarScriptUrl + com.sun.star.uri.XVndSunStarScriptUrlReference SHL1TARGET = $(TARGET).uno SHL1OBJS = \ |