1 /*  =========================================================================
2     zdir_patch - work with directory patches
3 
4     Copyright (c) the Contributors as noted in the AUTHORS file.
5     This file is part of CZMQ, the high-level C binding for 0MQ:
6     http://czmq.zeromq.org.
7 
8     This Source Code Form is subject to the terms of the Mozilla Public
9     License, v. 2.0. If a copy of the MPL was not distributed with this
10     file, You can obtain one at http://mozilla.org/MPL/2.0/.
11     =========================================================================
12 */
13 
14 #ifndef __ZDIR_PATCH_H_INCLUDED__
15 #define __ZDIR_PATCH_H_INCLUDED__
16 
17 #ifdef __cplusplus
18 extern "C" {
19 #endif
20 
21 // un-namespaced enumeration values
22 #define patch_create ZDIR_PATCH_CREATE
23 #define patch_delete ZDIR_PATCH_DELETE
24 
25 //  @warning THE FOLLOWING @INTERFACE BLOCK IS AUTO-GENERATED BY ZPROJECT
26 //  @warning Please edit the model at "api/zdir_patch.api" to make changes.
27 //  @interface
28 //  This is a stable class, and may not change except for emergencies. It
29 //  is provided in stable builds.
30 #define ZDIR_PATCH_CREATE 1                 // Creates a new file
31 #define ZDIR_PATCH_DELETE 2                 // Delete a file
32 
33 //  Create new patch
34 CZMQ_EXPORT zdir_patch_t *
35     zdir_patch_new (const char *path, zfile_t *file, int op, const char *alias);
36 
37 //  Destroy a patch
38 CZMQ_EXPORT void
39     zdir_patch_destroy (zdir_patch_t **self_p);
40 
41 //  Create copy of a patch. If the patch is null, or memory was exhausted,
42 //  returns null.
43 //  Caller owns return value and must destroy it when done.
44 CZMQ_EXPORT zdir_patch_t *
45     zdir_patch_dup (zdir_patch_t *self);
46 
47 //  Return patch file directory path
48 CZMQ_EXPORT const char *
49     zdir_patch_path (zdir_patch_t *self);
50 
51 //  Return patch file item
52 CZMQ_EXPORT zfile_t *
53     zdir_patch_file (zdir_patch_t *self);
54 
55 //  Return operation
56 CZMQ_EXPORT int
57     zdir_patch_op (zdir_patch_t *self);
58 
59 //  Return patch virtual file path
60 CZMQ_EXPORT const char *
61     zdir_patch_vpath (zdir_patch_t *self);
62 
63 //  Calculate hash digest for file (create only)
64 CZMQ_EXPORT void
65     zdir_patch_digest_set (zdir_patch_t *self);
66 
67 //  Return hash digest for patch file
68 CZMQ_EXPORT const char *
69     zdir_patch_digest (zdir_patch_t *self);
70 
71 //  Self test of this class.
72 CZMQ_EXPORT void
73     zdir_patch_test (bool verbose);
74 
75 //  @end
76 
77 
78 #ifdef __cplusplus
79 }
80 #endif
81 
82 #endif
83