1 /*
2 ################################################################################
3 #  THIS FILE IS 100% GENERATED BY ZPROJECT; DO NOT EDIT EXCEPT EXPERIMENTALLY  #
4 #  Read the zproject/README.md for information about making permanent changes. #
5 ################################################################################
6 */
7 
8 #include "qczmq.h"
9 
10 ///
11 //  Copy-construct to return the proper wrapped c types
QZdir(zdir_t * self,QObject * qObjParent)12 QZdir::QZdir (zdir_t *self, QObject *qObjParent) : QObject (qObjParent)
13 {
14     this->self = self;
15 }
16 
17 
18 ///
19 //  Create a new directory item that loads in the full tree of the specified
20 //  path, optionally located under some parent path. If parent is "-", then
21 //  loads only the top-level directory, and does not use parent as a path.
QZdir(const QString & path,const QString & parent,QObject * qObjParent)22 QZdir::QZdir (const QString &path, const QString &parent, QObject *qObjParent) : QObject (qObjParent)
23 {
24     this->self = zdir_new (path.toUtf8().data(), parent.toUtf8().data());
25 }
26 
27 ///
28 //  Destroy a directory tree and all children it contains.
~QZdir()29 QZdir::~QZdir ()
30 {
31     zdir_destroy (&self);
32 }
33 
34 ///
35 //  Return directory path
path()36 const QString QZdir::path ()
37 {
38     const QString rv = QString (zdir_path (self));
39     return rv;
40 }
41 
42 ///
43 //  Return last modification time for directory.
modified()44 time_t QZdir::modified ()
45 {
46     time_t rv = zdir_modified (self);
47     return rv;
48 }
49 
50 ///
51 //  Return total hierarchy size, in bytes of data contained in all files
52 //  in the directory tree.
cursize()53 off_t QZdir::cursize ()
54 {
55     off_t rv = zdir_cursize (self);
56     return rv;
57 }
58 
59 ///
60 //  Return directory count
count()61 size_t QZdir::count ()
62 {
63     size_t rv = zdir_count (self);
64     return rv;
65 }
66 
67 ///
68 //  Returns a sorted list of zfile objects; Each entry in the list is a pointer
69 //  to a zfile_t item already allocated in the zdir tree. Do not destroy the
70 //  original zdir tree until you are done with this list.
list()71 QZlist * QZdir::list ()
72 {
73     QZlist *rv = new QZlist (zdir_list (self));
74     return rv;
75 }
76 
77 ///
78 //  Remove directory, optionally including all files that it contains, at
79 //  all levels. If force is false, will only remove the directory if empty.
80 //  If force is true, will remove all files and all subdirectories.
remove(bool force)81 void QZdir::remove (bool force)
82 {
83     zdir_remove (self, force);
84 
85 }
86 
87 ///
88 //  Calculate differences between two versions of a directory tree.
89 //  Returns a list of zdir_patch_t patches. Either older or newer may
90 //  be null, indicating the directory is empty/absent. If alias is set,
91 //  generates virtual filename (minus path, plus alias).
diff(QZdir * older,QZdir * newer,const QString & alias)92 QZlist * QZdir::diff (QZdir *older, QZdir *newer, const QString &alias)
93 {
94     QZlist *rv = new QZlist (zdir_diff (older->self, newer->self, alias.toUtf8().data()));
95     return rv;
96 }
97 
98 ///
99 //  Return full contents of directory as a zdir_patch list.
resync(const QString & alias)100 QZlist * QZdir::resync (const QString &alias)
101 {
102     QZlist *rv = new QZlist (zdir_resync (self, alias.toUtf8().data()));
103     return rv;
104 }
105 
106 ///
107 //  Load directory cache; returns a hash table containing the SHA-1 digests
108 //  of every file in the tree. The cache is saved between runs in .cache.
cache()109 QZhash * QZdir::cache ()
110 {
111     QZhash *rv = new QZhash (zdir_cache (self));
112     return rv;
113 }
114 
115 ///
116 //  Print contents of directory to open stream
fprint(FILE * file,int indent)117 void QZdir::fprint (FILE *file, int indent)
118 {
119     zdir_fprint (self, file, indent);
120 
121 }
122 
123 ///
124 //  Print contents of directory to stdout
print(int indent)125 void QZdir::print (int indent)
126 {
127     zdir_print (self, indent);
128 
129 }
130 
131 ///
132 //  Create a new zdir_watch actor instance:
133 //
134 //      zactor_t *watch = zactor_new (zdir_watch, NULL);
135 //
136 //  Destroy zdir_watch instance:
137 //
138 //      zactor_destroy (&watch);
139 //
140 //  Enable verbose logging of commands and activity:
141 //
142 //      zstr_send (watch, "VERBOSE");
143 //
144 //  Subscribe to changes to a directory path:
145 //
146 //      zsock_send (watch, "ss", "SUBSCRIBE", "directory_path");
147 //
148 //  Unsubscribe from changes to a directory path:
149 //
150 //      zsock_send (watch, "ss", "UNSUBSCRIBE", "directory_path");
151 //
152 //  Receive directory changes:
153 //      zsock_recv (watch, "sp", &path, &patches);
154 //
155 //      // Delete the received data.
156 //      free (path);
157 //      zlist_destroy (&patches);
watch(QZsock * pipe,void * unused)158 void QZdir::watch (QZsock *pipe, void *unused)
159 {
160     zdir_watch (pipe->self, unused);
161 
162 }
163 
164 ///
165 //  Self test of this class.
test(bool verbose)166 void QZdir::test (bool verbose)
167 {
168     zdir_test (verbose);
169 
170 }
171 /*
172 ################################################################################
173 #  THIS FILE IS 100% GENERATED BY ZPROJECT; DO NOT EDIT EXCEPT EXPERIMENTALLY  #
174 #  Read the zproject/README.md for information about making permanent changes. #
175 ################################################################################
176 */
177