Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-06-02 08:58:14

0001 ////////////////////////////////////////////////////////////
0002 //
0003 // SFML - Simple and Fast Multimedia Library
0004 // Copyright (C) 2007-2023 Laurent Gomila (laurent@sfml-dev.org)
0005 //
0006 // This software is provided 'as-is', without any express or implied warranty.
0007 // In no event will the authors be held liable for any damages arising from the use of this software.
0008 //
0009 // Permission is granted to anyone to use this software for any purpose,
0010 // including commercial applications, and to alter it and redistribute it freely,
0011 // subject to the following restrictions:
0012 //
0013 // 1. The origin of this software must not be misrepresented;
0014 //    you must not claim that you wrote the original software.
0015 //    If you use this software in a product, an acknowledgment
0016 //    in the product documentation would be appreciated but is not required.
0017 //
0018 // 2. Altered source versions must be plainly marked as such,
0019 //    and must not be misrepresented as being the original software.
0020 //
0021 // 3. This notice may not be removed or altered from any source distribution.
0022 //
0023 ////////////////////////////////////////////////////////////
0024 
0025 #ifndef SFML_ERR_HPP
0026 #define SFML_ERR_HPP
0027 
0028 ////////////////////////////////////////////////////////////
0029 // Headers
0030 ////////////////////////////////////////////////////////////
0031 #include <SFML/System/Export.hpp>
0032 #include <ostream>
0033 
0034 
0035 namespace sf
0036 {
0037 ////////////////////////////////////////////////////////////
0038 /// \brief Standard stream used by SFML to output warnings and errors
0039 ///
0040 ////////////////////////////////////////////////////////////
0041 SFML_SYSTEM_API std::ostream& err();
0042 
0043 } // namespace sf
0044 
0045 
0046 #endif // SFML_ERR_HPP
0047 
0048 
0049 ////////////////////////////////////////////////////////////
0050 /// \fn sf::err
0051 /// \ingroup system
0052 ///
0053 /// By default, sf::err() outputs to the same location as std::cerr,
0054 /// (-> the stderr descriptor) which is the console if there's
0055 /// one available.
0056 ///
0057 /// It is a standard std::ostream instance, so it supports all the
0058 /// insertion operations defined by the STL
0059 /// (operator <<, manipulators, etc.).
0060 ///
0061 /// sf::err() can be redirected to write to another output, independently
0062 /// of std::cerr, by using the rdbuf() function provided by the
0063 /// std::ostream class.
0064 ///
0065 /// Example:
0066 /// \code
0067 /// // Redirect to a file
0068 /// std::ofstream file("sfml-log.txt");
0069 /// std::streambuf* previous = sf::err().rdbuf(file.rdbuf());
0070 ///
0071 /// // Redirect to nothing
0072 /// sf::err().rdbuf(NULL);
0073 ///
0074 /// // Restore the original output
0075 /// sf::err().rdbuf(previous);
0076 /// \endcode
0077 ///
0078 /// \return Reference to std::ostream representing the SFML error stream
0079 ///
0080 ////////////////////////////////////////////////////////////