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