UDK 3.2.7 C/C++ API Reference
|
00001 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ 00002 /************************************************************************* 00003 * 00004 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 00005 * 00006 * Copyright 2000, 2010 Oracle and/or its affiliates. 00007 * 00008 * OpenOffice.org - a multi-platform office productivity suite 00009 * 00010 * This file is part of OpenOffice.org. 00011 * 00012 * OpenOffice.org is free software: you can redistribute it and/or modify 00013 * it under the terms of the GNU Lesser General Public License version 3 00014 * only, as published by the Free Software Foundation. 00015 * 00016 * OpenOffice.org is distributed in the hope that it will be useful, 00017 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00018 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00019 * GNU Lesser General Public License version 3 for more details 00020 * (a copy is included in the LICENSE file that accompanied this code). 00021 * 00022 * You should have received a copy of the GNU Lesser General Public License 00023 * version 3 along with OpenOffice.org. If not, see 00024 * <http://www.openoffice.org/license.html> 00025 * for a copy of the LGPLv3 License. 00026 * 00027 ************************************************************************/ 00028 00029 #ifndef _RTL_URI_HXX_ 00030 #define _RTL_URI_HXX_ 00031 00032 #include "rtl/malformeduriexception.hxx" 00033 #include "rtl/uri.h" 00034 #include "rtl/textenc.h" 00035 #include "rtl/ustring.hxx" 00036 #include "sal/types.h" 00037 00038 namespace rtl { 00039 00042 class Uri 00043 { 00044 public: 00048 static inline rtl::OUString encode(rtl::OUString const & rText, 00049 sal_Bool const * pCharClass, 00050 rtl_UriEncodeMechanism eMechanism, 00051 rtl_TextEncoding eCharset) 00052 SAL_THROW(()); 00053 00057 static inline rtl::OUString encode(rtl::OUString const & rText, 00058 rtl_UriCharClass eCharClass, 00059 rtl_UriEncodeMechanism eMechanism, 00060 rtl_TextEncoding eCharset) 00061 SAL_THROW(()); 00062 00065 static inline rtl::OUString decode(rtl::OUString const & rText, 00066 rtl_UriDecodeMechanism eMechanism, 00067 rtl_TextEncoding eCharset) 00068 SAL_THROW(()); 00069 00076 static inline rtl::OUString convertRelToAbs( 00077 rtl::OUString const & rBaseUriRef, rtl::OUString const & rRelUriRef); 00078 00079 private: 00081 Uri(); 00082 00084 Uri(Uri &); 00085 00087 ~Uri(); 00088 00090 void operator =(Uri); 00091 }; 00092 00093 inline rtl::OUString Uri::encode(rtl::OUString const & rText, 00094 sal_Bool const * pCharClass, 00095 rtl_UriEncodeMechanism eMechanism, 00096 rtl_TextEncoding eCharset) 00097 SAL_THROW(()) 00098 { 00099 rtl::OUString aResult; 00100 rtl_uriEncode(const_cast< rtl::OUString & >(rText).pData, 00101 pCharClass, 00102 eMechanism, 00103 eCharset, 00104 &aResult.pData); 00105 return aResult; 00106 } 00107 00108 inline rtl::OUString Uri::encode(rtl::OUString const & rText, 00109 rtl_UriCharClass eCharClass, 00110 rtl_UriEncodeMechanism eMechanism, 00111 rtl_TextEncoding eCharset) 00112 SAL_THROW(()) 00113 { 00114 rtl::OUString aResult; 00115 rtl_uriEncode(const_cast< rtl::OUString & >(rText).pData, 00116 rtl_getUriCharClass(eCharClass), 00117 eMechanism, 00118 eCharset, 00119 &aResult.pData); 00120 return aResult; 00121 } 00122 00123 inline rtl::OUString Uri::decode(rtl::OUString const & rText, 00124 rtl_UriDecodeMechanism eMechanism, 00125 rtl_TextEncoding eCharset) 00126 SAL_THROW(()) 00127 { 00128 rtl::OUString aResult; 00129 rtl_uriDecode(const_cast< rtl::OUString & >(rText).pData, 00130 eMechanism, 00131 eCharset, 00132 &aResult.pData); 00133 return aResult; 00134 } 00135 00136 inline rtl::OUString Uri::convertRelToAbs(rtl::OUString const & rBaseUriRef, 00137 rtl::OUString const & rRelUriRef) 00138 { 00139 rtl::OUString aResult; 00140 rtl::OUString aException; 00141 if (!rtl_uriConvertRelToAbs( 00142 const_cast< rtl::OUString & >(rBaseUriRef).pData, 00143 const_cast< rtl::OUString & >(rRelUriRef).pData, &aResult.pData, 00144 &aException.pData)) 00145 throw MalformedUriException(aException); 00146 return aResult; 00147 } 00148 00149 } 00150 00151 #endif // _RTL_URI_HXX_ 00152 00153 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */