1

I have some legacy function that in the input only accept some int. how properly document them and tell that the input of the function can be only one of the defined items?

#define API_TYPE1 0
#define API_TYPE2 1

/**
* @param[in] argument1 can be either @sa API_TYPE1 or @sa API_TYPE2
*/
int TestAPI(
    int argument1,
    string argument2
    );


// usage should be like this 
TestAPI(API_TYPE1, "http://someurl.com");
Mohammad Hossein Amri
  • 1,842
  • 2
  • 23
  • 43
  • What is wrong with the chosen possibility ? Though it is better not to use `\sa` in this context but `\ref` (and document also `API_TYPE1 ` and `API_TYPE1 `). Which doxygen version are you using. – albert Aug 25 '21 at 11:21

1 Answers1

2

Some suggestions based on my comment with the question:

/// \file

/// the meaning
#define API_TYPE1 0
/// the meaning
#define API_TYPE2 1

// * @param[in] argument2 can be either @sa API_TYPE1 or @sa API_TYPE2
/**
* @param[in] argument1 can be either @ref API_TYPE1 or @ref API_TYPE2
* @param[in] argument2 can be either:
*            - @ref API_TYPE1
*            - @ref API_TYPE2
*/
int TestAPI(
    int argument1,
    int argument2
    );

Giving:

enter image description here

albert
  • 8,285
  • 3
  • 19
  • 32