My Project
UDK 3.2.7 C/C++ API Reference
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
uri.hxx
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*************************************************************************
3  *
4  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5  *
6  * Copyright 2000, 2010 Oracle and/or its affiliates.
7  *
8  * OpenOffice.org - a multi-platform office productivity suite
9  *
10  * This file is part of OpenOffice.org.
11  *
12  * OpenOffice.org is free software: you can redistribute it and/or modify
13  * it under the terms of the GNU Lesser General Public License version 3
14  * only, as published by the Free Software Foundation.
15  *
16  * OpenOffice.org is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19  * GNU Lesser General Public License version 3 for more details
20  * (a copy is included in the LICENSE file that accompanied this code).
21  *
22  * You should have received a copy of the GNU Lesser General Public License
23  * version 3 along with OpenOffice.org. If not, see
24  * <http://www.openoffice.org/license.html>
25  * for a copy of the LGPLv3 License.
26  *
27  ************************************************************************/
28 
29 #ifndef _RTL_URI_HXX_
30 #define _RTL_URI_HXX_
31 
33 #include "rtl/uri.h"
34 #include "rtl/textenc.h"
35 #include "rtl/ustring.hxx"
36 #include "sal/types.h"
37 
38 namespace rtl {
39 
42 class Uri
43 {
44 public:
48  static inline rtl::OUString encode(rtl::OUString const & rText,
49  sal_Bool const * pCharClass,
50  rtl_UriEncodeMechanism eMechanism,
51  rtl_TextEncoding eCharset)
52  SAL_THROW(());
53 
57  static inline rtl::OUString encode(rtl::OUString const & rText,
58  rtl_UriCharClass eCharClass,
59  rtl_UriEncodeMechanism eMechanism,
60  rtl_TextEncoding eCharset)
61  SAL_THROW(());
62 
65  static inline rtl::OUString decode(rtl::OUString const & rText,
66  rtl_UriDecodeMechanism eMechanism,
67  rtl_TextEncoding eCharset)
68  SAL_THROW(());
69 
76  static inline rtl::OUString convertRelToAbs(
77  rtl::OUString const & rBaseUriRef, rtl::OUString const & rRelUriRef);
78 
79 private:
81  Uri();
82 
84  Uri(Uri &);
85 
87  ~Uri();
88 
90  void operator =(Uri);
91 };
92 
94  sal_Bool const * pCharClass,
95  rtl_UriEncodeMechanism eMechanism,
96  rtl_TextEncoding eCharset)
97  SAL_THROW(())
98 {
99  rtl::OUString aResult;
100  rtl_uriEncode(const_cast< rtl::OUString & >(rText).pData,
101  pCharClass,
102  eMechanism,
103  eCharset,
104  &aResult.pData);
105  return aResult;
106 }
107 
109  rtl_UriCharClass eCharClass,
110  rtl_UriEncodeMechanism eMechanism,
111  rtl_TextEncoding eCharset)
112  SAL_THROW(())
113 {
114  rtl::OUString aResult;
115  rtl_uriEncode(const_cast< rtl::OUString & >(rText).pData,
116  rtl_getUriCharClass(eCharClass),
117  eMechanism,
118  eCharset,
119  &aResult.pData);
120  return aResult;
121 }
122 
124  rtl_UriDecodeMechanism eMechanism,
125  rtl_TextEncoding eCharset)
126  SAL_THROW(())
127 {
128  rtl::OUString aResult;
129  rtl_uriDecode(const_cast< rtl::OUString & >(rText).pData,
130  eMechanism,
131  eCharset,
132  &aResult.pData);
133  return aResult;
134 }
135 
137  rtl::OUString const & rRelUriRef)
138 {
139  rtl::OUString aResult;
140  rtl::OUString aException;
142  const_cast< rtl::OUString & >(rBaseUriRef).pData,
143  const_cast< rtl::OUString & >(rRelUriRef).pData, &aResult.pData,
144  &aException.pData))
145  throw MalformedUriException(aException);
146  return aResult;
147 }
148 
149 }
150 
151 #endif // _RTL_URI_HXX_
152 
153 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */