UNIVERS
15.3
UNIVERS base processing software API
Main Page
Namespaces
Classes
Files
Examples
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
include
mix
PortableDirs.h
1
/* PortableDirs.h */
2
/* $Id: PortableDirs.h,v 1.13 2006/10/18 10:21:07 vlad Exp $ */
3
4
#ifndef __PortableDirs_h
5
6
#define __PortableDirs_h
7
8
#include <dirent.h>
9
#include <sys/types.h>
10
#include <sys/stat.h>
11
#include <mix/Types.h>
12
#include <mix/Exceptions.h>
13
14
/*************************************************************
15
* Portable directory toolkit
16
* Parts:
17
* -- portable directory entry structure;
18
* -- OS-independent dir-scan function.
19
*************************************************************/
20
21
#ifdef _AIX
22
#include <limits.h>
23
# define MAX_DIR_NAME _D_NAME_MAX
24
#endif
/* _AIX */
25
#ifdef sparc
26
# define MAX_DIR_NAME 255
27
#endif
/* sparc */
28
#ifdef linux
29
# define MAX_DIR_NAME 255
30
#endif
/* linux */
31
#ifdef bsd
32
# define MAX_DIR_NAME MAXNAMLEN
33
#endif
/* bsd */
34
35
/* For UNIX only */
36
#define PATH_DELIM_CHAR '/'
37
38
39
#ifdef __cplusplus
40
extern
"C"
41
{
42
#endif
/* __cplusplus */
43
48
typedef
struct
49
{
50
const
char
*dir;
/* pointer at the directory of file */
51
const
char
*name;
/* file name */
52
const
char
*path;
/* full file path */
53
struct
stat *desc;
/* pointer at the file description */
54
55
}
PortDirEntry
;
56
57
63
typedef
struct
dir_entry_item
64
{
65
struct
dir_entry_item
*next;
/* pointer to the next item */
66
char
name[MAX_DIR_NAME+1];
/* file name */
67
struct
stat buf;
/* file description */
68
69
}
DirEntryItem
;
70
71
76
typedef
Logic (*PortDirCB)(
const
PortDirEntry
* pDirEnt,
77
void
* pUserData);
78
92
ErrCode DirIter (
const
char
* szDirPath,
93
PortDirCB forEachEntry,
94
void
* pUserData);
95
96
111
DirEntryItem
* BuildDirList (
const
char
* szDirPath,
112
PortDirCB ifSelected,
113
int
* pItemsCount,
114
void
* pUserData);
115
120
void
DestroyDirList (
DirEntryItem
* head);
121
122
139
int
AutoCountedFileName (
const
char
* szDirPath,
140
const
char
* szTemplateFileName,
141
char
** pszResultFileName,
142
int
nDig);
143
144
154
char
* BuildFilePath (
const
char
* szDirPath,
155
const
char
* szFileName);
156
157
158
/*************************************************************
159
* Build path from directory and file name in given buffer or
160
* dynamically allocated.
161
*************************************************************/
162
char
* BuildFilePathHere (
const
char
* szDirPath,
163
const
char
* szFileName,
164
char
* szFilePath);
165
171
char
* BuildFilePathVa (
const
char
* szPart1, ...);
172
173
174
/*************************************************************
175
*
176
* Custom file selectors
177
*
178
*************************************************************/
179
180
Logic SelectDirs (
const
PortDirEntry
* pDirEnt,
void
* pUserData);
181
Logic SelectNonHiddenDirs (
const
PortDirEntry
* pDirEnt,
void
* pUserData);
182
Logic SelectFiles (
const
PortDirEntry
* pDirEnt,
void
* pUserData);
183
Logic SelectMtabs (
const
PortDirEntry
* pDirEnt,
void
* pUserData);
184
Logic SelectDRSdats (
const
PortDirEntry
* pDirEnt,
void
* pUserData);
185
Logic SelectWildcard (
const
PortDirEntry
* pDirEnt,
void
* pFileMask);
186
189
Logic SelectDbTables (
const
PortDirEntry
* pDirEnt,
void
* pDbNameMask);
190
191
192
#ifdef __cplusplus
193
};
194
#endif
/* __cplusplus */
195
196
#endif
/* PortableDirs.h */
PortDirEntry
Definition:
PortableDirs.h:48
dir_entry_item
Definition:
PortableDirs.h:63
Generated by
1.8.5