Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
5 : * This Source Code Form is subject to the terms of the Mozilla Public
6 : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
11 : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : * contributor license agreements. See the NOTICE file distributed
13 : * with this work for additional information regarding copyright
14 : * ownership. The ASF licenses this file to you under the Apache
15 : * License, Version 2.0 (the "License"); you may not use this file
16 : * except in compliance with the License. You may obtain a copy of
17 : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : */
19 : #ifndef _COMDEP_HXX
20 : #define _COMDEP_HXX
21 :
22 : #include <tools/fsys.hxx>
23 :
24 : #define ACCESSDELIM(e) ( ( e == FSYS_STYLE_NTFS ) ? "\\" : "/" )
25 : #define ACCESSDELIM_C(e)(char)\
26 : ( ( e == FSYS_STYLE_NTFS ) ? '\\' : '/' )
27 : #define SEARCHDELIM(e) ( (e == FSYS_STYLE_BSD) ? ":" : ";" )
28 : #define SEARCHDELIM_C(e)(char)\
29 : ( (e == FSYS_STYLE_BSD) ? ':' : ';' )
30 : #define ACTPARENT(e) ".."
31 : #define ACTCURRENT(e) "."
32 :
33 : #if defined UNX
34 : #include "unx.hxx"
35 : #elif defined WNT
36 : #include "wntmsc.hxx"
37 : #endif
38 :
39 : #ifndef LINUX
40 : DIR *opendir( const char* pPfad );
41 : dirent *readdir( DIR *pDir );
42 : int closedir( DIR *pDir );
43 : char *volumeid( const char* pPfad );
44 : #endif
45 :
46 : struct DirReader_Impl
47 : {
48 : Dir* pDir;
49 : DIR* pDosDir;
50 : dirent* pDosEntry;
51 : DirEntry* pParent;
52 : String aPath;
53 : rtl::OString aBypass;
54 : sal_Bool bReady;
55 : sal_Bool bInUse;
56 :
57 0 : DirReader_Impl( Dir &rDir )
58 : : pDir( &rDir ),
59 : pDosEntry( 0 ),
60 : pParent( 0 ),
61 : aPath(rDir.GetFull()),
62 : bReady ( sal_False ),
63 0 : bInUse( sal_False )
64 : {
65 :
66 : // only use the String from Member-Var
67 :
68 : #if defined(UNX) // for further explanation see DirReader_Impl::Read() in unx.cxx
69 0 : pDosDir = NULL;
70 : #else
71 : aBypass = rtl::OUStringToOString(aPath, osl_getThreadTextEncoding());
72 : pDosDir = opendir( aBypass.getStr() );
73 : #endif
74 :
75 : // Determine parents for new DirEntries
76 0 : pParent = pDir->GetFlag() == FSYS_FLAG_NORMAL ||
77 0 : pDir->GetFlag() == FSYS_FLAG_ABSROOT
78 : ? pDir
79 0 : : pDir->GetParent();
80 :
81 0 : }
82 :
83 0 : ~DirReader_Impl()
84 0 : { if( pDosDir ) closedir( pDosDir ); }
85 :
86 : // Init and Read are system-independent
87 : sal_uInt16 Init(); ///< Initializes (and if necessary) reads devices
88 : sal_uInt16 Read(); ///< Reads one entry and appends it if ok
89 : };
90 :
91 :
92 : struct FileCopier_Impl
93 : {
94 : FSysAction nActions; ///< action command (Copy/Move/recur)
95 : Link aErrorLink; ///< link to call upon errors
96 : ErrCode eErr; ///< current errorcode in the handler
97 : const DirEntry* pErrSource; ///< for Error-Handler in case of Source error
98 : const DirEntry* pErrTarget; ///< for Error-Handler in case of Target error
99 :
100 630 : FileCopier_Impl()
101 : : nActions( 0 ), eErr( 0 ),
102 630 : pErrSource( 0 ), pErrTarget( 0 )
103 630 : {}
104 : FileCopier_Impl( const FileCopier_Impl &rOrig )
105 : : nActions( rOrig.nActions ), eErr( 0 ),
106 : pErrSource( 0 ), pErrTarget( 0 )
107 : {}
108 :
109 0 : FileCopier_Impl& operator=( const FileCopier_Impl &rOrig )
110 : {
111 0 : nActions = rOrig.nActions;
112 0 : eErr = 0; pErrSource = 0; pErrTarget = 0;
113 0 : return *this;
114 : }
115 : };
116 :
117 : #if defined WNT
118 : sal_Bool IsRedirectable_Impl( const rtl::OString &rPath );
119 : #else
120 : #define IsRedirectable_Impl( rPath ) sal_True
121 : #endif
122 :
123 : #endif
124 :
125 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|