forked from osmocom/wireshark
Document unit string and true false string helper functions
Provide Doxygen comment blocks for unit string and true false string helper functions. Change-Id: I70801561e9cd3ead5e3417ea9d297d828105f3d0 Reviewed-on: https://code.wireshark.org/review/36968 Petri-Dish: Anders Broman <a.broman58@gmail.com> Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman <a.broman58@gmail.com>
This commit is contained in:
parent
7bd3f8a58f
commit
0eb92d7aa0
|
@ -13,6 +13,7 @@
|
||||||
|
|
||||||
#include "tfs.h"
|
#include "tfs.h"
|
||||||
|
|
||||||
|
/** Returns the string representing the true or false value. */
|
||||||
const char *tfs_get_string(gboolean value, const true_false_string *tfs)
|
const char *tfs_get_string(gboolean value, const true_false_string *tfs)
|
||||||
{
|
{
|
||||||
return value ? tfs->true_string : tfs->false_string;
|
return value ? tfs->true_string : tfs->false_string;
|
||||||
|
|
11
epan/tfs.h
11
epan/tfs.h
|
@ -23,13 +23,20 @@ extern "C" {
|
||||||
* true_false strings
|
* true_false strings
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/** Struct for boolean enumerations */
|
/** Struct for boolean representation */
|
||||||
typedef struct true_false_string {
|
typedef struct true_false_string {
|
||||||
const char *true_string; /**< The string presented when true */
|
const char *true_string; /**< The string presented when true */
|
||||||
const char *false_string; /**< The string presented when false */
|
const char *false_string; /**< The string presented when false */
|
||||||
} true_false_string;
|
} true_false_string;
|
||||||
|
|
||||||
WS_DLL_PUBLIC const char *tfs_get_string(gboolean, const true_false_string *);
|
/** Returns the string representing the true or false value.
|
||||||
|
*
|
||||||
|
* From the given true_false_string return the appropriate string pointer
|
||||||
|
* @param[in] value The boolean value for which the string representation is sought
|
||||||
|
* @param[in] tfs The true_false_string containing the relevant strings
|
||||||
|
* @return Pointer to the appropriate string
|
||||||
|
*/
|
||||||
|
WS_DLL_PUBLIC const char *tfs_get_string(gboolean value, const true_false_string *tfs);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* A default set of true/false strings that dissectors can use for
|
* A default set of true/false strings that dissectors can use for
|
||||||
|
|
|
@ -14,6 +14,7 @@
|
||||||
#include <wsutil/str_util.h>
|
#include <wsutil/str_util.h>
|
||||||
#include "unit_strings.h"
|
#include "unit_strings.h"
|
||||||
|
|
||||||
|
/** Returns the unit string appropriate for the 32 bit value. */
|
||||||
const char* unit_name_string_get_value(guint32 value, const unit_name_string* units)
|
const char* unit_name_string_get_value(guint32 value, const unit_name_string* units)
|
||||||
{
|
{
|
||||||
if (units->plural == NULL)
|
if (units->plural == NULL)
|
||||||
|
@ -22,6 +23,7 @@ const char* unit_name_string_get_value(guint32 value, const unit_name_string* un
|
||||||
return plurality(value, units->singular, units->plural);
|
return plurality(value, units->singular, units->plural);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Returns the unit string appropriate for the 64 bit value. */
|
||||||
const char* unit_name_string_get_value64(guint64 value, const unit_name_string* units)
|
const char* unit_name_string_get_value64(guint64 value, const unit_name_string* units)
|
||||||
{
|
{
|
||||||
if (units->plural == NULL)
|
if (units->plural == NULL)
|
||||||
|
@ -30,6 +32,7 @@ const char* unit_name_string_get_value64(guint64 value, const unit_name_string*
|
||||||
return plurality(value, units->singular, units->plural);
|
return plurality(value, units->singular, units->plural);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Returns the unit string appropriate for the double value. */
|
||||||
const char* unit_name_string_get_double(double value, const unit_name_string* units)
|
const char* unit_name_string_get_double(double value, const unit_name_string* units)
|
||||||
{
|
{
|
||||||
if (units->plural == NULL)
|
if (units->plural == NULL)
|
||||||
|
|
|
@ -21,14 +21,37 @@ extern "C" {
|
||||||
* Units to append to field values
|
* Units to append to field values
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* For BASE_UNIT_STRING, the display format for adding units */
|
/** For BASE_UNIT_STRING, the display format for adding units */
|
||||||
typedef struct unit_name_string {
|
typedef struct unit_name_string {
|
||||||
char *singular; /* name to use for 1 unit */
|
char *singular; /**< name to use for 1 unit */
|
||||||
char *plural; /* name to use for < 1 or > 1 units */
|
char *plural; /**< name to use for < 1 or > 1 units */
|
||||||
} unit_name_string;
|
} unit_name_string;
|
||||||
|
|
||||||
|
/** Returns the unit string appropriate for the 32 bit value.
|
||||||
|
*
|
||||||
|
* From the given unit_name_string return the appropriate string pointer
|
||||||
|
* @param[in] value The value for which to get the appropriate string
|
||||||
|
* @param[in] units The unit_name_string containing the relevant strings
|
||||||
|
* @return Pointer to the appropriate string
|
||||||
|
*/
|
||||||
WS_DLL_PUBLIC const char* unit_name_string_get_value(guint32 value, const unit_name_string* units);
|
WS_DLL_PUBLIC const char* unit_name_string_get_value(guint32 value, const unit_name_string* units);
|
||||||
|
|
||||||
|
/** Returns the unit string appropriate for the 64 bit value.
|
||||||
|
*
|
||||||
|
* From the given unit_name_string return the appropriate string pointer
|
||||||
|
* @param[in] value The value for which to get the appropriate string
|
||||||
|
* @param[in] units The unit_name_string containing the relevant strings
|
||||||
|
* @return Pointer to the appropriate string
|
||||||
|
*/
|
||||||
WS_DLL_PUBLIC const char* unit_name_string_get_value64(guint64 value, const unit_name_string* units);
|
WS_DLL_PUBLIC const char* unit_name_string_get_value64(guint64 value, const unit_name_string* units);
|
||||||
|
|
||||||
|
/** Returns the unit string appropriate for the double value.
|
||||||
|
*
|
||||||
|
* From the given unit_name_string return the appropriate string pointer
|
||||||
|
* @param[in] value The value for which to get the appropriate string
|
||||||
|
* @param[in] units The unit_name_string containing the relevant strings
|
||||||
|
* @return Pointer to the appropriate string
|
||||||
|
*/
|
||||||
WS_DLL_PUBLIC const char* unit_name_string_get_double(double value, const unit_name_string* units);
|
WS_DLL_PUBLIC const char* unit_name_string_get_double(double value, const unit_name_string* units);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
Loading…
Reference in New Issue