1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 #ifndef INCLUDED_stoc_source_uriproc_UriReference_hxx
25 #define INCLUDED_stoc_source_uriproc_UriReference_hxx
26 
27 #include "com/sun/star/uno/RuntimeException.hpp"
28 #include "osl/mutex.hxx"
29 #include "rtl/ustring.hxx"
30 #include "sal/types.h"
31 
32 namespace rtl { class OUStringBuffer; }
33 
34 namespace stoc { namespace uriproc {
35 
36 class UriReference {
37 public:
38     UriReference(
39         rtl::OUString const & scheme, bool isHierarchical, bool hasAuthority,
40         rtl::OUString const & authority, rtl::OUString const & path,
41         bool hasQuery, rtl::OUString const & query);
42 
43     ~UriReference();
44 
45     rtl::OUString getUriReference()
46         throw (com::sun::star::uno::RuntimeException);
47 
48     sal_Bool isAbsolute() throw (com::sun::star::uno::RuntimeException);
49 
50     rtl::OUString getScheme() throw (com::sun::star::uno::RuntimeException);
51 
52     rtl::OUString getSchemeSpecificPart()
53         throw (com::sun::star::uno::RuntimeException);
54 
55     sal_Bool isHierarchical() throw (com::sun::star::uno::RuntimeException);
56 
57     sal_Bool hasAuthority() throw (com::sun::star::uno::RuntimeException);
58 
59     rtl::OUString getAuthority() throw (com::sun::star::uno::RuntimeException);
60 
61     rtl::OUString getPath() throw (com::sun::star::uno::RuntimeException);
62 
63     sal_Bool hasRelativePath() throw (com::sun::star::uno::RuntimeException);
64 
65     sal_Int32 getPathSegmentCount()
66         throw (com::sun::star::uno::RuntimeException);
67 
68     rtl::OUString getPathSegment(sal_Int32 index)
69         throw (com::sun::star::uno::RuntimeException);
70 
71     sal_Bool hasQuery() throw (com::sun::star::uno::RuntimeException);
72 
73     rtl::OUString getQuery() throw (com::sun::star::uno::RuntimeException);
74 
75     sal_Bool hasFragment() throw (com::sun::star::uno::RuntimeException);
76 
77     rtl::OUString getFragment() throw (com::sun::star::uno::RuntimeException);
78 
79     void setFragment(rtl::OUString const & fragment)
80         throw (com::sun::star::uno::RuntimeException);
81 
82     void clearFragment() throw (com::sun::star::uno::RuntimeException);
83 
84     osl::Mutex m_mutex;
85     rtl::OUString m_scheme;
86     rtl::OUString m_authority;
87     rtl::OUString m_path;
88     rtl::OUString m_query;
89     rtl::OUString m_fragment;
90     bool m_isHierarchical;
91     bool m_hasAuthority;
92     bool m_hasQuery;
93     bool m_hasFragment;
94 
95 private:
96     UriReference(UriReference &); // not implemented
97     void operator =(UriReference); // not implemented
98 
99     void appendSchemeSpecificPart(rtl::OUStringBuffer & buffer) const;
100 };
101 
102 } }
103 
104 #endif
105