c++ - 定位函数的函数定义

标签 c++ function sfml

我是新手,刚开始编程,所以如果有人回答或解释过这个问题,我深表歉意。基本上,我一直在查看 SFML 库的文档并遇到一些 sf::Font 类公共(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 函数实际上是如何完成加载的(换句话说,我正在寻找函数体或 完成工作的函数定义)。该文档仅解释了函数的作用,而不是如何

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

顺便说一下,here是指向我所指文档的页面和部分的确切链接。

感谢所有回答的人。

最佳答案

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

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

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

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

关于c++ - 定位函数的函数定义,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40336855/

相关文章:

c++ - 不支持 SFML 垂直同步

c++ - Qt:keyPressEvent 中的打印屏幕键

matlab - 为隐式 Runge-Kutta 方法编写函数(四阶)

一般的 Javascript 对象无限方法

c++ - 错误 : `MEMBER` in `class CLASS` does not name a type; C++

c++ - 如何在exe文件夹中不包含纹理

c++ - 使用宏替代功能

c++ - 如何同时在 Visual Studio 2015 和 Visual Studio 2002 中构建 C++ 项目

c++ - 模板类的方法取决于模板参数

function - 将多个参数传递给Powershell中的函数变量