intermediate implementation with more support for input

This commit is contained in:
Hartmut Seichter 2019-01-09 16:24:16 +01:00
parent 39663f40ef
commit dfe26d9424
9 changed files with 103 additions and 34 deletions

View file

@ -10,6 +10,7 @@ set(hdrs
include/pw/core/quaternion.hpp
include/pw/core/serialize.hpp
include/pw/core/image.hpp
include/pw/core/point.hpp
include/pw/core/size.hpp
include/pw/core/timer.hpp
include/pw/core/globals.hpp

View file

@ -40,13 +40,13 @@ class debug {
public:
enum level {
kNone, //!< nothing will be logged, even no errors
kError, //!< only errors will be logged
kWarning, //!< log warnings (non-critical errors)
kMessage, //!< log messages (something to note but not an error)
kNotify, //!< log some more information
kInfo, //!< log verbose information
kAll = 0xFF //!< log absolutely everything
none, //!< nothing will be logged, even no errors
error, //!< only errors will be logged
warning, //!< log warnings (non-critical errors)
message, //!< log messages (something to note but not an error)
notification, //!< log some more information
info, //!< log verbose information
all = 0xFF //!< log absolutely everything
};
/**
@ -94,11 +94,11 @@ public:
* @brief get the stream interface of the logger
* @return return a temporary object that will write and flush the logger
*/
static stream s(enum level level = kInfo);
static stream s(enum level level = info);
inline static stream d() { return s(debug::kInfo); }
inline static stream e() { return s(debug::kError); }
inline static stream w() { return s(debug::kWarning); }
inline static stream d() { return s(debug::info); }
inline static stream e() { return s(debug::error); }
inline static stream w() { return s(debug::warning); }
/**
* @brief returns the instance of the logger
@ -115,10 +115,11 @@ public:
typedef std::function<void(const char*)> Callback;
typedef std::vector<Callback> CallbackList;
~debug();
protected:
debug();
~debug();
CallbackList _callbacks;
enum level _level;

View file

@ -0,0 +1,29 @@
#ifndef PW_CORE_POINT_HPP
#define PW_CORE_SIZE_HPP
#include <pw/core/globals.hpp>
namespace pw {
template <typename T_>
struct point_ {
T_ p[2] = { 0, 0 };
point_() = default;
point_(T_ x,T_ y) : p( {x,y} ) {}
const T_ x() { return p[0]; }
const T_ y() { return p[1]; }
};
typedef point_<real_t> point;
typedef point_<int> pointi;
typedef point_<float> pointf;
typedef point_<float> pointd;
}
#endif

View file

@ -35,6 +35,8 @@ struct size_ {
T_ dim[2] = { 0, 0 };
size_() = default;
size_(T_ w,T_ h) : dim( { w, h }) {}
const T_ width() { return dim[0]; }

View file

@ -60,7 +60,7 @@ struct tpFileLog {
debug::debug() :
_level(debug::kNotify)
_level(debug::notification)
{
#if defined(_WINCE)
_callbacks.add(new tpFileLog());