MrSID Decode SDK for Raster Reference Manual 9.5.4.4709

- Main Page
- Namespaces
- Classes
- Files
- Examples

- File List
- File Members

lt_fileSpec.h
Go to the documentation of this file.
1 /* //////////////////////////////////////////////////////////////////////////
2 // //
3 // This code is Copyright (c) 2004 LizardTech, Inc, 1008 Western Avenue, //
4 // Suite 200, Seattle, WA 98104. Unauthorized use or distribution //
5 // prohibited. Access to and use of this code is permitted only under //
6 // license from LizardTech, Inc. Portions of the code are protected by //
7 // US and foreign patents and other filings. All Rights Reserved. //
8 // //
10 /* PUBLIC */
11
12 #ifndef LT_FILESPEC_H
13 #define LT_FILESPEC_H
14
15 // lt_lib_base
16 #include "lt_base.h"
17 #include "lt_system.h"
18
19 LT_BEGIN_NAMESPACE(LizardTech)
23 #ifdef LT_OS_WIN
24 #define LT_UTIL_MAX_PATH _MAX_PATH
25 #else
26 #define LT_UTIL_MAX_PATH 2048
27 #endif
28
29 #if defined(LT_OS_WIN) && !defined(_NATIVE_WCHAR_T_DEFINED) && !defined (SWIG)
30 // Work within projects whether using native wchar_t or not ("/Zc:wchar_t-").
31 #define WCHAR_INTERNAL __wchar_t
32 #else
33 #define WCHAR_INTERNAL wchar_t
34 #endif
35
39 class LTFileSpec
40 {
41 public:
42 enum
43 {
44 fSlash = '/',
45 bSlash = '\\',
46 #ifdef LT_OS_WIN
47 platformSlash = '\\'
48 #else
49 platformSlash = '/'
50 #endif
51 };
52
53
54 public:
58 LTFileSpec(void);
59
63 ~LTFileSpec(void);
64
65 #ifndef SWIG
66
74 enum EncodingType { NATIVE, UTF8 };
75 LTFileSpec(const char *p1,
76 EncodingType encoding = NATIVE);
77 LTFileSpec(const char *p1, const char *p2,
78 EncodingType encoding = NATIVE);
79 LTFileSpec(const char *p1, const char *p2, const char *p3,
80 EncodingType encoding = NATIVE);
81 #endif
82
88 explicit LTFileSpec(const WCHAR_INTERNAL *p1);
89 LTFileSpec(const WCHAR_INTERNAL *p1, const WCHAR_INTERNAL *p2);
90 LTFileSpec(const WCHAR_INTERNAL *p1, const WCHAR_INTERNAL *p2, const WCHAR_INTERNAL *p3);
91
92 #ifndef SWIG
93
97 explicit LTFileSpec(const lt_uint16 *path);
98 LTFileSpec(const lt_uint16 *p1, const lt_uint16 *p2);
99 LTFileSpec(const lt_uint16 *p1, const lt_uint16 *p2, const lt_uint16 *p3);
100 #endif
101
102 LTFileSpec(const LTFileSpec &p1);
103 LTFileSpec(const LTFileSpec &p1, const LTFileSpec &p2);
104 LTFileSpec(const LTFileSpec &p1, const LTFileSpec &p2, const LTFileSpec &p3);
105 #ifndef SWIG
106 LTFileSpec(const LTFileSpec &p1, const char *p2,
107 EncodingType encoding);
108 LTFileSpec(const LTFileSpec &p1, const char *p2, const char *p3,
109 EncodingType encoding);
110 LTFileSpec(const LTFileSpec &p1, const LTFileSpec &p2, const char *p3,
111 EncodingType encoding);
112 #endif
113 LTFileSpec(const LTFileSpec &p1, const WCHAR_INTERNAL *p2);
114 LTFileSpec(const LTFileSpec &p1, const WCHAR_INTERNAL *p2, const WCHAR_INTERNAL *p3);
115 LTFileSpec(const LTFileSpec &p1, const LTFileSpec &p2, const WCHAR_INTERNAL *p3);
116
117 #ifndef SWIG
118 LTFileSpec(const LTFileSpec &p1, const lt_uint16 *p2);
119 LTFileSpec(const LTFileSpec &p1, const lt_uint16 *p2, const lt_uint16 *p3);
120 LTFileSpec(const LTFileSpec &p1, const LTFileSpec &p2, const lt_uint16 *p3);
121 #endif
122
128 LTFileSpec& operator=(const LTFileSpec &that);
129
133 bool operator!=(const LTFileSpec& fs) const;
134
138 bool operator==(const LTFileSpec& fs) const;
139
140 // is the fileSpec empty
141 bool empty(void) const;
142
146 const char *utf8(void) const;
147
154 const char *n_str(void) const;
155
162 const WCHAR_INTERNAL *w_str(void) const;
163
178 LTFileSpec dirname(void) const;
179
194 const char *basename(void) const;
195
204 const char* getSuffix() const;
205
218 LTFileSpec replaceSuffix(const char* ext) const;
219
230 LTFileSpec removeSuffix() const;
231
235 bool absolute() const;
236
237 protected:
238
243 void init(const char *p1, const char *p2, const char *p3);
244
245 size_t getPrefixLength(void) const;
246 private:
247 // using a utf8 string to hold the path because it is the easiest
248 // to play with (null and backslash searching, no lead bytes).
249 char *m_path8;
250 mutable char *m_pathA; // this will be updated in n_str()
251 mutable WCHAR_INTERNAL *m_pathW; // this will be updated in w_str()
252
253 };
254
255 LT_END_NAMESPACE(LizardTech)
256
257 #undef WCHAR_INTERNAL
258 #endif // LT_FILESPEC_H

LizardTech