1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 
28 #ifndef INCLUDED_stoc_source_uriproc_UriReference_hxx
29 #define INCLUDED_stoc_source_uriproc_UriReference_hxx
30 
31 #include "com/sun/star/uno/RuntimeException.hpp"
32 #include "osl/mutex.hxx"
33 #include "rtl/ustring.hxx"
34 #include "sal/types.h"
35 
36 namespace rtl { class OUStringBuffer; }
37 
38 namespace stoc { namespace uriproc {
39 
40 class UriReference {
41 public:
42     UriReference(
43         rtl::OUString const & scheme, bool isHierarchical, bool hasAuthority,
44         rtl::OUString const & authority, rtl::OUString const & path,
45         bool hasQuery, rtl::OUString const & query);
46 
47     ~UriReference();
48 
49     rtl::OUString getUriReference()
50         throw (com::sun::star::uno::RuntimeException);
51 
52     sal_Bool isAbsolute() throw (com::sun::star::uno::RuntimeException);
53 
54     rtl::OUString getScheme() throw (com::sun::star::uno::RuntimeException);
55 
56     rtl::OUString getSchemeSpecificPart()
57         throw (com::sun::star::uno::RuntimeException);
58 
59     sal_Bool isHierarchical() throw (com::sun::star::uno::RuntimeException);
60 
61     sal_Bool hasAuthority() throw (com::sun::star::uno::RuntimeException);
62 
63     rtl::OUString getAuthority() throw (com::sun::star::uno::RuntimeException);
64 
65     rtl::OUString getPath() throw (com::sun::star::uno::RuntimeException);
66 
67     sal_Bool hasRelativePath() throw (com::sun::star::uno::RuntimeException);
68 
69     sal_Int32 getPathSegmentCount()
70         throw (com::sun::star::uno::RuntimeException);
71 
72     rtl::OUString getPathSegment(sal_Int32 index)
73         throw (com::sun::star::uno::RuntimeException);
74 
75     sal_Bool hasQuery() throw (com::sun::star::uno::RuntimeException);
76 
77     rtl::OUString getQuery() throw (com::sun::star::uno::RuntimeException);
78 
79     sal_Bool hasFragment() throw (com::sun::star::uno::RuntimeException);
80 
81     rtl::OUString getFragment() throw (com::sun::star::uno::RuntimeException);
82 
83     void setFragment(rtl::OUString const & fragment)
84         throw (com::sun::star::uno::RuntimeException);
85 
86     void clearFragment() throw (com::sun::star::uno::RuntimeException);
87 
88     osl::Mutex m_mutex;
89     rtl::OUString m_scheme;
90     rtl::OUString m_authority;
91     rtl::OUString m_path;
92     rtl::OUString m_query;
93     rtl::OUString m_fragment;
94     bool m_isHierarchical;
95     bool m_hasAuthority;
96     bool m_hasQuery;
97     bool m_hasFragment;
98 
99 private:
100     UriReference(UriReference &); // not implemented
101     void operator =(UriReference); // not implemented
102 
103     void appendSchemeSpecificPart(rtl::OUStringBuffer & buffer) const;
104 };
105 
106 } }
107 
108 #endif
109