Client - Documentation for `enumitems` (commented out)
[tpg/opendispense2.git] / src / cokebank.h
index d94e36f..45d1304 100644 (file)
 #include <stdlib.h>
 
 #define COKEBANK_SALES_ACCT    ">sales"        //!< Sales made into
+#define COKEBANK_SALES_PREFIX  ">sales:"       //!< Sales made into
 #define COKEBANK_DEBT_ACCT     ">liability"    //!< Credit taken out of
 #define COKEBANK_FREE_ACCT     ">freeitems"    //!< ODay drink costs taken out of
+#define COKEBANK_DONATE_ACCT   ">donations"    //!< Donations go here
 
 /**
  * \brief Account iterator opaque structure
  */
 typedef struct sAcctIterator   tAcctIterator;
 
+#if 0
+/**
+ * \brief Iterator for a collection of items
+ */
+typedef struct sItemIterator   tItemIterator;
+
+/**
+ * \brief Item structure
+ */
+typedef struct
+{
+       char    *Handler;
+        int    ID;
+        int    Price;
+       char    Name[];
+}      tItem;
+#endif
+
+/**
+ * \brief Flag values for the \a Flags parameter to Bank_Iterator
+ */
 enum eBank_ItFlags
 {
-       BANK_ITFLAG_MINBALANCE  = 0x01,
-       BANK_ITFLAG_MAXBALANCE  = 0x02,
-       BANK_ITFLAG_SEENBEFORE  = 0x04,
-       BANK_ITFLAG_SEENAFTER   = 0x08,
+       BANK_ITFLAG_MINBALANCE  = 0x01, //!< Balance value is Minium Balance
+       BANK_ITFLAG_MAXBALANCE  = 0x02, //!< Balance value is Maximum Balance (higher priority)
+       BANK_ITFLAG_SEENAFTER   = 0x04, //!< Last seen value is lower bound
+       BANK_ITFLAG_SEENBEFORE  = 0x08, //!< Last seen value is upper bound (higher priority)
        
-       BANK_ITFLAG_SORT_NONE   = 0x000,
-       BANK_ITFLAG_SORT_NAME   = 0x100,
-       BANK_ITFLAG_SORT_BAL    = 0x200,
-       BANK_ITFLAG_SORT_UNIXID = 0x300,
-       BANK_ITFLAG_SORT_LASTSEEN       = 0x400,
-       BANK_ITFLAG_SORTMASK    = 0x700,
-       BANK_ITFLAG_REVSORT     = 0x800
+       BANK_ITFLAG_SORT_NONE   = 0x000,        //!< No sorting (up to the implementation)
+       BANK_ITFLAG_SORT_NAME   = 0x100,        //!< Sort alphabetically ascending by name
+       BANK_ITFLAG_SORT_BAL    = 0x200,        //!< Sort by balance, ascending
+       BANK_ITFLAG_SORT_UNIXID = 0x300,        //!< Sort by UnixUID (TODO: Needed?)
+       BANK_ITFLAG_SORT_LASTSEEN = 0x400,      //!< Sort by last seen time (ascending)
+       BANK_ITFLAG_SORTMASK    = 0x700,        //!< Sort type mask
+       BANK_ITFLAG_REVSORT     = 0x800 //!< Sort descending instead
+};
+/**
+ * \brief Flag values for the \a Flags parameter to Items_Iterator
+ */
+enum eItems_ItFlags
+{
+       ITEMS_ITFLAG_SHOWDISABLED = 0x001,      //!< Show disabled items
+       ITEMS_ITFLAG_SORT_NONE  = 0x000,        //!< No sorting (up to the implementation)
+       ITEMS_ITFLAG_SORT_NAME  = 0x100,        //!< Sort alphabetically ascending by name
+       ITEMS_ITFLAG_SORT_PRICE = 0x200,        //!< Sort by price, ascending
+       ITEMS_ITFLAG_SORT_IDENT = 0x300,        //!< Sort by Identifier (handler:id)
+       ITEMS_ITFLAG_SORTMASK   = 0x700,        //!< Sort type mask
+       ITEMS_ITFLAG_REVSORT    = 0x800 //!< Sort descending instead
 };
 
 /**
@@ -67,8 +103,8 @@ extern int   Bank_Initialise(const char *Argument);
 
 /**
  * \brief Transfer money from one account to another
- * \param SourceUser   UID (from \a Bank_GetUserID) to take the money from
- * \param DestUser     UID (from \a Bank_GetUserID) give money to
+ * \param SourceAcct   UID (from \a Bank_GetUserID) to take the money from
+ * \param DestAcct     UID (from \a Bank_GetUserID) give money to
  * \param Ammount      Amount of money (in cents) to transfer
  * \param Reason       Reason for the transfer
  */
@@ -98,11 +134,13 @@ extern int Bank_GetBalance(int AcctID);
 extern char    *Bank_GetAcctName(int AcctID);
 /**
  * \brief Get an account ID from a passed name
+ * \param Name Name to search for
+ * \return ID of the account, or -1 if not found
  */
-extern int     Bank_GetAcctByName(const char *Name);
+extern int     Bank_GetAcctByName(const char *Name, int bCreate);
 /**
  * \brief Create a new account
- * \param Username     Name for the new account (if NULL, an anoymous account is created)
+ * \param Name Name for the new account (if NULL, an anoymous account is created)
  * \return ID of the new account
  */
 extern int     Bank_CreateAcct(const char *Name);
@@ -159,6 +197,29 @@ extern int Bank_GetAcctByCard(const char *CardID);
  */
 extern int     Bank_AddAcctCard(int AcctID, const char *CardID);
 
+// === Item Manipulation ===
+#if 0
+extern tItem   *Items_GetItem(char *Handler, int ID);
+/**
+ * \brief Create an item iterator
+ * \return Pointer to an iterator across the selected data set
+ */
+extern tItemIterator   *Items_Iterator(int Flags, char *Handler, int MaxPrice);
+
+/**
+ * \brief Get the current entry in the iterator and move to the next
+ * \param It   Iterator returned by Items_Iterator
+ * \return Item ID, or -1 for end of list
+ */
+extern tItem   *Items_IteratorNext(tItemIterator *It);
+
+/**
+ * \brief Free an allocated iterator
+ * \param It   Iterator returned by Items_Iterator
+ */
+extern void    Items_DelIterator(tItemIterator *It);
+#endif
+
 // ---
 // Server provided helper functions
 // ---
@@ -169,4 +230,10 @@ extern int Bank_AddAcctCard(int AcctID, const char *CardID);
  */
 extern char    *mkstr(const char *Format, ...);
 
+/**
+ * \brief Dispense log access
+ * \note Try not to over-use, only stuff that matters should go in here
+ */
+extern void    Log_Info(const char *Format, ...);
+
 #endif

UCC git Repository :: git.ucc.asn.au