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