-
Notifications
You must be signed in to change notification settings - Fork 1
/
complist.h
160 lines (127 loc) · 5.12 KB
/
complist.h
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
/*
* THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF
* ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
* PARTICULAR PURPOSE.
*
* Copyright (c) Microsoft Corporation. All Rights Reserved.
*/
#ifndef __COMPLIST_H__
#define __COMPLIST_H__
/*
*
* complist - a list of CompItems
*
* build a list of CompItems from various sources. That is to say, build
* two corresponding lists of filenames (DIRLISTs) and then build a list
* of CompItems, with one CompItem for each pair of files whose names
* match, and one CompItem for each unmatched name.
*
* when building the complist, a view handle can be given. If this is non-null,
* the CompList will register with the view (calling view_setcomplist), and
* will inform the view of each compitem added, during the build
* process (so that the user can be kept up to date during a lengthy scan).
*
* We can return a handle to this list of CompItems on demand.
*
* The CompList owns the DIRLISTs and the list of CompItems. If you delete
* the CompList, you delete all of these.
*/
/* view.h includes the term COMPLIST: we need to use the term VIEW.
* Alas MIPS doesn't allow duplicate definitions, even harmless ones,
* so we need to play games. Whoever declares it first does
* the real declares and the second one gets no-ops.
* We don't care what a VIEW is. Whatever you give us, we will
* pass to the view_setcomplist function and view_newitem, and that is all.
*/
#ifndef INC_VIEW_COMPLIST
#define INC_VIEW_COMPLIST
typedef struct compitem FAR* COMPITEM; /* handle to a compitem */
typedef struct view FAR * VIEW; /* handle to a VIEW */
typedef struct complist FAR * COMPLIST; /* handle to a complist */
#endif // INC_VIEW_COMPLIST
/*
* build a complist by putting up two dialogs to allow the user to
* select two files. This will build a Complist with one CompItem (even
* if the names don't match).
*/
COMPLIST complist_filedialog(VIEW view);
/*
* build a complist by putting up a dialog in which the user can specify
* two directories. The directories will then be scanned and a CompItem
* added to the list for each pair of names that match, and one for each
* unmatched name
*/
COMPLIST complist_dirdialog(VIEW view);
/* build a complist from the two pathnames provided */
COMPLIST complist_args(LPSTR path1, LPSTR path2, VIEW view, BOOL fDeep);
/* build/append a complist from the two pathnames provided (either or both is
* allowed to be null).
*/
void complist_append(COMPLIST *pcl, LPCSTR path1, LPCSTR path2, int *psequence);
BOOL complist_appendfinished(COMPLIST *pcl, LPCSTR pszLeft, LPCSTR pszRight, VIEW view);
/* delete a complist and all associated CompItems and DIRLISTs. Note this
* does not delete any VIEW - the VIEW owns the COMPLIST and not the other
* way around.
*/
void complist_delete(COMPLIST cl);
/*
* get the handle to the list of COMPITEMs. The list continues to be
* owned by the COMPLIST, so don't delete except by calling complist_delete.
*/
LIST complist_getitems(COMPLIST cl);
/* save the list of files as a series of lines to a file. query the user
* for the name of the file to write, and the states of lines to be
* included.
*
* if savename is not null, write the list out to savename using listopts.
* otherwise, prompt by dialog for filename and options.
*/
void complist_savelist(COMPLIST cl, LPSTR savename, UINT listopts);
/*
* get the description of this complist - a name in the form %s : %s with
* the dir_getrootdescription() for each side.
*/
LPSTR complist_getdescription(COMPLIST cl);
/* free up memory allocated in a call to complist_getdescription() */
void complist_freedescription(COMPLIST cl, LPSTR path);
/*
* copy files to a new directory newroot. if newroot is NULL, query the user
* via a dialog to get the new dir name and options.
*
* options are either COPY_FROMLEFT or COPY_FROMRIGHT (indicating which
* tree is to be the source of the files, plus any or all of
* INCLUDE_SAME, INCLUDE_DIFFER and INCLUDE_LEFT (INCLUDE_LEFT
* and INCLUDE_RIGHT are treated the same here since the COPY_FROM* option
* indicates which side to copy from).
*/
/* option flags */
#define COPY_FROMLEFT 0x100 /* copy files from left tree */
#define COPY_FROMRIGHT 0x200 /* copy files from right tree */
#define COPY_HITREADONLY 0x400 /* overwrite read only files */
void complist_copyfiles(COMPLIST cl, LPSTR newroot, UINT options);
/* return time last operation took in milliseconds */
DWORD complist_querytime(void);
/*
* complist_togglemark
*
* each compitem has a BOOL mark state. This function inverts the value of
* this state for each compitem in the list.
*/
void complist_togglemark(COMPLIST cl);
/*
* complist_itemcount
*
* return the number of items in the list
*/
UINT
complist_itemcount(COMPLIST cl);
/*
* query the user for a pattern to match.
* all compitems with this pattern in their tag string will be
* marked (the mark state will be set to TRUE);
*
* returns TRUE if any states changed
*/
BOOL complist_markpattern(COMPLIST cl);
#endif