Added documentation for non private functions.

This commit is contained in:
Quentin Snow 2023-01-22 17:21:31 -06:00
parent 3941e43e7f
commit 434eaf0ce0
3 changed files with 60 additions and 0 deletions

View File

@ -11,12 +11,52 @@
class Database {
public:
/**
* @brief Checks if an account exists in the database
*
* @param account The name of the account to check for
* @param db The database connection to use
*
* @return True if the account exists, false otherwise
*
* @throws std::runtime_error If the database query fails
*/
static bool doesAccountExist(const std::string &account, sqlite3 *db);
/**
* @brief Deletes an account from the database
*
* @param account The name of the account to delete
* @param db The database connection to use
*
* @return True if the account was successfully deleted, false otherwise
*
* @throws std::runtime_error If the database query fails
*/
static bool deleteAccount(const std::string &account, sqlite3 *db);
/**
* @brief Retrieves the cached value of an account from the database
*
* @param account The name of the account to retrieve the value of
* @param db The database connection to use
*
* @return The cached value of the account
*
* @throws std::runtime_error If the database query fails or the account doesn't exist
*/
static double getValue(const std::string &account, sqlite3 *db);
/**
* @brief Caches the value of an account by calculating the sum of all payments and earnings
*
* @param accountId The ID of the account to cache the value of
* @param db The database connection to use
*
* @return The cached value of the account
*
* @throws std::runtime_error If the database query fails
*/
static double cacheAccountValue(long long accountId, sqlite3 *db);
};

View File

@ -12,8 +12,21 @@
#include "operation.h"
namespace Budget::OptHandlers {
/**
* @class MainOptHandler
* @brief Handles command line options for the main menu of the budget application
*
* The MainOptHandler class handles command line options passed to the budget application. It uses the getopt_long function
* to parse the options and perform the corresponding actions.
*/
class MainOptHandler {
public:
/**
* @brief Constructor for MainOptHandler
*
* @param argv Vector of arguments passed to the application
* @param pSqlite3 The database connection to use
*/
explicit MainOptHandler(const std::vector<char *> &argv, sqlite3 *pSqlite3);
void help();

View File

@ -10,6 +10,13 @@
class Utilities {
public:
/**
* @brief Asks the user to confirm an action with a yes or no question
*
* @param question The question to ask the user
*
* @return True if the user confirms the action, false otherwise
*/
static bool confirm(const std::string &question);
};