mirror of
https://github.com/pocoproject/poco.git
synced 2025-02-21 06:37:42 +01:00
fix: make headers parseable by CppParser/PocoDoc
This commit is contained in:
parent
3bb76f51ad
commit
7ffdcf97d4
@ -40,6 +40,7 @@ template <class T> class VarHolderImpl;
|
||||
}
|
||||
|
||||
|
||||
#ifndef POCO_DOC
|
||||
template <class T, std::size_t S>
|
||||
struct TypeSizeLE:
|
||||
std::integral_constant<bool, (sizeof(T) <= S)>{};
|
||||
@ -48,6 +49,7 @@ struct TypeSizeLE:
|
||||
template <class T, std::size_t S>
|
||||
struct TypeSizeGT:
|
||||
std::integral_constant<bool, (sizeof(T) > S)>{};
|
||||
#endif
|
||||
|
||||
|
||||
template <typename PlaceholderT, unsigned int SizeV = POCO_SMALL_OBJECT_SIZE>
|
||||
|
@ -1,6 +1,3 @@
|
||||
#ifndef Foundation_VarVisitor_INCLUDED
|
||||
#define Foundation_VarVisitor_INCLUDED
|
||||
|
||||
//
|
||||
// VarVisitor.h
|
||||
//
|
||||
@ -17,18 +14,28 @@
|
||||
//
|
||||
|
||||
|
||||
#ifndef Foundation_VarVisitor_INCLUDED
|
||||
#define Foundation_VarVisitor_INCLUDED
|
||||
|
||||
|
||||
#include "Poco/Dynamic/Var.h"
|
||||
#include <unordered_map>
|
||||
#include <functional>
|
||||
|
||||
|
||||
namespace Poco {
|
||||
namespace Details {
|
||||
|
||||
|
||||
#ifndef POCO_DOC
|
||||
|
||||
|
||||
struct TypeInfoHash
|
||||
{
|
||||
inline std::size_t operator()(std::type_info const& t) const { return t.hash_code(); }
|
||||
};
|
||||
|
||||
|
||||
struct EqualRef
|
||||
{
|
||||
template <typename T>
|
||||
@ -38,20 +45,28 @@ struct EqualRef
|
||||
}
|
||||
};
|
||||
|
||||
using TypeInfoRef = std::reference_wrapper<std::type_info const>;
|
||||
|
||||
using TypeInfoRef = std::reference_wrapper<std::type_info const>;
|
||||
using HandlerCaller = std::function<void(const Poco::Dynamic::Var&)>;
|
||||
|
||||
|
||||
template <typename T>
|
||||
using HandlerPointer = void (*)(const T &);
|
||||
using HandlerPointer = void (*)(const T&);
|
||||
|
||||
|
||||
template <typename T>
|
||||
using Handler = std::function<void(const T&)>;
|
||||
|
||||
} // Details
|
||||
|
||||
#endif // POCO_DOC
|
||||
|
||||
|
||||
} // Details
|
||||
|
||||
|
||||
namespace Dynamic {
|
||||
|
||||
|
||||
class Foundation_API Visitor
|
||||
/// VarVisitor class.
|
||||
{
|
||||
@ -62,10 +77,10 @@ class Foundation_API Visitor
|
||||
|
||||
public:
|
||||
template <typename T>
|
||||
bool addHandler(const Details::Handler<T> &f)
|
||||
/// Add handler for specific type T which holds in Var
|
||||
/// This method is more safe, because it saves copy of handler : lambda or std::function
|
||||
/// Returns true if handler was added
|
||||
bool addHandler(const Details::Handler<T>& f)
|
||||
/// Add handler for specific type T which holds in Var.
|
||||
/// This method is more safe, because it saves copy of handler : lambda or std::function.
|
||||
/// Returns true if handler was added.
|
||||
{
|
||||
auto result = _handlers.emplace(std::ref(typeid(T)),
|
||||
Details::HandlerCaller([handler = f](const Poco::Dynamic::Var& x)
|
||||
@ -77,9 +92,9 @@ public:
|
||||
|
||||
template <typename T>
|
||||
bool addHandler(Details::HandlerPointer<T> f)
|
||||
/// Add handler for specific type T which holds in Var
|
||||
/// This method is less safe, because it saves only copy of function pointer
|
||||
/// Returns true if handler was added
|
||||
/// Add handler for specific type T which holds in Var.
|
||||
/// This method is less safe, because it saves only copy of function pointer.
|
||||
/// Returns true if handler was added.
|
||||
{
|
||||
auto result = _handlers.emplace(std::ref(typeid(T)),
|
||||
Details::HandlerCaller([handlerPointer = f](const Poco::Dynamic::Var& x)
|
||||
@ -90,10 +105,12 @@ public:
|
||||
}
|
||||
|
||||
bool visit(const Poco::Dynamic::Var& x) const;
|
||||
/// Find handler for holded type and if it exists call handler
|
||||
/// Returns true if hanler was found othrewise returns false
|
||||
/// Find handler for held type and if it exists call handler.
|
||||
/// Returns true if hanlder was found othrewise returns false.
|
||||
};
|
||||
|
||||
|
||||
} } // namespace Poco::Dynamic
|
||||
|
||||
|
||||
#endif // Foundation_VarVisitor_INCLUDED
|
||||
|
@ -229,6 +229,7 @@ private:
|
||||
_memory.next = next;
|
||||
}
|
||||
|
||||
#ifndef POCO_DOC
|
||||
union
|
||||
/// Memory block storage.
|
||||
///
|
||||
@ -242,6 +243,7 @@ private:
|
||||
char buffer[sizeof(T)];
|
||||
Block* next;
|
||||
} _memory;
|
||||
#endif
|
||||
|
||||
private:
|
||||
Block(const Block&);
|
||||
|
@ -41,6 +41,7 @@
|
||||
-C,
|
||||
-DPOCO_NO_WINDOWS_H,
|
||||
-DPOCO_NO_GCC_API_ATTRIBUTE,
|
||||
-DPOCO_DOC,
|
||||
-xc++
|
||||
</options>
|
||||
<path></path>
|
||||
|
@ -32,7 +32,7 @@ class AtomicFloat
|
||||
{
|
||||
public:
|
||||
AtomicFloat():
|
||||
_value{0}
|
||||
_value(0.0)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -280,6 +280,7 @@ private:
|
||||
EventType nextBody();
|
||||
void handleError();
|
||||
|
||||
#ifndef POCO_DOC
|
||||
// If _size is 0, then data is std::istream. Otherwise, it is a buffer.
|
||||
union
|
||||
{
|
||||
@ -287,6 +288,13 @@ private:
|
||||
const void* buf;
|
||||
}
|
||||
_data;
|
||||
#endif
|
||||
|
||||
enum ParserState
|
||||
{
|
||||
state_next,
|
||||
state_peek
|
||||
};
|
||||
|
||||
std::size_t _size;
|
||||
const std::string _inputName;
|
||||
@ -294,7 +302,7 @@ private:
|
||||
XML_Parser _parser;
|
||||
std::size_t _depth;
|
||||
bool _accumulateContent; // Whether we are accumulating character content.
|
||||
enum { state_next, state_peek } _parserState;
|
||||
ParserState _parserState;
|
||||
EventType _currentEvent;
|
||||
EventType _queue;
|
||||
QName _qname;
|
||||
|
Loading…
x
Reference in New Issue
Block a user