add TALER_yna_to_string()

This commit is contained in:
Christian Grothoff 2020-06-14 15:15:53 +02:00
parent 0276abcd9a
commit 6b6814a205
No known key found for this signature in database
GPG Key ID: 939E6BE1E29FC3CC
2 changed files with 33 additions and 0 deletions

View File

@ -335,4 +335,15 @@ TALER_arg_to_yna (struct MHD_Connection *connection,
enum TALER_EXCHANGE_YesNoAll default_val, enum TALER_EXCHANGE_YesNoAll default_val,
enum TALER_EXCHANGE_YesNoAll *yna); enum TALER_EXCHANGE_YesNoAll *yna);
/**
* Convert YNA value to a string.
*
* @param yna value to convert
* @return string representation ("yes"/"no"/"all").
*/
const char *
TALER_yna_to_string (enum TALER_EXCHANGE_YesNoAll yna);
#endif #endif

View File

@ -64,3 +64,25 @@ TALER_arg_to_yna (struct MHD_Connection *connection,
} }
return false; return false;
} }
/**
* Convert YNA value to a string.
*
* @param yna value to convert
* @return string representation ("yes"/"no"/"all").
*/
const char *
TALER_yna_to_string (enum TALER_EXCHANGE_YesNoAll yna)
{
switch (yna)
{
case TALER_EXCHANGE_YNA_YES:
return "yes";
case TALER_EXCHANGE_YNA_NO:
return "no";
case TALER_EXCHANGE_YNA_ALL:
return "all";
}
GNUNET_assert (0);
}