定位函数的函数定义

Locating the function definition of a function

我是新手,刚开始编程,所以如果有人回答或解释了这个问题,我深表歉意。基本上,我一直在查看 SFML 库的文档并遇到一些 sf::Font class public 成员函数。一个例子是这样的:

bool sf::Font::loadFromFile  ( const std::string &  filename ) 

函数的作用如下:

/// \brief Load the font from a file
///
/// The supported font formats are: TrueType, Type 1, CFF,
/// OpenType, SFNT, X11 PCF, Windows FNT, BDF, PFR and Type 42.
/// Note that this function know nothing about the standard
/// fonts installed on the user's system, thus you can't
/// load them directly.
///
/// \warning SFML cannot preload all the font data in this
/// function, so the file has to remain accessible until
/// the sf::Font object loads a new font or is destroyed.
///
/// \param filename Path of the font file to load
///
/// \return True if loading succeeded, false if it failed
///
/// \see loadFromMemory, loadFromStream
///

我已经下载了库并查看了头文件,但我似乎无法找到 loadFromFile 函数实际上是如何完成加载的(换句话说,我正在寻找函数体或 函数定义 来完成工作)。文档只解释了what函数的作用,没有how.

如果这是一个愚蠢的问题或应该显而易见的问题,我很抱歉。我只是很好奇函数的核心在哪里

顺便说一下,here 与我所指的文档的页面和部分完全相同 link。

感谢任何回答的人。

您正在寻找的方法可以在 public Github 存储库中找到。

它在文件 Font.cpp 中,从第 122 行开始:

https://github.com/SFML/SFML/blob/master/src/SFML/Graphics/Font.cpp#L122

文档不会提及这一点,因为文档是关于此功能的用户可以依赖的行为。方法如何实现此行为是用户不需要知道的私有实现细节。