1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: NeonUri.hxx,v $
10 * $Revision: 1.14.22.1 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
34 #include <rtl/ustring.hxx>
35 #include <DAVException.hxx>
40 #define DEFAULT_HTTP_PORT 80
41 #define DEFAULT_HTTPS_PORT 443
42 #define DEFAULT_FTP_PORT 21
44 // -------------------------------------------------------------------
46 // A URI implementation for use with the neon/expat library
47 // -------------------------------------------------------------------
52 ::rtl::OUString mScheme
;
53 ::rtl::OUString mUserInfo
;
54 ::rtl::OUString mHostName
;
56 ::rtl::OUString mPath
;
58 void init( const rtl::OString
& rUri
, const ne_uri
* pUri
);
62 NeonUri( const ::rtl::OUString
& inUri
) throw ( DAVException
);
63 NeonUri( const ne_uri
* inUri
) throw ( DAVException
);
66 bool operator== ( const NeonUri
& rOther
) const;
67 bool operator!= ( const NeonUri
& rOther
) const
68 { return !operator==( rOther
); }
70 const ::rtl::OUString
& GetURI( void ) const
72 const ::rtl::OUString
& GetScheme( void ) const
74 const ::rtl::OUString
& GetUserInfo( void ) const
75 { return mUserInfo
; };
76 const ::rtl::OUString
& GetHost( void ) const
77 { return mHostName
; };
78 sal_Int32
GetPort( void ) const
80 const ::rtl::OUString
& GetPath( void ) const
83 ::rtl::OUString
GetPathBaseName ( void ) const;
85 ::rtl::OUString
GetPathBaseNameUnescaped ( void ) const;
87 void SetScheme (const ::rtl::OUString
& scheme
)
88 { mScheme
= scheme
; calculateURI (); };
90 void AppendPath (const ::rtl::OUString
& rPath
);
92 static ::rtl::OUString
escapeSegment( const ::rtl::OUString
& segment
);
93 static ::rtl::OUString
unescape( const ::rtl::OUString
& string
);
95 // "host:port", omit ":port" for port 80 and 443
96 static rtl::OUString
makeConnectionEndPointString(
97 const rtl::OUString
& rHostName
,
99 rtl::OUString
makeConnectionEndPointString() const
100 { return makeConnectionEndPointString( GetHost(), GetPort() ); }
103 } // namespace webdav_ucp
105 #endif // _NEONURI_HXX_