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  * This file is part of the LibreOffice project.
4  *
5  * This Source Code Form is subject to the terms of the Mozilla Public
6  * License, v. 2.0. If a copy of the MPL was not distributed with this
7  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8  *
9  * This file incorporates work covered by the following license notice:
10  *
11  * Licensed to the Apache Software Foundation (ASF) under one or more
12  * contributor license agreements. See the NOTICE file distributed
13  * with this work for additional information regarding copyright
14  * ownership. The ASF licenses this file to you under the Apache
15  * License, Version 2.0 (the "License"); you may not use this file
16  * except in compliance with the License. You may obtain a copy of
17  * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18  */
19 
20 #ifndef _RTL_URI_HXX_
21 #define _RTL_URI_HXX_
22 
24 #include "rtl/uri.h"
25 #include "rtl/textenc.h"
26 #include "rtl/ustring.hxx"
27 #include "sal/types.h"
28 
29 namespace rtl {
30 
33 class Uri
34 {
35 public:
39  static inline rtl::OUString encode(rtl::OUString const & rText,
40  sal_Bool const * pCharClass,
41  rtl_UriEncodeMechanism eMechanism,
42  rtl_TextEncoding eCharset)
43  SAL_THROW(());
44 
48  static inline rtl::OUString encode(rtl::OUString const & rText,
49  rtl_UriCharClass eCharClass,
50  rtl_UriEncodeMechanism eMechanism,
51  rtl_TextEncoding eCharset)
52  SAL_THROW(());
53 
56  static inline rtl::OUString decode(rtl::OUString const & rText,
57  rtl_UriDecodeMechanism eMechanism,
58  rtl_TextEncoding eCharset)
59  SAL_THROW(());
60 
67  static inline rtl::OUString convertRelToAbs(
68  rtl::OUString const & rBaseUriRef, rtl::OUString const & rRelUriRef);
69 
70 private:
72  Uri();
73 
75  Uri(Uri &);
76 
78  ~Uri();
79 
81  void operator =(Uri);
82 };
83 
85  sal_Bool const * pCharClass,
86  rtl_UriEncodeMechanism eMechanism,
87  rtl_TextEncoding eCharset)
88  SAL_THROW(())
89 {
90  rtl::OUString aResult;
91  rtl_uriEncode(const_cast< rtl::OUString & >(rText).pData,
92  pCharClass,
93  eMechanism,
94  eCharset,
95  &aResult.pData);
96  return aResult;
97 }
98 
100  rtl_UriCharClass eCharClass,
101  rtl_UriEncodeMechanism eMechanism,
102  rtl_TextEncoding eCharset)
103  SAL_THROW(())
104 {
105  rtl::OUString aResult;
106  rtl_uriEncode(const_cast< rtl::OUString & >(rText).pData,
107  rtl_getUriCharClass(eCharClass),
108  eMechanism,
109  eCharset,
110  &aResult.pData);
111  return aResult;
112 }
113 
115  rtl_UriDecodeMechanism eMechanism,
116  rtl_TextEncoding eCharset)
117  SAL_THROW(())
118 {
119  rtl::OUString aResult;
120  rtl_uriDecode(const_cast< rtl::OUString & >(rText).pData,
121  eMechanism,
122  eCharset,
123  &aResult.pData);
124  return aResult;
125 }
126 
128  rtl::OUString const & rRelUriRef)
129 {
130  rtl::OUString aResult;
131  rtl::OUString aException;
133  const_cast< rtl::OUString & >(rBaseUriRef).pData,
134  const_cast< rtl::OUString & >(rRelUriRef).pData, &aResult.pData,
135  &aException.pData))
136  throw MalformedUriException(aException);
137  return aResult;
138 }
139 
140 }
141 
142 #endif // _RTL_URI_HXX_
143 
144 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */