使用soui开发的mbc,只支持windows版本
w1146869587
2022-01-24 479b1995ef435713c2cf4f0da8de3a6af6c30922
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
////////////////////////////////////////////////////////////////////////////////
// This source file is part of the ZipArchive library source distribution and
// is Copyrighted 2000 - 2011 by Artpol Software - Tadeusz Dracz
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
// 
// For the licensing details refer to the License.txt file.
//
// Web Site: http://www.artpol-software.com
////////////////////////////////////////////////////////////////////////////////
 
/**
* \file ZipPathComponent.h
* Includes the CZipPathComponent class.
*
*/
#if !defined(ZIPARCHIVE_ZIPPATHCOMPONENT_DOT_H)
#define ZIPARCHIVE_ZIPPATHCOMPONENT_DOT_H
 
#if _MSC_VER > 1000
    #pragma once
    #if defined ZIP_HAS_DLL
        #pragma warning (push)
        #pragma warning( disable : 4251 ) // needs to have dll-interface to be used by clients of class
    #endif
#endif
 
#include "ZipString.h"
#include "ZipExport.h"
 
/**
    Splits a file path into components.
*/
class ZIP_API CZipPathComponent  
{
    
public:    
#ifdef _ZIP_SYSTEM_WIN
    static const CZipString PathPrefix;
    /**
        The type of the prefix in path.
    */
    enum PrefixType
    {
        ptNone = 0,            ///< There is no prefix present.
        ptUnc = 2,            ///< UNC path.
        ptUnicode = 4,        ///< Unicode path.
        ptUncWin = 8        ///< Windows UNC path.
    };    
    /**
        Returns the length of the path prefix detected.
 
        \param path
            The path to examine.
 
        \return
            The length of the path prefix or \c 0, if no prefix was detected.
    */
    static int IsPrefixed(const CZipString& path);
 
    /**
        Adds an UNC prefix to the paths.
 
        \param path
            The path to add a prefix to.
 
        \param isFolder
            \c true if the \a path points to a folder; \c false otherwise.
 
        \return
            The prefixed path.
    */
    static CZipString AddPrefix(LPCTSTR path, bool isFolder = true);
 
    /**
        Adds an UNC prefix to the paths.
 
        \param path
            The path to add a prefix to.
 
        \param isFolder
            \c true if the \a path points to a folder; \c false otherwise.
    */
    static void AddPrefix(CZipString& path, bool isFolder = true);
 
#endif
    CZipPathComponent(){}
    /**
        Initializes a new instance of the CZipPathComponent class.
 
        \param    lpszFullPath
            The full path to the file.
 
        \see
            SetFullPath
    */
    CZipPathComponent(LPCTSTR lpszFullPath)
    {
        SetFullPath(lpszFullPath);
    }
 
    virtual ~CZipPathComponent();
 
    static const TCHAR m_cSeparator; ///< A system specific default path separator.
 
    /**
        Appends a path separator to \a szPath, if it is not already appended.
 
        \param szPath
            The path to have a separator appended.
    */
    static void AppendSeparator(CZipString& szPath)
    {
        RemoveSeparators(szPath);
        szPath += m_cSeparator;
    }
 
    /**
        Combines a path information with a file name information.
 
        \param szPath
            Provides the path information and retrieves the result.
 
        \param lpszName
            The filename to be appended to the path.
    */
    static void Combine(CZipString& szPath, LPCTSTR lpszName)
    {
        AppendSeparator(szPath);
        if (lpszName != NULL)
            szPath += lpszName;
    }
 
    /**
        Removes path separators from the end of \a szPath
 
        \param szPath
            The path to have path separators removed.
    */
    static void RemoveSeparators(CZipString& szPath)
    {
        szPath.TrimRight(_T("\\/"));
    }
 
    /**
        Removes path separators from the beginning of \a szPath.
 
        \param szPath
            The path to have path separators removed.
    */
    static void RemoveSeparatorsLeft(CZipString& szPath)
    {
        szPath.TrimLeft(_T("\\/"));
    }
 
 
    /**
        Returns the value indicating whether the given character is a path separator.
 
        \param c 
            The character to test.
 
        \return
            \c true, if \a c is a path separator; \c false otherwise.
     */
    static bool IsSeparator(TCHAR c)
    {
        return c == _T('\\') || c == _T('/');
    }
    
    /**
        Checks if \a szPath has a path separator appended.
 
        \param szPath
            The path to be tested.
 
        \return
            \c true, if \a szPath has a path separator at the end; \c false otherwise.
    */
    static bool HasEndingSeparator(const CZipString& szPath)
    {
        int iLen = szPath.GetLength();
        if (iLen)
            return IsSeparator(szPath[iLen - 1]);
        else
            return false;
    }
    
    /**
        Sets the full path to the file.
 
        \param    lpszFullPath
            The full path to the file including a filename.
            The last element in the path is assumed to be the filename.
    */
    void SetFullPath(LPCTSTR lpszFullPath);
 
    /**
        Returns the name of the file without the extension (and without the path).
 
        \return
            The title of the file.
    */
    CZipString GetFileTitle() const { return m_szFileTitle;}
 
    /**
        Sets the file title (the name without the extension and without the path).
 
        \param    lpszFileTitle
            The title to set.
    */
    void SetFileTitle(LPCTSTR lpszFileTitle) { m_szFileTitle = lpszFileTitle;}
 
    
    /**
        Sets the extension.
 
        \param    lpszExt
            The extension to set. May contain the dot character at the beginning, but doesn't have to.
    */
    void SetExtension(LPCTSTR lpszExt) 
    {
        m_szFileExt = lpszExt;
        m_szFileExt.TrimLeft(_T('.'));
    }
 
    /**
        Returns the extension of the file.
 
        \return
            The extension without the dot character.
    */
    CZipString GetFileExt() const { return m_szFileExt;}
 
    /**
        Returns the drive of the file.
 
        \return
            The drive without a path separator at the end.
    */
    CZipString GetFileDrive() const { return m_szDrive;}
 
    /**
        Returns the full path to the file without the drive.
 
        \return
            The path without the drive and without a path separator at the beginning.
    */
    CZipString GetNoDrive() const ;
 
    /**
        Returns the filename.
 
        \return
            The filename including the extension and without the path.
    */
    CZipString GetFileName() const
    {
        CZipString szFullFileName = m_szFileTitle;
        if (!m_szFileExt.IsEmpty())
        {
            szFullFileName += _T(".");
            szFullFileName += m_szFileExt;
        }
        return szFullFileName;
    }
 
    /**
        Returns the full path to the file.
 
        \return
            The full path information including the filename.
    */
    CZipString GetFullPath() const
    {
        CZipString szFullPath = GetFilePath();
        CZipString szFileName = GetFileName();
        if (!szFileName.IsEmpty())
        {
            if (szFullPath.IsEmpty())
                szFullPath += _T('.');
            szFullPath  += m_cSeparator;
            szFullPath  += szFileName;
        }
        return szFullPath;
    }
 
    /**
        Returns the path part only.
 
        \return
            The file path without the filename and without a path separator at the end.
    */
    CZipString GetFilePath() const
    {
        CZipString szDrive = m_szDrive;
        CZipString szDir = m_szDirectory;
        if (!szDrive.IsEmpty() && !szDir.IsEmpty())
            szDrive += m_cSeparator;
 
        return m_szPrefix + szDrive + szDir;    
    }
protected:
    /**
        \name Path parts.
    */
    //@{
    CZipString m_szDirectory,    ///< The path without the filename and without path separators at the end and the beginning.
        m_szFileTitle,            ///< The filename without the extension.
        m_szFileExt,            ///< The file extension without the dot character.
        m_szDrive,                ///< The drive (if the system path standard uses it). It does not include a path separator at the end.
        m_szPrefix;                ///< The prefix (e.g. for the UNC path or Unicode path under Windows).
    //@}
    
};
 
#if (_MSC_VER > 1000) && (defined ZIP_HAS_DLL)
    #pragma warning (pop)    
#endif
 
 
#endif // !defined(ZIPARCHIVE_ZIPPATHCOMPONENT_DOT_H)