libsheepy
libsheepyCSmallBool.h
Go to the documentation of this file.
1 // MIT License
2 //
3 // Copyright (c) 2023 Remy Noulin
4 //
5 // Permission is hereby granted, free of charge, to any person obtaining a copy
6 // of this software and associated documentation files (the "Software"), to deal
7 // in the Software without restriction, including without limitation the rights
8 // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 // copies of the Software, and to permit persons to whom the Software is
10 // furnished to do so, subject to the following conditions:
11 //
12 // The above copyright notice and this permission notice shall be included in all
13 // copies or substantial portions of the Software.
14 //
15 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 // SOFTWARE.
22 #pragma once
23 
24 #include <stdbool.h>
25 
26 // Class smallBool
27 typedef struct smallBool smallBoolt;
28 
34 #define helpTextSmallBool "TODO smallBool help brief, class description /*, definitions,*/ methods, examples"
35 
36 // for object inheriting smallBool, cast to smallBool to be able to use this class functions and generics
37 #define cBo(self) ( (smallBoolt*) self )
38 
39 typedef void (*freeSmallBoolFt) (smallBoolt *self);
40 typedef void (*terminateSmallBoolFt) (smallBoolt **self);
41 typedef char* (*toStringSmallBoolFt) (smallBoolt *self);
42 typedef smallBoolt* (*duplicateSmallBoolFt) (smallBoolt *self);
43 
44 // smallBool functions
51 typedef void (*smashSmallBoolFt) (smallBoolt **self);
52 
56 typedef void (*finishSmallBoolFt) (smallBoolt **self);
57 
58 typedef const char* (*helpSmallBoolFt) (smallBoolt *self);
59 
68 typedef bool (*getSmallBoolFt) (smallBoolt *self);
69 
76 typedef smallBoolt* (*setSmallBoolFt) (smallBoolt *self, bool value);
77 
78 typedef smallBoolt* (*setDoubleSmallBoolFt) (smallBoolt* self, double p2);
79 typedef smallBoolt* (*setInt64SmallBoolFt) (smallBoolt* self, int64_t p2);
80 typedef smallBoolt* (*setInt32SmallBoolFt) (smallBoolt* self, int32_t p2);
81 typedef smallBoolt* (*setUint32SmallBoolFt) (smallBoolt* self, uint32_t p2);
82 typedef smallBoolt* (*setUint64SmallBoolFt) (smallBoolt* self, uint64_t p2);
83 typedef smallBoolt* (*setSSmallBoolFt) (smallBoolt* self, const char* p2);
84 typedef smallBoolt* (*setSmallBoolSmallBoolFt) (smallBoolt* self, smallBoolt* p2);
85 typedef smallBoolt* (*setSmallDoubleSmallBoolFt)(smallBoolt* self, smallDoublet* p2);
86 typedef smallBoolt* (*setSmallIntSmallBoolFt) (smallBoolt* self, smallIntt* p2);
87 typedef smallBoolt* (*setSmallJsonSmallBoolFt) (smallBoolt* self, smallJsont* p2);
88 typedef smallBoolt* (*setSmallStringSmallBoolFt)(smallBoolt* self, smallStringt* p2);
89 
96 typedef bool* (*getPSmallBoolFt) (smallBoolt *self);
97 
98 typedef bool (*equalSmallBoolCharFt)(smallBoolt* self, const char * p2);
99 typedef bool (*equalSmallBoolBaseFt)(smallBoolt* self, baset* p2);
100 typedef bool (*equalSmallBoolBoolFt)(smallBoolt* self, bool p2);
101 typedef bool (*equalSmallBoolDoubleFt)(smallBoolt* self, double p2);
102 typedef bool (*equalSmallBoolInt64Ft)(smallBoolt* self, int64_t p2);
103 typedef bool (*equalSmallBoolInt32Ft)(smallBoolt* self, int32_t p2);
104 typedef bool (*equalSmallBoolUint32Ft)(smallBoolt* self, uint32_t p2);
105 typedef bool (*equalSmallBoolUint64Ft)(smallBoolt* self, uint64_t p2);
106 typedef bool (*equalSmallBoolFt)(smallBoolt* self, smallBoolt* p2);
108 typedef bool (*equalSmallBoolSmallIntFt)(smallBoolt* self, smallIntt* p2);
109 typedef bool (*equalSmallBoolSmallJsonFt)(smallBoolt* self, smallJsont* p2);
112 
122 typedef smallBoolt* (*readFileSmallBoolFt)(smallBoolt *self, const char *filePath);
123 typedef smallBoolt* (*readFileSmallJsonSmallBoolFt)(smallBoolt *self, smallJsont *filePath);
124 typedef smallBoolt* (*readFileSmallStringSmallBoolFt)(smallBoolt *self, smallStringt *filePath);
125 typedef smallBoolt* (*readStreamSmallBoolFt)(smallBoolt *self, FILE *fp);
126 
136 typedef int (*writeFileSmallBoolFt) (smallBoolt *self, const char *filePath);
137 typedef int (*writeFileSmallJsonSmallBoolFt) (smallBoolt *self, smallJsont *filePath);
138 typedef int (*writeFileSmallStringSmallBoolFt)(smallBoolt *self, smallStringt *filePath);
139 typedef int (*writeStreamSmallBoolFt) (smallBoolt *self, FILE *fp);
140 
150 typedef int (*appendFileSmallBoolFt)(smallBoolt *self, const char *filePath);
152 
170 #define SMALLBOOLFUNCTIONST \
171  helpSmallBoolFt help;\
172  getSmallBoolFt get;\
173  setSmallBoolFt set;\
174  setDoubleSmallBoolFt setDouble;\
175  setInt64SmallBoolFt setInt64;\
176  setInt32SmallBoolFt setInt32;\
177  setUint32SmallBoolFt setUint32;\
178  setUint64SmallBoolFt setUint64;\
179  setSSmallBoolFt setS;\
180  setSmallBoolSmallBoolFt setSmallBool;\
181  setSmallDoubleSmallBoolFt setSmallDouble;\
182  setSmallIntSmallBoolFt setSmallInt;\
183  setSmallJsonSmallBoolFt setSmallJson;\
184  setSmallStringSmallBoolFt setSmallString;\
185  getPSmallBoolFt getP;\
186  equalSmallBoolCharFt equalChar;\
187  equalSmallBoolBaseFt equalBase;\
188  equalSmallBoolBoolFt equalBool;\
189  equalSmallBoolDoubleFt equalDouble;\
190  equalSmallBoolInt64Ft equalInt64;\
191  equalSmallBoolInt32Ft equalInt32;\
192  equalSmallBoolUint32Ft equalUint32;\
193  equalSmallBoolUint64Ft equalUint64;\
194  equalSmallBoolFt equal;\
195  equalSmallBoolSmallBytesFt equalSmallBytes;\
196  equalSmallBoolSmallDoubleFt equalSmallDouble;\
197  equalSmallBoolSmallIntFt equalSmallInt;\
198  equalSmallBoolSmallJsonFt equalSmallJson;\
199  equalSmallBoolSmallStringFt equalSmallString;\
200  readFileSmallBoolFt readFile;\
201  readFileSmallJsonSmallBoolFt readFileSmallJson;\
202  readFileSmallStringSmallBoolFt readFileSmallString;\
203  readStreamSmallBoolFt readStream;\
204  writeFileSmallBoolFt writeFile;\
205  writeFileSmallJsonSmallBoolFt writeFileSmallJson;\
206  writeFileSmallStringSmallBoolFt writeFileSmallString;\
207  writeStreamSmallBoolFt writeStream;\
208  appendFileSmallBoolFt appendFile;\
209  appendFileSmallStringSmallBoolFt appendFileSmallString
210 
211 typedef struct {
220 
224 struct smallBool {
225  const char *type;
227 
230 };
231 
232 // smallBool
233 
234 #define createSmallBool(obj) ;smallBoolt obj; initiateSmallBool(&obj)
235 #define createAllocateSmallBool(obj) ;smallBoolt *obj; initiateAllocateSmallBool(&obj)
236 
237 void initiateSmallBool(smallBoolt *self);
239 void finalizeRecycleSmallBool(void *arg UNUSED);
240 void finalizeSmallBool(void);
241 
242 // initialize class methods, call registerMethodsSmallBool from classes inheriting this class
244 
246 
247 // terminate smallBoolt val when it is out of scope
249 
250 // free smallBoolt local val when it is out of scope
252 
253 // free smallBoolt val when it is out of scope
255 
256 // finish smallBoolt val when it is out of scope
258 
262 #define cleanSmallBoolP(name) smallBoolt *name CLEANUP(cleanUpSmallBoolTerminateG)
263 
267 #define cleanAllocateSmallBool(obj) ;cleanSmallBoolP(obj); initiateAllocateSmallBool(&obj)
268 
272 #define cleanSmallBool(name) smallBoolt name CLEANUP(cleanUpSmallBoolFreeLocalG); initiateSmallBool(&name)
273 
277 #define cleanFreeSmallBool(name) smallBoolt *name CLEANUP(cleanUpSmallBoolFreeG)
278 
282 #define cleanFinishSmallBoolP(name) smallBoolt *name CLEANUP(cleanUpSmallBoolFinishG)
283 
285 
286 void freeSmallBoolG (smallBoolt *self);
287 
288 bool getBoolSmallBoolG (smallBoolt *self, bool retType UNUSED, int64_t index UNUSED);
289 bool* getBoolPSmallBoolG (smallBoolt *self, bool* retType UNUSED, int64_t index UNUSED);
290 
291 smallBoolt* setSmallBoolG(smallBoolt* self, bool p2);
292 smallBoolt* setDoubleSmallBoolG(smallBoolt* self, double p2);
293 smallBoolt* setInt64SmallBoolG(smallBoolt* self, int64_t p2);
294 smallBoolt* setInt32SmallBoolG(smallBoolt* self, int32_t p2);
295 smallBoolt* setUint32SmallBoolG(smallBoolt* self, uint32_t p2);
296 smallBoolt* setUint64SmallBoolG(smallBoolt* self, uint64_t p2);
297 smallBoolt* setSSmallBoolG(smallBoolt* self, const char* p2);
303 
304 bool equalSmallBoolCharG(smallBoolt* self, const char * p2);
305 bool equalSmallBoolBaseG(smallBoolt* self, baset* p2);
306 bool equalSmallBoolBoolG(smallBoolt* self, bool p2);
307 bool equalSmallBoolDoubleG(smallBoolt* self, double p2);
308 bool equalSmallBoolInt64G(smallBoolt* self, int64_t p2);
309 bool equalSmallBoolInt32G(smallBoolt* self, int32_t p2);
310 bool equalSmallBoolUint32G(smallBoolt* self, uint32_t p2);
311 bool equalSmallBoolUint64G(smallBoolt* self, uint64_t p2);
312 bool equalSmallBoolFG(smallBoolt* self, smallBoolt* p2);
318 
319 smallBoolt* readFileSmallBoolG (smallBoolt *self, const char *filePath);
323 int writeFileSmallBoolG (smallBoolt *self, const char *filePath);
324 int writeFileSmallJsonSmallBoolG (smallBoolt *self, smallJsont *filePath);
326 int writeStreamSmallBoolG (smallBoolt *self, FILE *fp);
327 int appendFileSmallBoolFG (smallBoolt *self, const char *filePath); //TODO remove F - oGMacros generates a macro making the compilation fail
329 // end class smallBool
bool getBoolSmallBoolG(smallBoolt *self, bool retType UNUSED, int64_t index UNUSED)
void initiateAllocateSmallBool(smallBoolt **self)
bool(* equalSmallBoolSmallJsonFt)(smallBoolt *self, smallJsont *p2)
int writeFileSmallJsonSmallBoolG(smallBoolt *self, smallJsont *filePath)
bool equalSmallBoolInt32G(smallBoolt *self, int32_t p2)
bool * getBoolPSmallBoolG(smallBoolt *self, bool *retType UNUSED, int64_t index UNUSED)
int writeFileSmallStringSmallBoolG(smallBoolt *self, smallStringt *filePath)
bool equalSmallBoolInt64G(smallBoolt *self, int64_t p2)
void(* terminateSmallBoolFt)(smallBoolt **self)
void initiateSmallBool(smallBoolt *self)
int(* appendFileSmallBoolFt)(smallBoolt *self, const char *filePath)
append bool to filePath
void cleanUpSmallBoolFreeG(smallBoolt **val)
int(* writeFileSmallJsonSmallBoolFt)(smallBoolt *self, smallJsont *filePath)
smallBoolt * readFileSmallStringSmallBoolG(smallBoolt *self, smallStringt *filePath)
bool(* equalSmallBoolInt64Ft)(smallBoolt *self, int64_t p2)
void cleanUpSmallBoolTerminateG(smallBoolt **val)
smallBoolt * setInt32SmallBoolG(smallBoolt *self, int32_t p2)
terminateSmallBoolFt terminate
void registerMethodsSmallBool(smallBoolFunctionst *f)
smallBoolt * setDoubleSmallBoolG(smallBoolt *self, double p2)
bool equalSmallBoolDoubleG(smallBoolt *self, double p2)
bool(* equalSmallBoolBaseFt)(smallBoolt *self, baset *p2)
bool(* equalSmallBoolSmallDoubleFt)(smallBoolt *self, smallDoublet *p2)
bool equalSmallBoolSmallJsonG(smallBoolt *self, smallJsont *p2)
sBoolt * value
bool value
bool(* equalSmallBoolUint64Ft)(smallBoolt *self, uint64_t p2)
bool(* equalSmallBoolSmallIntFt)(smallBoolt *self, smallIntt *p2)
char *(* toStringSmallBoolFt)(smallBoolt *self)
smallBoolt * setSmallBoolSmallBoolG(smallBoolt *self, smallBoolt *p2)
int writeFileSmallBoolG(smallBoolt *self, const char *filePath)
int writeStreamSmallBoolG(smallBoolt *self, FILE *fp)
int(* writeFileSmallBoolFt)(smallBoolt *self, const char *filePath)
write bool to file
smallBoolt * allocSmallBool(bool value)
bool(* equalSmallBoolCharFt)(smallBoolt *self, const char *p2)
bool equalSmallBoolSmallBytesG(smallBoolt *self, smallBytest *p2)
END_TEST FILE * fp
void freeSmallBoolG(smallBoolt *self)
int(* writeFileSmallStringSmallBoolFt)(smallBoolt *self, smallStringt *filePath)
bool equalSmallBoolFG(smallBoolt *self, smallBoolt *p2)
void cleanUpSmallBoolFinishG(smallBoolt **val)
smallBoolt * setSSmallBoolG(smallBoolt *self, const char *p2)
void(* freeSmallBoolFt)(smallBoolt *self)
const char * type
smashSmallBoolFt smash
smallBoolt * setSmallIntSmallBoolG(smallBoolt *self, smallIntt *p2)
toStringSmallBoolFt toString
int(* writeStreamSmallBoolFt)(smallBoolt *self, FILE *fp)
bool(* equalSmallBoolBoolFt)(smallBoolt *self, bool p2)
smallBoolt * setSmallJsonSmallBoolG(smallBoolt *self, smallJsont *p2)
bool equalSmallBoolCharG(smallBoolt *self, const char *p2)
bool equalSmallBoolUint32G(smallBoolt *self, uint32_t p2)
void(* finishSmallBoolFt)(smallBoolt **self)
free container
bool(* equalSmallBoolFt)(smallBoolt *self, smallBoolt *p2)
bool(* equalSmallBoolUint32Ft)(smallBoolt *self, uint32_t p2)
smallBoolt * setSmallBoolG(smallBoolt *self, bool p2)
bool(* equalSmallBoolInt32Ft)(smallBoolt *self, int32_t p2)
int appendFileSmallStringSmallBoolG(smallBoolt *self, smallStringt *filePath)
bool(* equalSmallBoolDoubleFt)(smallBoolt *self, double p2)
smallBoolt * readFileSmallJsonSmallBoolG(smallBoolt *self, smallJsont *filePath)
in value value
finishSmallBoolFt finish
bool(* getSmallBoolFt)(smallBoolt *self)
get a copy of smallBool
bool equalSmallBoolUint64G(smallBoolt *self, uint64_t p2)
small bool
smallBoolt * setUint32SmallBoolG(smallBoolt *self, uint32_t p2)
bool(* equalSmallBoolSmallStringFt)(smallBoolt *self, smallStringt *p2)
bool equalSmallBoolBaseG(smallBoolt *self, baset *p2)
#define UNUSED
Definition: libsheepy.h:8195
bool equalSmallBoolSmallDoubleG(smallBoolt *self, smallDoublet *p2)
void cleanUpSmallBoolFreeLocalG(smallBoolt *val)
smallBoolt * setSmallStringSmallBoolG(smallBoolt *self, smallStringt *p2)
smallBoolt * readStreamSmallBoolG(smallBoolt *self, FILE *fp)
int(* appendFileSmallStringSmallBoolFt)(smallBoolt *self, smallStringt *filePath)
void finalizeRecycleSmallBool(void *arg UNUSED)
smallBoolFunctionst * f
smallBoolt * setUint64SmallBoolG(smallBoolt *self, uint64_t p2)
void finalizeSmallBool(void)
void(* smashSmallBoolFt)(smallBoolt **self)
free self but not the smallBool buffer
smallBoolt *(* duplicateSmallBoolFt)(smallBoolt *self)
base class
smallBoolt * duplicateSmallBoolG(smallBoolt *self)
bool(* equalSmallBoolSmallBytesFt)(smallBoolt *self, smallBytest *p2)
smallBoolt * setInt64SmallBoolG(smallBoolt *self, int64_t p2)
bool equalSmallBoolSmallIntG(smallBoolt *self, smallIntt *p2)
int appendFileSmallBoolFG(smallBoolt *self, const char *filePath)
bool equalSmallBoolBoolG(smallBoolt *self, bool p2)
smallBoolt * setSmallDoubleSmallBoolG(smallBoolt *self, smallDoublet *p2)
smallBoolt * readFileSmallBoolG(smallBoolt *self, const char *filePath)
bool equalSmallBoolSmallStringG(smallBoolt *self, smallStringt *p2)
duplicateSmallBoolFt duplicate