first reCommit
This commit is contained in:
47
util/xtreewalker.h
Normal file
47
util/xtreewalker.h
Normal file
@@ -0,0 +1,47 @@
|
||||
/***************************************************************************
|
||||
|
||||
source::worx xtree
|
||||
Copyright © 2024-2025 c.holzheuer
|
||||
christoph.holzheuer@gmail.com
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
***************************************************************************/
|
||||
|
||||
|
||||
#ifndef XTREEWALKER_H
|
||||
#define XTREEWALKER_H
|
||||
|
||||
#include <pugixml.hpp>
|
||||
#include <functional>
|
||||
|
||||
/**
|
||||
* @brief A implentation of the pugi::xml treewalker class.
|
||||
*/
|
||||
|
||||
template <typename O,typename M>
|
||||
class xtreewalker : public pugi::xml_tree_walker
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
xtreewalker( O* object, M member )
|
||||
{
|
||||
_call = std::bind(member, object, std::placeholders::_1, std::placeholders::_2);
|
||||
}
|
||||
|
||||
virtual bool for_each(pugi::xml_node& node) override
|
||||
{
|
||||
return _call(node,depth());
|
||||
}
|
||||
|
||||
protected:
|
||||
|
||||
std::function<bool(pugi::xml_node& node,int)> _call;
|
||||
|
||||
};
|
||||
|
||||
#endif // XTREEWALKER_H
|
Reference in New Issue
Block a user