Do not ignore '[[nodiscard]]` functions in example code

This commit is contained in:
Vittorio Romeo 2021-12-13 21:18:10 +01:00 committed by Chris Thrasher
parent a71d6bc078
commit 5cfbf912c7
3 changed files with 20 additions and 8 deletions

View File

@ -265,7 +265,10 @@ private:
/// \code /// \code
/// // Declare and load a texture /// // Declare and load a texture
/// sf::Texture texture; /// sf::Texture texture;
/// texture.loadFromFile("texture.png"); /// if (!texture.loadFromFile("texture.png"))
/// {
/// // Handle error...
/// }
/// ///
/// // Create a sprite /// // Create a sprite
/// sf::Sprite sprite(texture); /// sf::Sprite sprite(texture);

View File

@ -464,7 +464,10 @@ private:
/// \code /// \code
/// // Declare and load a font /// // Declare and load a font
/// sf::Font font; /// sf::Font font;
/// font.loadFromFile("arial.ttf"); /// if (!font.loadFromFile("arial.ttf"))
/// {
/// // Handle error...
/// }
/// ///
/// // Create a text /// // Create a text
/// sf::Text text(font, "hello"); /// sf::Text text(font, "hello");

View File

@ -120,8 +120,10 @@ public:
/// This function is a shortcut for the following code: /// This function is a shortcut for the following code:
/// \code /// \code
/// sf::Image image; /// sf::Image image;
/// image.loadFromFile(filename); /// if (!image.loadFromFile(filename))
/// texture.loadFromImage(image, area); /// return false;
/// if (!texture.loadFromImage(image, area))
/// return false;
/// \endcode /// \endcode
/// ///
/// The \a area argument can be used to load only a sub-rectangle /// The \a area argument can be used to load only a sub-rectangle
@ -151,8 +153,10 @@ public:
/// This function is a shortcut for the following code: /// This function is a shortcut for the following code:
/// \code /// \code
/// sf::Image image; /// sf::Image image;
/// image.loadFromMemory(data, size); /// if (!image.loadFromMemory(data, size))
/// texture.loadFromImage(image, area); /// return false;
/// if (!texture.loadFromImage(image, area))
/// return false;
/// \endcode /// \endcode
/// ///
/// The \a area argument can be used to load only a sub-rectangle /// The \a area argument can be used to load only a sub-rectangle
@ -183,8 +187,10 @@ public:
/// This function is a shortcut for the following code: /// This function is a shortcut for the following code:
/// \code /// \code
/// sf::Image image; /// sf::Image image;
/// image.loadFromStream(stream); /// if (!image.loadFromStream(stream))
/// texture.loadFromImage(image, area); /// return false;
/// if (!texture.loadFromImage(image, area))
/// return false;
/// \endcode /// \endcode
/// ///
/// The \a area argument can be used to load only a sub-rectangle /// The \a area argument can be used to load only a sub-rectangle