xref: /trunk/main/ucb/source/ucp/file/filglob.hxx (revision 6df1ea1f)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 #ifndef _FILGLOB_HXX_
24 #define _FILGLOB_HXX_
25 
26 #include <rtl/ustring.hxx>
27 #include <osl/file.hxx>
28 #include <com/sun/star/ucb/XCommandEnvironment.hpp>
29 
30 
31 namespace fileaccess {
32 
33 	class BaseContent;
34 
35 	struct equalOUString
36 	{
operator ()fileaccess::equalOUString37 		bool operator()( const rtl::OUString& rKey1, const rtl::OUString& rKey2 ) const
38 		{
39 			return !!( rKey1 == rKey2 );
40 		}
41 	};
42 
43 
44 	struct hashOUString
45 	{
operator ()fileaccess::hashOUString46 		size_t operator()( const rtl::OUString& rName ) const
47 		{
48 			return rName.hashCode();
49 		}
50 	};
51 
52 
53 	/******************************************************************************/
54 	/*                                                                            */
55 	/*                         Helper functions                                   */
56 	/*                                                                            */
57 	/******************************************************************************/
58 
59 
60 	// Returns true if dstUnqPath is a child from srcUnqPath or both are equal
61 
62 	extern sal_Bool isChild( const rtl::OUString& srcUnqPath,
63 									  const rtl::OUString& dstUnqPath );
64 
65 
66 	// Changes the prefix in name
67 	extern rtl::OUString newName( const rtl::OUString& aNewPrefix,
68 										   const rtl::OUString& aOldPrefix,
69 										   const rtl::OUString& old_Name );
70 
71 	// returns the last part of the given url as title
72 	extern rtl::OUString getTitle( const rtl::OUString& aPath );
73 
74 	// returns the url without last part as parentname
75 	// In case aFileName is root ( file:/// ) root is returned
76 
77 	extern rtl::OUString getParentName( const rtl::OUString& aFileName );
78 
79 	/**
80 	 *  special copy:
81 	 *  On test = true, the implementation determines whether the
82 	 *  destination exists and returns the appropriate errorcode E_EXIST.
83 	 *  osl::File::copy copies unchecked.
84 	 */
85 
86 	extern osl::FileBase::RC osl_File_copy( const rtl::OUString& strPath,
87 											const rtl::OUString& strDestPath,
88 											sal_Bool test = false );
89 
90 	/**
91 	 *  special move:
92 	 *  On test = true, the implementation determines whether the
93 	 *  destination exists and returns the appropriate errorcode E_EXIST.
94 	 *  osl::File::move moves unchecked
95 	 */
96 
97 	extern osl::FileBase::RC osl_File_move( const rtl::OUString& strPath,
98 											const rtl::OUString& strDestPath,
99 											sal_Bool test = false );
100 
101 	// This function implements the global exception handler of the file_ucp;
102 	// It never returns;
103 
104 	extern void throw_handler( sal_Int32 errorCode,
105 							   sal_Int32 minorCode,
106 							   const com::sun::star::uno::Reference<
107 							   com::sun::star::ucb::XCommandEnvironment >& xEnv,
108 							   const rtl::OUString& aUncPath,
109 							   BaseContent* pContent,
110 							   bool isHandled = false);
111                                    // the physical URL of the object
112 
113 } // end namespace fileaccess
114 
115 #endif
116