Annotation painting

This commit is contained in:
Jakub Melka
2020-03-07 17:38:50 +01:00
parent 92c58f68ff
commit 0b2d94d115
17 changed files with 363 additions and 47 deletions

View File

@ -28,6 +28,7 @@
#include <vector>
#include <iterator>
#include <functional>
namespace pdf
{
@ -76,6 +77,19 @@ public:
return m_object;
}
/// Returns the cached object. If object is dirty, then cached object is refreshed.
/// \param function Refresh function
inline const T& get(const std::function<T(void)>& function)
{
if (m_dirty)
{
m_object = function();
m_dirty = false;
}
return m_object;
}
/// Invalidates the cached item, so it must be refreshed from the cache next time,
/// if it is accessed.
inline void dirty()