LogMessageBuilder.h
Go to the documentation of this file.
#pragma once
#include <iosfwd>
#include <string>
#include <vector>
#include <array>
#include <memory>
#include <iomanip>
#include <globjects/globjects_api.h>
#include <globjects/base/LogMessageLevel.h>
namespace globjects
{
template <typename T>
class ref_ptr;
class AbstractLogHandler;
class GLOBJECTS_API LogMessageBuilder
{
public:
// These types are unspecified by the C++ standard -> we need to query the compiler specific types
using PrecisionManipulator = decltype(std::setprecision(0));
using FillManipulator = decltype(std::setfill('0'));
using WidthManipulator = decltype(std::setw(0));
public:
LogMessageBuilder(LogMessageLevel level, AbstractLogHandler * handler);
LogMessageBuilder(const LogMessageBuilder & builder);
virtual ~LogMessageBuilder();
LogMessageBuilder & operator<<(const char * c);
LogMessageBuilder & operator<<(const std::string & str);
LogMessageBuilder & operator<<(bool b);
LogMessageBuilder & operator<<(char c);
LogMessageBuilder & operator<<(int i);
LogMessageBuilder & operator<<(float f);
LogMessageBuilder & operator<<(double d);
LogMessageBuilder & operator<<(long double d);
LogMessageBuilder & operator<<(unsigned u);
LogMessageBuilder & operator<<(long l);
LogMessageBuilder & operator<<(long long l);
LogMessageBuilder & operator<<(unsigned long ul);
LogMessageBuilder & operator<<(unsigned char uc);
LogMessageBuilder & operator<<(const void * pointer);
// manipulators
LogMessageBuilder & operator<<(std::ostream & (*manipulator)(std::ostream&));
LogMessageBuilder & operator<<(PrecisionManipulator manipulator);
LogMessageBuilder & operator<<(FillManipulator manipulator);
#ifndef _MSC_VER
// in Windows PrecisionManipulator = WidthManipulator
LogMessageBuilder & operator<<(WidthManipulator manipulator);
#endif
// globjects base objects
template <typename T>
LogMessageBuilder & operator<<(const ref_ptr<T> & ref_pointer);
// pointers
template <typename T>
LogMessageBuilder & operator<<(const T * pointer);
// array types
template <typename T>
LogMessageBuilder & operator<<(const std::vector<T> & vector);
template <typename T, std::size_t Count>
LogMessageBuilder & operator<<(const std::array<T, Count> & array);
protected:
LogMessageLevel m_level;
AbstractLogHandler * m_handler;
std::shared_ptr<std::stringstream> m_stream;
};
} // namespace globjects
#include <globjects/base/LogMessageBuilder.inl>
globjects::LogMessageBuilder::m_stream
std::shared_ptr< std::stringstream > m_stream
Definition: LogMessageBuilder.h:102
globjects::ref_ptr
The ref_ptr class provides the interface for a reference pointer.
Definition: LogMessageBuilder.h:20
globjects
Contains all the classes that wrap OpenGL functionality.
globjects::LogMessageLevel
LogMessageLevel
Definition: LogMessageLevel.h:9
globjects::LogMessageBuilder::PrecisionManipulator
decltype(std::setprecision(0)) PrecisionManipulator
Definition: LogMessageBuilder.h:52
LogMessageLevel.h
globjects::LogMessageBuilder::WidthManipulator
decltype(std::setw(0)) WidthManipulator
Definition: LogMessageBuilder.h:54
globjects::LogMessageBuilder
Builds a LogMessage from different kinds of primitive types.
Definition: LogMessageBuilder.h:48
globjects::LogMessageBuilder::FillManipulator
decltype(std::setfill( '0')) FillManipulator
Definition: LogMessageBuilder.h:53
globjects::LogMessageBuilder::m_handler
AbstractLogHandler * m_handler
Definition: LogMessageBuilder.h:101
globjects::operator<<
GLOBJECTS_API LogMessageBuilder operator<<(LogMessageBuilder builder, const glbinding::Version &version)
globjects::LogMessageBuilder::m_level
LogMessageLevel m_level
Definition: LogMessageBuilder.h:100
globjects::AbstractLogHandler
Abstract interface to handle LogMessages.
Definition: AbstractLogHandler.h:23