Transaction manager header file. More...
#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <errno.h>
Go to the source code of this file.
Macros | |
#define | MAX_TRANSACTION_NAME_LENGTH 50 |
Maximum transaction name length. | |
#define | MAX_TRANSACTION_DATE_LENGTH 11 |
Maximum transaction date length. | |
#define | MAX_TRANSACTION_TOKEN_LENGTH 12 |
Maximum transaction token length. | |
Typedefs | |
typedef enum TransactionType | TransactionType |
Enumerations | |
enum | TransactionType { SELL , BUY } |
Transaction type enum. More... | |
Functions | |||||||||||||||||||||||||||||||
logTransaction | |||||||||||||||||||||||||||||||
Log transaction to file This function logs a transaction to the file
| |||||||||||||||||||||||||||||||
bool | logTransaction (TransactionType type, const char *name, uint32_t bloodId, uint32_t quantity, const char *date, const char *token) | ||||||||||||||||||||||||||||||
addTransaction | |||||||||||||||||||||||||||||||
Add transaction This function adds a transaction to the
| |||||||||||||||||||||||||||||||
bool | addTransaction (TransactionType type, const char *name, uint32_t bloodId, uint32_t quantity) | ||||||||||||||||||||||||||||||
void | displayTransactions (void) | ||||||||||||||||||||||||||||||
Display all transactions. | |||||||||||||||||||||||||||||||
void | freeTransaction (void) | ||||||||||||||||||||||||||||||
Free transaction list from memory. | |||||||||||||||||||||||||||||||
Transaction manager header file.
This file contains the declarations of the functions and structures for the transaction manager module.
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Definition in file transaction_manager.h.
#define MAX_TRANSACTION_DATE_LENGTH 11 |
Maximum transaction date length.
This macro defines the maximum length of the transaction date.
Definition at line 54 of file transaction_manager.h.
#define MAX_TRANSACTION_NAME_LENGTH 50 |
Maximum transaction name length.
This macro defines the maximum length of the transaction name.
Definition at line 47 of file transaction_manager.h.
#define MAX_TRANSACTION_TOKEN_LENGTH 12 |
Maximum transaction token length.
This macro defines the maximum length of the transaction token.
Definition at line 61 of file transaction_manager.h.
enum TransactionType |
Transaction type enum.
This enum defines the transaction type.
Enumerator | |
---|---|
SELL | Sell transaction type |
BUY | Buy transaction type |
Definition at line 68 of file transaction_manager.h.
bool addTransaction | ( | TransactionType | type, |
const char * | name, | ||
uint32_t | bloodId, | ||
uint32_t | quantity ) |
Definition at line 141 of file transaction_manager.c.
void displayTransactions | ( | void | ) |
Display all transactions.
This function displays all transactions from the file resources/db/transactions.log
.
resources/db/transactions.log
exists. If | the file `resources/db/transactions.log` cannot be opened, an error message is displayed. |
Definition at line 222 of file transaction_manager.c.
void freeTransaction | ( | void | ) |
Free transaction list from memory.
bool logTransaction | ( | TransactionType | type, |
const char * | name, | ||
uint32_t | bloodId, | ||
uint32_t | quantity, | ||
const char * | date, | ||
const char * | token ) |
Definition at line 68 of file transaction_manager.c.