X-Git-Url: https://git.ucc.asn.au/?p=tpg%2Fopendispense2.git;a=blobdiff_plain;f=src%2Fcokebank.h;h=c3c7c6f36de618329a27646c38d130e6d8107cca;hp=7c7997e285ceaef5ced143e4e9043455ebd55c73;hb=5cf5f1c0479d0052d53ea735895a550a0e455287;hpb=2402457fd4ea286febae34182d9a9f3b63cb6565 diff --git a/src/cokebank.h b/src/cokebank.h index 7c7997e..c3c7c6f 100644 --- a/src/cokebank.h +++ b/src/cokebank.h @@ -17,8 +17,11 @@ #include #define COKEBANK_SALES_ACCT ">sales" //!< Sales made into -#define COKEBANK_DEBT_ACCT ">liability" //!< Credit taken out of +#define COKEBANK_SALES_PREFIX ">sales:" //!< Sales made into +#define COKEBANK_DEBT_ACCT ">countersum" //!< Credit taken out of #define COKEBANK_FREE_ACCT ">freeitems" //!< ODay drink costs taken out of +#define COKEBANK_DONATE_ACCT ">donations" //!< Donations go here +#define COKEBANK_GRAT_ACCR ">gratuities" //!< Coke runs and new users /** * \brief Account iterator opaque structure @@ -28,6 +31,24 @@ */ 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 */ @@ -46,6 +67,19 @@ enum eBank_ItFlags 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 +}; /** * \brief User flag values @@ -104,7 +138,7 @@ extern char *Bank_GetAcctName(int AcctID); * \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 Name Name for the new account (if NULL, an anoymous account is created) @@ -164,6 +198,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 // ---