Bump for 3.6-28
[LibreOffice.git] / ucb / source / ucp / webdav / NeonUri.hxx
blob06d59317affb2994ca95d7a45c2b2e0b809090c1
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*************************************************************************
4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
6 * Copyright 2000, 2010 Oracle and/or its affiliates.
8 * OpenOffice.org - a multi-platform office productivity suite
10 * This file is part of OpenOffice.org.
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.
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).
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.
27 ************************************************************************/
28 #ifndef _NEONURI_HXX_
29 #define _NEONURI_HXX_
31 #include <ne_uri.h>
32 #include <rtl/ustring.hxx>
33 #include <DAVException.hxx>
35 namespace webdav_ucp
38 #define DEFAULT_HTTP_PORT 80
39 #define DEFAULT_HTTPS_PORT 443
40 #define DEFAULT_FTP_PORT 21
42 // -------------------------------------------------------------------
43 // NeonUri
44 // A URI implementation for use with the neon/expat library
45 // -------------------------------------------------------------------
46 class NeonUri
48 private:
49 ::rtl::OUString mURI;
50 ::rtl::OUString mScheme;
51 ::rtl::OUString mUserInfo;
52 ::rtl::OUString mHostName;
53 sal_Int32 mPort;
54 ::rtl::OUString mPath;
56 void init( const rtl::OString & rUri, const ne_uri * pUri );
57 void calculateURI ();
59 public:
60 NeonUri( const ::rtl::OUString & inUri ) throw ( DAVException );
61 NeonUri( const ne_uri * inUri ) throw ( DAVException );
62 ~NeonUri( );
64 bool operator== ( const NeonUri & rOther ) const;
65 bool operator!= ( const NeonUri & rOther ) const
66 { return !operator==( rOther ); }
68 const ::rtl::OUString & GetURI( void ) const
69 { return mURI; };
70 const ::rtl::OUString & GetScheme( void ) const
71 { return mScheme; };
72 const ::rtl::OUString & GetUserInfo( void ) const
73 { return mUserInfo; };
74 const ::rtl::OUString & GetHost( void ) const
75 { return mHostName; };
76 sal_Int32 GetPort( void ) const
77 { return mPort; };
78 const ::rtl::OUString & GetPath( void ) const
79 { return mPath; };
81 ::rtl::OUString GetPathBaseName ( void ) const;
83 ::rtl::OUString GetPathBaseNameUnescaped ( void ) const;
85 void SetScheme (const ::rtl::OUString& scheme)
86 { mScheme = scheme; calculateURI (); };
88 void AppendPath (const ::rtl::OUString& rPath);
90 static ::rtl::OUString escapeSegment( const ::rtl::OUString& segment );
91 static ::rtl::OUString unescape( const ::rtl::OUString& string );
93 // "host:port", omit ":port" for port 80 and 443
94 static rtl::OUString makeConnectionEndPointString(
95 const rtl::OUString & rHostName,
96 int nPort );
97 rtl::OUString makeConnectionEndPointString() const
98 { return makeConnectionEndPointString( GetHost(), GetPort() ); }
101 } // namespace webdav_ucp
103 #endif // _NEONURI_HXX_
105 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */