IT Share you

Doxygen에서 매개 변수를 참조하는 올바른 방법은 무엇입니까?

shareyou 2021. 1. 8. 21:46
반응형

Doxygen에서 매개 변수를 참조하는 올바른 방법은 무엇입니까?


함수에 대한 다음 Doxygen 문서가 있습니다.

/**
  @brief Does interesting things

  @param[in]  pfirst The first parameter: a barrel full of monkeys

  @pre
    "pfirst" must have been previously passed through BarrelFiller()
*/

그 주 pfirst매개 변수이며,이 전제 조건에서 참조된다.

나머지 텍스트와 구분하기 위해 여기에 인용 부호로 묶었습니다. 그러나 Doxygen이 명령을 강조 표시하고 가급적이면 매개 변수 정의에 연결하는 방식으로이 작업을 수행하는 것이 좋습니다. 이를 수행하는 방법이 있습니까?

이것이 기본 구성 (또는 사소한 변경) 만 사용하여 발생한다면 특히 좋을 것입니다.


Doxygen은 \p다음 단어가 함수에 대한 매개 변수임을 나타내는 명령 제공합니다 . 다음과 같이 사용합니다.

... the \p x and \p y coordinates are used to ...

기본적으로 이것은 타자기 글꼴을 사용하여 표현 될 것이라고 믿습니다. 나는 이것이 현재 자동 연결 기능을 제공하지 않는다고 생각하지만 잠재적으로 미래에 가능할 수 있습니다.

\a멤버 인수를 표시하는 데 사용되는 관련 명령이 있습니다 . 기본적으로 텍스트 ( <em>arg</em>)에 강조 표시됩니다.

다양한 Doxygen 특수 명령 참조 에 대한 자세한 정보를 찾을 수 있습니다 .


참조하려는 매개 변수 앞에 "#"기호를 사용하십시오.

#pfirst must have been previously passed through BarrelFiller()

( doxygen 매뉴얼에서 )


나는 당신이 @parameters에 대해 묻는 것을 알고 있지만 Google 검색은 여기에서 @return유형도 검색 하므로 여기에 그 대답이 있습니다.

#정의에 대한 하이퍼 링크를 만들기 위해 반환 값 앞에 Doxygen 사용 :

#기호를 사용하십시오 .

전체 예제 ( 바로 아래 에 각 유형 앞에가 있는 @return유형 참조# ) :

#include <stdarg.h> // for va_list, va_start, va_end
#include <stdio.h>  // for vsnprintf

// Function prototype:

int debug_printf(const char *format, ...) __attribute__((format(printf, 1, 2)));

// Function definition:

/// @brief      Function to print out data through serial UART for debugging
/// @param[in]  format  `printf`-like format string
/// @param[in]  ...     `printf`-like variadic list of arguments corresponding to the format string
/// @return     Number of characters printed if OK, or < 0 if error:
///             - #DEBUG_ERR_ENCODING
///             - #DEBUG_ERR_OVERFLOW
///             - #DEBUG_ERR_UART
int debug_printf(const char *format, ...)
{
    int num_chars_printed;

    va_list args;
    va_start(args, format);

    // Use `vsnprintf()` now here to format everything into a single string buffer, then send 
    // out over the UART
    // - num_chars_printed could be set to one of the error codes listed above here

    va_end(args);

    return num_chars_printed;
}

Doxygen을 출력 이제 밑줄 서브 탄알 목록 같은 에러 리턴 유형을 표시 Number of characters printed if OK, or < 0 if error:, 에러 유형의 각각에 의한 각 정의에 URL로 설정되어 #앞의 문자 .

Doxygen 참조 :

  1. @Jeremy Sarao의 대답 과 내 머리 주위를 달리는 부족 지식을 참조하십시오 .
  2. 부족 지식. 이 정보를 어디서 어떻게 찾을 지 모르겠습니다. Doxygen 문서에서.

기타 참조

  1. GCC의 매우 유용한 printf 형식 속성에 대한 문서 :
    1. https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html - see "format" section
    2. How to use formatting strings in user-defined functions?
    3. How should I properly use __attribute__ ((format (printf, x, y))) inside a class method in C++?
  2. Basic printf wrapper implementation: https://github.com/adafruit/ArduinoCore-samd/blob/master/cores/arduino/Print.cpp#L189

ReferenceURL : https://stackoverflow.com/questions/15398711/whats-the-right-way-to-reference-a-parameter-in-doxygen

반응형