diff options
Diffstat (limited to 'src/include/taler_amount_lib.h')
-rw-r--r-- | src/include/taler_amount_lib.h | 31 |
1 files changed, 30 insertions, 1 deletions
diff --git a/src/include/taler_amount_lib.h b/src/include/taler_amount_lib.h index c1f42e473..937238d15 100644 --- a/src/include/taler_amount_lib.h +++ b/src/include/taler_amount_lib.h @@ -18,9 +18,16 @@ * @brief amount-representation utility functions * @author Sree Harsha Totakura <sreeharsha@totakura.in> */ +#if ! defined (__TALER_UTIL_LIB_H_INSIDE__) +#error "Only <taler_util.h> can be included directly." +#endif + #ifndef TALER_AMOUNT_LIB_H #define TALER_AMOUNT_LIB_H +#include <stdint.h> +#include "gnunet/gnunet_common.h" + #ifdef __cplusplus extern "C" { @@ -121,6 +128,16 @@ struct TALER_Amount /** + * Check that the currency code in @a str is well-formed. + * + * @param str currency code name to validate + * @return #GNUNET_OK if @a str is a valid currency code + */ +enum GNUNET_GenericReturnValue +TALER_check_currency (const char *str); + + +/** * Parse monetary amount, in the format "T:V.F". * * @param str amount string @@ -182,6 +199,18 @@ TALER_amount_is_valid (const struct TALER_Amount *amount); /** + * Test if the given amount is in the given currency + * + * @param amount amount to check + * @param currency currency to check for + * @return #GNUNET_OK if @a amount is in @a currency + */ +enum GNUNET_GenericReturnValue +TALER_amount_is_currency (const struct TALER_Amount *amount, + const char *currency); + + +/** * Convert amount from host to network representation. * * @param[out] res where to store amount in network representation @@ -383,7 +412,7 @@ TALER_amount_multiply (struct TALER_Amount *result, * #GNUNET_NO if value was already normalized * #GNUNET_SYSERR if value was invalid or could not be normalized */ -int +enum GNUNET_GenericReturnValue TALER_amount_normalize (struct TALER_Amount *amount); |