📄 stream.h
字号:
} return *this; }#endif protected: virtual void log(LoggerPtr& logger, const LevelPtr& level, const log4cxx::spi::LocationInfo& location); virtual void erase(); virtual void get_stream_state(std::ios_base& base, std::ios_base& mask, int& fill, bool& fillSet) const; virtual void refresh_stream_state(); private: logstream(const logstream&); logstream& operator=(const logstream&); std::basic_stringstream<Ch>* stream; }; #if LOG4CXX_WCHAR_T_API /** * An STL-like stream API for log4cxx using wchar_t as the character type. *. Instances of log4cxx::logstream * are not designedfor use by multiple threads and in general should be short-lived * function scoped objects. Using log4cxx::basic_logstream as a class member or * static instance should be avoided in the same manner as you would avoid placing a std::ostringstream * in those locations. Insertion operations are generally short-circuited if the * level for the stream is not the same of higher that the level of the associated logger. */ class LOG4CXX_EXPORT wlogstream : public logstream_base { typedef wchar_t Ch; public: /** * Constructor. */ wlogstream(const log4cxx::LoggerPtr& logger, const log4cxx::LevelPtr& level); /** * Constructor. */ wlogstream(const Ch* loggerName, const log4cxx::LevelPtr& level); /** * Constructor. */ wlogstream(const std::basic_string<Ch>& loggerName, const log4cxx::LevelPtr& level); ~wlogstream(); /** * Insertion operator for std::fixed and similar manipulators. */ wlogstream& operator<<(std::ios_base& (*manip)(std::ios_base&)); /** * Insertion operator for logstream_base::endmsg. */ wlogstream& operator<<(logstream_manipulator manip); /** * Insertion operator for level. */ wlogstream& operator<<(const log4cxx::LevelPtr& level); /** * Insertion operator for location. */ wlogstream& operator<<(const log4cxx::spi::LocationInfo& location); /** * Alias for insertion operator for location. Kludge to avoid * inappropriate compiler ambiguity. */ wlogstream& operator>>(const log4cxx::spi::LocationInfo& location); /** * Cast operator to provide access to embedded std::basic_ostream. */ operator std::basic_ostream<Ch>&(); #if !(LOG4CXX_USE_GLOBAL_SCOPE_TEMPLATE) /** * Template to allow any class with an std::basic_ostream inserter * to be applied to this class. */ template <class V> inline log4cxx::wlogstream& operator<<(const V& val) { if (LOG4CXX_UNLIKELY(isEnabled())) { ((std::basic_ostream<wchar_t>&) *this) << val; } return *this; }#endif protected: virtual void log(LoggerPtr& logger, const LevelPtr& level, const log4cxx::spi::LocationInfo& location); virtual void erase(); virtual void get_stream_state(std::ios_base& base, std::ios_base& mask, int& fill, bool& fillSet) const; virtual void refresh_stream_state(); private: wlogstream(const wlogstream&); wlogstream& operator=(const wlogstream&); std::basic_stringstream<Ch>* stream; };#endif#if LOG4CXX_UNICHAR_API || LOG4CXX_CFSTRING_API /** * An STL-like stream API for log4cxx using UniChar as the character type. *. Instances of log4cxx::logstream * are not designedfor use by multiple threads and in general should be short-lived * function scoped objects. Using log4cxx::basic_logstream as a class member or * static instance should be avoided in the same manner as you would avoid placing a std::ostringstream * in those locations. Insertion operations are generally short-circuited if the * level for the stream is not the same of higher that the level of the associated logger. */ class LOG4CXX_EXPORT ulogstream : public logstream_base { typedef UniChar Ch; public: /** * Constructor. */ ulogstream(const log4cxx::LoggerPtr& logger, const log4cxx::LevelPtr& level); #if LOG4CXX_UNICHAR_API /** * Constructor. */ ulogstream(const Ch* loggerName, const log4cxx::LevelPtr& level); /** * Constructor. */ ulogstream(const std::basic_string<Ch>& loggerName, const log4cxx::LevelPtr& level);#endif#if LOG4CXX_CFSTRING_API ulogstream(const CFStringRef& loggerName, const log4cxx::LevelPtr& level);#endif ~ulogstream(); /** * Insertion operator for std::fixed and similar manipulators. */ ulogstream& operator<<(std::ios_base& (*manip)(std::ios_base&)); /** * Insertion operator for logstream_base::endmsg. */ ulogstream& operator<<(logstream_manipulator manip); /** * Insertion operator for level. */ ulogstream& operator<<(const log4cxx::LevelPtr& level); /** * Insertion operator for location. */ ulogstream& operator<<(const log4cxx::spi::LocationInfo& location); /** * Alias for insertion operator for location. Kludge to avoid * inappropriate compiler ambiguity. */ ulogstream& operator>>(const log4cxx::spi::LocationInfo& location); /** * Cast operator to provide access to embedded std::basic_ostream. */ operator std::basic_ostream<Ch>&(); #if !(LOG4CXX_USE_GLOBAL_SCOPE_TEMPLATE) /** * Template to allow any class with an std::basic_ostream inserter * to be applied to this class. */ template <class V> inline ulogstream& operator<<(const V& val) { if (LOG4CXX_UNLIKELY(isEnabled())) { ((std::basic_ostream<Ch>&) *this) << val; } return *this; }#endif protected: virtual void log(LoggerPtr& logger, const LevelPtr& level, const log4cxx::spi::LocationInfo& location); virtual void erase(); virtual void get_stream_state(std::ios_base& base, std::ios_base& mask, int& fill, bool& fillSet) const; virtual void refresh_stream_state(); private: ulogstream(const ulogstream&); ulogstream& operator=(const ulogstream&); std::basic_stringstream<Ch>* stream; };#endif} // namespace log4cxx#if LOG4CXX_USE_GLOBAL_SCOPE_TEMPLATE//// VC6 will fail to compile if class-scope templates// are used to handle arbitrary insertion operations.// However, using global namespace insertion operations // run into LOGCXX-150./** * Template to allow any class with an std::basic_ostream inserter * to be applied to this class. */template <class V>inline log4cxx::logstream& operator<<(log4cxx::logstream& os, const V& val) { if (LOG4CXX_UNLIKELY(os.isEnabled())) { ((std::basic_ostream<char>&) os) << val; } return os;}#if LOG4CXX_WCHAR_T_API /** * Template to allow any class with an std::basic_ostream inserter * to be applied to this class. */template <class V>inline log4cxx::wlogstream& operator<<(log4cxx::wlogstream& os, const V& val) { if (LOG4CXX_UNLIKELY(os.isEnabled())) { ((std::basic_ostream<wchar_t>&) os) << val; } return os;}#endif#endif#if !defined(LOG4CXX_ENDMSG)#if LOG4CXX_LOGSTREAM_ADD_NOP#define LOG4CXX_ENDMSG (log4cxx::logstream_manipulator) log4cxx::logstream_base::nop >> LOG4CXX_LOCATION << (log4cxx::logstream_manipulator) log4cxx::logstream_base::endmsg#else#define LOG4CXX_ENDMSG LOG4CXX_LOCATION << (log4cxx::logstream_manipulator) log4cxx::logstream_base::endmsg#endif#endif#endif //_LOG4CXX_STREAM_H
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -