Branch data Line data Source code
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 : : #ifndef _NEONURI_HXX_
29 : : #define _NEONURI_HXX_
30 : :
31 : : #include <ne_uri.h>
32 : : #include <rtl/ustring.hxx>
33 : : #include <DAVException.hxx>
34 : :
35 : : namespace webdav_ucp
36 : : {
37 : :
38 : : #define DEFAULT_HTTP_PORT 80
39 : : #define DEFAULT_HTTPS_PORT 443
40 : : #define DEFAULT_FTP_PORT 21
41 : :
42 : : // -------------------------------------------------------------------
43 : : // NeonUri
44 : : // A URI implementation for use with the neon/expat library
45 : : // -------------------------------------------------------------------
46 : 0 : class NeonUri
47 : : {
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;
55 : :
56 : : void init( const rtl::OString & rUri, const ne_uri * pUri );
57 : : void calculateURI ();
58 : :
59 : : public:
60 : : NeonUri( const ::rtl::OUString & inUri ) throw ( DAVException );
61 : : NeonUri( const ne_uri * inUri ) throw ( DAVException );
62 : : ~NeonUri( );
63 : :
64 : : bool operator== ( const NeonUri & rOther ) const;
65 : : bool operator!= ( const NeonUri & rOther ) const
66 : : { return !operator==( rOther ); }
67 : :
68 : 0 : const ::rtl::OUString & GetURI( void ) const
69 : 0 : { return mURI; };
70 : 0 : const ::rtl::OUString & GetScheme( void ) const
71 : 0 : { return mScheme; };
72 : 0 : const ::rtl::OUString & GetUserInfo( void ) const
73 : 0 : { return mUserInfo; };
74 : 0 : const ::rtl::OUString & GetHost( void ) const
75 : 0 : { return mHostName; };
76 : 0 : sal_Int32 GetPort( void ) const
77 : 0 : { return mPort; };
78 : 0 : const ::rtl::OUString & GetPath( void ) const
79 : 0 : { return mPath; };
80 : :
81 : : ::rtl::OUString GetPathBaseName ( void ) const;
82 : :
83 : : ::rtl::OUString GetPathBaseNameUnescaped ( void ) const;
84 : :
85 : 0 : void SetScheme (const ::rtl::OUString& scheme)
86 : 0 : { mScheme = scheme; calculateURI (); };
87 : :
88 : : void AppendPath (const ::rtl::OUString& rPath);
89 : :
90 : : static ::rtl::OUString escapeSegment( const ::rtl::OUString& segment );
91 : : static ::rtl::OUString unescape( const ::rtl::OUString& string );
92 : :
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() ); }
99 : : };
100 : :
101 : : } // namespace webdav_ucp
102 : :
103 : : #endif // _NEONURI_HXX_
104 : :
105 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|