Rudiments
|
Inherits object.
Public Member Functions | |
mvcresult () | |
virtual | ~mvcresult () |
void | setStatus (bool success) |
void | setStatus (bool success, uint32_t code) |
void | setStatus (bool success, uint32_t code, const char *message) |
void | setSuccess () |
void | setSuccess (uint32_t code) |
void | setSuccess (uint32_t code, const char *message) |
void | setFailed () |
void | setFailed (uint32_t code) |
void | setFailed (uint32_t code, const char *message) |
void | setSuccess (bool success) |
bool | getSuccess () |
void | setCode (uint32_t code) |
uint32_t | getCode () |
void | setMessage (const char *message) |
const char * | getMessage () |
void | setData (const char *key, collection *data) |
void | attachData (const char *key, collection *data) |
linkedlist< char * > * | getKeys () |
collection * | getData (const char *key) |
ssize_t | write () |
ssize_t | write (output *out) |
ssize_t | writeJson () |
ssize_t | writeJson (bool indent) |
ssize_t | writeJson (output *out) |
ssize_t | writeJson (output *out, bool indent) |
wastebasket * | getWastebasket () |
Public Member Functions inherited from object | |
virtual | ~object () |
The mvcresult class provides an object to which "results" can be attached and passed up from the DAO tier to other MVC tiers.
In the Rudiments MVC framework, collections (lists, dictionaries, trees, scalars, doms, etc.) are passed around between tiers instead of DTOs and/or domain objects. mvcresult objects provide a convenient object to attach collections to, as well as status, status codes and status messages.
Internally, each instance of mvcresult has:
status - true if the operation succeeded, and false if it failed status code - a specific success or error code status message - a specific success or error message data - a dictionary where each key is a string and each value is a collection wastebasket - an instance of the wastebasked class to which parent obejcts of the collections, or of members of the collections can be attached for future disposal
mvcresult::mvcresult | ( | ) |
Creates an instance of the mvcresult class.
|
virtual |
Deletes this instance of the mvcresult class.
void mvcresult::attachData | ( | const char * | key, |
collection * | data | ||
) |
Associates with collection "data" with string "key".
When using this method, "data" will be deleted when this instance of mvcresult is deleted.
uint32_t mvcresult::getCode | ( | ) |
Returns the status code as set by a previous call to setStatus(), setSuccess(), setFailed(), or setCode().
collection* mvcresult::getData | ( | const char * | key | ) |
Returns the collection associated with "key".
linkedlist<char *>* mvcresult::getKeys | ( | ) |
Returns the list of keys previously associated with collections using setData() or attachData().
const char* mvcresult::getMessage | ( | ) |
Returns the status message as set by a previous call to setStatus(), setSuccess(), setFailed(), or setMessage().
bool mvcresult::getSuccess | ( | ) |
Returns the status as set by a previous call to setStatus(), setSuccess(), setFailed(), or setSuccess().
wastebasket* mvcresult::getWastebasket | ( | ) |
Returns the wastebasket.
void mvcresult::setCode | ( | uint32_t | code | ) |
Sets the status code to "code" but does not change the status or status message.
void mvcresult::setData | ( | const char * | key, |
collection * | data | ||
) |
Associates with collection "data" with string "key".
When using this method, "data" will not be deleted when this instance of mvcresult is deleted.
void mvcresult::setFailed | ( | ) |
Sets the status to false (failure), status code to 0, and status message to NULL.
void mvcresult::setFailed | ( | uint32_t | code | ) |
Sets the status to false (failure), status code to "code", and status message to NULL.
void mvcresult::setFailed | ( | uint32_t | code, |
const char * | message | ||
) |
Sets the status to false (failure), status code to "code", and status message to "message".
void mvcresult::setMessage | ( | const char * | message | ) |
Sets the status message to "message" but does not change the status or status code.
void mvcresult::setStatus | ( | bool | success | ) |
Sets the status to "success", status code to 0, and status message to NULL.
void mvcresult::setStatus | ( | bool | success, |
uint32_t | code | ||
) |
Sets the status to "success", status code to "code", and status message to NULL.
void mvcresult::setStatus | ( | bool | success, |
uint32_t | code, | ||
const char * | message | ||
) |
Sets the status to "success", status code to "code", and status message to "message".
void mvcresult::setSuccess | ( | ) |
Sets the status to true (success), status code to 0, and status message to NULL.
void mvcresult::setSuccess | ( | bool | success | ) |
Sets the status "success" but does not change the status code or status message.
void mvcresult::setSuccess | ( | uint32_t | code | ) |
Sets the status to true (success), status code to "code", and status message to NULL.
void mvcresult::setSuccess | ( | uint32_t | code, |
const char * | message | ||
) |
Sets the status to true (success), status code to "code", and status message to "message".
ssize_t mvcresult::write | ( | ) |
Writes a representation (currently JSON) of the contents of the instance to standard output.
ssize_t mvcresult::write | ( | output * | out | ) |
Writes a representation (currently JSON) of the contents of the instance to "out".
ssize_t mvcresult::writeJson | ( | ) |
Writes an indented JSON representation of the contents of the instance to standard output.
ssize_t mvcresult::writeJson | ( | bool | indent | ) |
Writes a JSON representation of the contents of the instance to standard output.
The representation is indented if "indent" is true and not indented if "indent" is false.
ssize_t mvcresult::writeJson | ( | output * | out | ) |
Writes an indented JSON representation of the contents of the instance to "out".