💾 Archived View for gmi.noulin.net › gitRepositories › clispinner › file › clispinner.h.gmi captured on 2024-07-09 at 00:12:14. Gemini links have been rewritten to link to archived content
⬅️ Previous capture (2023-01-29)
-=-=-=-=-=-=-
clispinner.h (4057B)
1 #pragma once 2 3 #include "shpPackages/signalTimer/signalTimer.h" 4 5 #define startG(obj) (obj)->f->start(obj) 6 #define createTheSignalTimerG(obj) (obj)->f->createTheSignalTimer(obj) 7 #define setSignalTimerG(obj, signalTimer) (obj)->f->setSignalTimer(obj, signalTimer) 8 //pauseProcessG 9 #define setSpinStringG(obj, spinString) (obj)->f->setSpinString(obj, spinString) 10 //setInterval 11 #define isSpinningG(obj) (obj)->f->isSpinning(obj) 12 13 /* Class clispinner */ 14 typedef struct clispinner clispinnert; 15 16 /* for object inheriting clispinner, cast to clispinner to be able to use this class functions and generics*/ 17 #define cClispinner(self) ( (clispinnert*) self ) 18 19 typedef void (*freeClispinnerFt) (clispinnert *self); 20 typedef void (*terminateClispinnerFt) (clispinnert **self); 21 typedef char* (*toStringClispinnerFt) (clispinnert *self); 22 typedef clispinnert* (*duplicateClispinnerFt) (clispinnert *self); 23 typedef void (*smashClispinnerFt) (clispinnert **self); 24 25 /** 26 * free clispinner 27 */ 28 typedef void (*finishClispinnerFt) (clispinnert **self); 29 30 typedef void (*startClispinnerFt) (clispinnert *self); 31 typedef void (*stopClispinnerFt) (clispinnert *self); 32 typedef void (*createTheSignalTimerClispinnerFt)(clispinnert *self); 33 typedef void (*setSignalTimerClispinnerFt) (clispinnert *self, signalTimert * signalTimer); 34 typedef signalTimert* (*getSignalTimerClispinnerFt) (clispinnert *self); 35 typedef void (*pauseProcessClispinnerFt) (clispinnert *self); 36 typedef void (*setSpinStringClispinnerFt) (clispinnert *self, const char *spinString); 37 typedef void (*setIntervalClispinnerFt) (clispinnert *self, u64 interval); 38 typedef bool (*isSpinningClispinnerFt) (clispinnert *self); 39 40 #define CLISPINNERTITLESIZE 1024 41 42 /** 43 * class functions 44 * allocated once for all objects 45 * 46 * freed with finalizeClispinner 47 */ 48 49 /** 50 * use this define in child classes and add the new function after this class functions 51 * 52 * in this define, add the methods after <finishClispinnerFt finish;> 53 * 54 * Example: 55 * #define RINGFUNCTIONST \n * CLISPINNERFUNCTIONST; \n * setSizeRingFt setSize 56 */ 57 #define CLISPINNERFUNCTIONST \ 58 startClispinnerFt start;\ 59 stopClispinnerFt stop;\ 60 createTheSignalTimerClispinnerFt createTheSignalTimer;\ 61 setSignalTimerClispinnerFt setSignalTimer;\ 62 getSignalTimerClispinnerFt getSignalTimer;\ 63 pauseProcessClispinnerFt pauseProcess;\ 64 setSpinStringClispinnerFt setSpinString;\ 65 setIntervalClispinnerFt setInterval;\ 66 isSpinningClispinnerFt isSpinning; 67 68 69 typedef struct { 70 freeClispinnerFt free; 71 terminateClispinnerFt terminate; 72 toStringClispinnerFt toString; 73 duplicateClispinnerFt duplicate; 74 smashClispinnerFt smash; 75 finishClispinnerFt finish; 76 CLISPINNERFUNCTIONST; 77 } clispinnerFunctionst; 78 79 /** 80 * class 81 */ 82 struct clispinner { 83 const char *type; 84 clispinnerFunctionst *f; 85 bool isSpinning; 86 indexer ix; 87 u64 interval; 88 char title[CLISPINNERTITLESIZE]; 89 char spinString[32]; 90 }; 91 92 /* clispinner */ 93 94 #define createClispinner(obj) clispinnert obj; initiateClispinner(&obj) 95 #define createAllocateClispinner(obj) clispinnert *obj; initiateAllocateClispinner(&obj) 96 97 void initiateClispinner(clispinnert *self); 98 void initiateAllocateClispinner(clispinnert **self); 99 void finalizeClispinner(void); 100 101 /* initialize class methods, call registerMethodsClispinner from classes inheriting this class */ 102 void registerMethodsClispinner(clispinnerFunctionst *f); 103 104 clispinnert* allocClispinner(u64 interval, const char *title); 105 106 /* end class clispinner*/ 107 108 #define isClispinnerCompiledWithCurrentLisheepyVersion checkLibsheepyVersionClispinner(LIBSHEEPY_VERSION) 109 bool checkLibsheepyVersionClispinner(const char *currentLibsheepyVersion);