Rudiments
mvc.h
1// Copyright (c) 1999-2018 David Muse
2// See the COPYING file for more informations.
3
4#ifndef RUDIMENTS_MVC_H
5#define RUDIMENTS_MVC_H 1
6
7#include <rudiments/private/mvcincludes.h>
8
9
16class RUDIMENTS_DLLSPEC mvcsecurity : virtual public object {
17 public:
18
21
23 virtual ~mvcsecurity() {};
24
27 virtual const char *getUserName()=0;
28
29 #include <rudiments/private/mvcsecurity.h>
30};
31
32
36class RUDIMENTS_DLLSPEC httpbasicsecurity : public mvcsecurity {
37 public:
38
41
44
47
51
56 const char *getUserName();
57
58 #include <rudiments/private/httpbasicsecurity.h>
59};
60
61
75class RUDIMENTS_DLLSPEC mvcproperties : virtual public object {
76 public:
77
80
82 virtual ~mvcproperties();
83
86 bool parseFile(const char *filename);
87
90 bool parseString(const char *string);
91
94 const char *getValue(const char *property);
95
96 #include <rudiments/private/mvcproperties.h>
97};
98
99
108class RUDIMENTS_DLLSPEC mvctier : virtual public object {
109 public:
110
113
115 virtual ~mvctier();
116
119 virtual const char *getType();
120
123
127
130
134
135 #include <rudiments/private/mvctier.h>
136};
137
138
145class RUDIMENTS_DLLSPEC mvccontroller : public mvctier {
146 public:
147
150
152 virtual ~mvccontroller() {};
153
154 #include <rudiments/private/mvccontroller.h>
155};
156
157
164class RUDIMENTS_DLLSPEC mvcview : public mvctier {
165 public:
166
169
171 virtual ~mvcview();
172
175
179
182
186
187 #include <rudiments/private/mvcview.h>
188};
189
190
197class RUDIMENTS_DLLSPEC mvcservice : public mvctier {
198 public:
199
202
204 virtual ~mvcservice() {};
205
206 #include <rudiments/private/mvcservice.h>
207};
208
209
216class RUDIMENTS_DLLSPEC mvcdao : public mvctier {
217 public:
218
220 mvcdao() {};
221
223 virtual ~mvcdao() {};
224
225 #include <rudiments/private/mvcdao.h>
226};
227
228
248class RUDIMENTS_DLLSPEC mvcresult : virtual public object {
249 public:
250
253
255 virtual ~mvcresult();
256
259 void setStatus(bool success);
260
263 void setStatus(bool success, uint32_t code);
264
267 void setStatus(bool success, uint32_t code,
268 const char *message);
269
273
276 void setSuccess(uint32_t code);
277
280 void setSuccess(uint32_t code, const char *message);
281
284 void setFailed();
285
288 void setFailed(uint32_t code);
289
292 void setFailed(uint32_t code, const char *message);
293
296 void setSuccess(bool success);
297
301
304 void setCode(uint32_t code);
305
308 uint32_t getCode();
309
312 void setMessage(const char *message);
313
316 const char *getMessage();
317
322 void setData(const char *key,
323 collection *data);
324
329 void attachData(const char *key,
330 collection *data);
331
335
337 collection *getData(const char *key);
338
341 ssize_t write();
342
345 ssize_t write(output *out);
346
349 ssize_t writeJson();
350
356 ssize_t writeJson(bool indent);
357
360 ssize_t writeJson(output *out);
361
367 ssize_t writeJson(output *out, bool indent);
368
371
372 #include <rudiments/private/mvcresult.h>
373};
374
375
421class RUDIMENTS_DLLSPEC mvccrud : virtual public object {
422 public:
423
442 virtual bool doCreate(const char * const *columns,
443 const char * const *values,
444 const char * const *types)=0;
445
456 virtual bool doCreate(const char * const *columns,
457 const char * const *values);
458
468 virtual bool doCreate(
470
481 virtual bool doCreate(jsondom *j)=0;
482
500 virtual bool doRead(const char *criteria,
501 const char *sort,
502 uint64_t skip)=0;
503
522 virtual bool doRead(jsondom *j)=0;
523
544 virtual bool doUpdate(const char * const * columns,
545 const char * const *values,
546 const char * const *types,
547 const char *criteria)=0;
548
562 virtual bool doUpdate(const char * const * columns,
563 const char * const *values,
564 const char *criteria);
565
579 virtual bool doUpdate(
581 const char *criteria)=0;
582
597 virtual bool doUpdate(jsondom *j)=0;
598
608 virtual bool doDelete(const char *criteria)=0;
609
621 virtual bool doDelete(jsondom *j)=0;
622
625 virtual const char *getErrorMessage()=0;
626
629 virtual int64_t getErrorCode()=0;
630
637
644
651
658
665
672
679
686
693
694 protected:
697 virtual const char *deriveDataType(const char *value);
698};
699
700#include <rudiments/private/mvccrudinlines.h>
701
702#endif
Definition collection.h:11
Definition dictionary.h:12
Definition dictionarycollection.h:13
Definition mvc.h:36
void setRequest(httprequest *req)
const char * getUserName()
virtual ~httpbasicsecurity()
httprequest * getRequest()
Definition httprequest.h:12
Definition httpresponse.h:11
Definition jsondom.h:76
Definition linkedlist.h:47
Definition listcollection.h:37
Definition mvc.h:145
mvccontroller()
Definition mvc.h:149
virtual ~mvccontroller()
Definition mvc.h:152
Definition mvc.h:421
virtual int64_t getErrorCode()=0
virtual bool doCreate(jsondom *j)=0
virtual bool doCreate(dictionary< const char *, const char * > *kvp)=0
virtual scalarcollection< uint64_t > * getAffectedRowsScalar()=0
virtual bool doRead(jsondom *j)=0
virtual listcollection< const char * > * getFirstColumnList()=0
virtual bool doDelete(const char *criteria)=0
virtual listcollection< uint64_t > * getAffectedRowsList()=0
virtual dictionarycollection< const char *, uint64_t > * getAffectedRowsDictionary()=0
virtual tablecollection< const char * > * getResultSetTable()=0
virtual bool doUpdate(jsondom *j)=0
virtual bool doCreate(const char *const *columns, const char *const *values, const char *const *types)=0
virtual const char * getErrorMessage()=0
virtual bool doDelete(jsondom *j)=0
virtual bool doUpdate(const char *const *columns, const char *const *values, const char *const *types, const char *criteria)=0
virtual listcollection< const char * > * getFirstRowList()=0
virtual bool doUpdate(dictionary< const char *, const char * > *kvp, const char *criteria)=0
virtual scalarcollection< const char * > * getFirstFieldScalar()=0
virtual bool doRead(const char *criteria, const char *sort, uint64_t skip)=0
virtual tablecollection< uint64_t > * getAffectedRowsTable()=0
virtual dictionarycollection< const char *, const char * > * getFirstRowDictionary()=0
Definition mvc.h:216
virtual ~mvcdao()
Definition mvc.h:223
mvcdao()
Definition mvc.h:220
Definition mvc.h:75
const char * getValue(const char *property)
bool parseFile(const char *filename)
virtual ~mvcproperties()
bool parseString(const char *string)
Definition mvc.h:248
void setStatus(bool success, uint32_t code, const char *message)
ssize_t writeJson(output *out)
void setSuccess(bool success)
wastebasket * getWastebasket()
linkedlist< char * > * getKeys()
collection * getData(const char *key)
void setMessage(const char *message)
void setSuccess(uint32_t code, const char *message)
void setFailed()
void setStatus(bool success, uint32_t code)
void setSuccess()
void setData(const char *key, collection *data)
ssize_t write()
ssize_t writeJson()
ssize_t write(output *out)
void setStatus(bool success)
ssize_t writeJson(bool indent)
const char * getMessage()
uint32_t getCode()
ssize_t writeJson(output *out, bool indent)
void setFailed(uint32_t code, const char *message)
void attachData(const char *key, collection *data)
virtual ~mvcresult()
void setSuccess(uint32_t code)
void setFailed(uint32_t code)
bool getSuccess()
void setCode(uint32_t code)
Definition mvc.h:16
virtual ~mvcsecurity()
Definition mvc.h:23
virtual const char * getUserName()=0
mvcsecurity()
Definition mvc.h:20
Definition mvc.h:197
virtual ~mvcservice()
Definition mvc.h:204
mvcservice()
Definition mvc.h:201
Definition mvc.h:108
virtual ~mvctier()
mvcproperties * getProperties()
mvcsecurity * getSecurity()
virtual const char * getType()
void setSecurity(mvcsecurity *sec)
void setProperties(mvcproperties *prop)
Definition mvc.h:164
httpresponse * getResponse()
virtual ~mvcview()
httprequest * getRequest()
void setRequest(httprequest *req)
void setResponse(httpresponse *resp)
Definition object.h:10
Definition output.h:11
Definition scalarcollection.h:13
Definition tablecollection.h:35
Definition wastebasket.h:55