xref: /aoo41x/main/ucb/source/ucp/file/filglob.hxx (revision cdf0e10c)
1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 #ifndef _FILGLOB_HXX_
28 #define _FILGLOB_HXX_
29 
30 #include <rtl/ustring.hxx>
31 #include <osl/file.hxx>
32 #include <com/sun/star/ucb/XCommandEnvironment.hpp>
33 
34 
35 namespace fileaccess {
36 
37 	class BaseContent;
38 
39 	struct equalOUString
40 	{
41 		bool operator()( const rtl::OUString& rKey1, const rtl::OUString& rKey2 ) const
42 		{
43 			return !!( rKey1 == rKey2 );
44 		}
45 	};
46 
47 
48 	struct hashOUString
49 	{
50 		size_t operator()( const rtl::OUString& rName ) const
51 		{
52 			return rName.hashCode();
53 		}
54 	};
55 
56 
57 	/******************************************************************************/
58 	/*                                                                            */
59 	/*                         Helper functions                                   */
60 	/*                                                                            */
61 	/******************************************************************************/
62 
63 
64 	// Returns true if dstUnqPath is a child from srcUnqPath or both are equal
65 
66 	extern sal_Bool isChild( const rtl::OUString& srcUnqPath,
67 									  const rtl::OUString& dstUnqPath );
68 
69 
70 	// Changes the prefix in name
71 	extern rtl::OUString newName( const rtl::OUString& aNewPrefix,
72 										   const rtl::OUString& aOldPrefix,
73 										   const rtl::OUString& old_Name );
74 
75 	// returns the last part of the given url as title
76 	extern rtl::OUString getTitle( const rtl::OUString& aPath );
77 
78 	// returns the url without last part as parentname
79 	// In case aFileName is root ( file:/// ) root is returned
80 
81 	extern rtl::OUString getParentName( const rtl::OUString& aFileName );
82 
83 	/**
84 	 *  special copy:
85 	 *  On test = true, the implementation determines whether the
86 	 *  destination exists and returns the appropriate errorcode E_EXIST.
87 	 *  osl::File::copy copies unchecked.
88 	 */
89 
90 	extern osl::FileBase::RC osl_File_copy( const rtl::OUString& strPath,
91 											const rtl::OUString& strDestPath,
92 											sal_Bool test = false );
93 
94 	/**
95 	 *  special move:
96 	 *  On test = true, the implementation determines whether the
97 	 *  destination exists and returns the appropriate errorcode E_EXIST.
98 	 *  osl::File::move moves unchecked
99 	 */
100 
101 	extern osl::FileBase::RC osl_File_move( const rtl::OUString& strPath,
102 											const rtl::OUString& strDestPath,
103 											sal_Bool test = false );
104 
105 	// This function implements the global exception handler of the file_ucp;
106 	// It never returns;
107 
108 	extern void throw_handler( sal_Int32 errorCode,
109 							   sal_Int32 minorCode,
110 							   const com::sun::star::uno::Reference<
111 							   com::sun::star::ucb::XCommandEnvironment >& xEnv,
112 							   const rtl::OUString& aUncPath,
113 							   BaseContent* pContent,
114 							   bool isHandled = false);
115                                    // the physical URL of the object
116 
117 } // end namespace fileaccess
118 
119 #endif
120