33 template <
typename CharT,
typename Alloc = std::allocator<CharT> >
45 typedef std::list<node_ptr, typename allocator_type::template rebind<node_ptr>::other> node_list;
57 iterator(
const iterator& aOther) : iNode(aOther.iNode), iIterator(aOther.iIterator), iFilter(aOther.iFilter) {}
58 iterator&
operator=(
const iterator& aOther) { iNode = aOther.iNode; iIterator = aOther.iIterator; iFilter = aOther.iFilter;
return *
this; }
66 while (*
this != endIterator && !((*iIterator)->type() & iFilter))
74 while (*
this != beginIterator && !((*iIterator)->type() & iFilter))
104 while (*
this != endIterator && !((*iIterator)->type() & iFilter))
112 while (*
this != beginIterator && !((*iIterator)->type() & iFilter))
136 bool empty()
const {
return iContent.empty(); }
137 const node&
back()
const {
return *iContent.back(); }
144 template <
typename Exception>
148 template <
typename Exception>
153 std::unique_ptr<node> newNode(aNode);
154 iContent.push_back(0);
155 iContent.back() = newNode.release();
159 std::unique_ptr<node> newNode(aNode);
160 typename node_list::iterator i = iContent.insert(aIterator.
base(), 0);
161 *i = newNode.release();
166 delete *aIterator.
base();
167 iContent.erase(aIterator.
base());
171 for (
typename node_list::iterator i = iContent.begin(); i != iContent.end(); ++i)
178 const node_list& content()
const {
return iContent; }
179 node_list& content() {
return iContent; }
181 html_node& operator=(
const html_node&) =
delete;
189 template <
typename CharT,
typename Alloc = std::allocator<CharT> >
210 static void*
operator new(std::size_t) {
return typename Alloc::template rebind<html_element>::other().allocate(1); }
211 static void operator delete(
void* ptr) {
return typename Alloc::template rebind<html_element>::other().deallocate(
static_cast<html_element*
>(ptr), 1); }
219 typedef std::map<string, string, std::less<string>,
typename allocator_type::template rebind<attribute>::other>
attribute_list;
249 const string&
attribute_value(
const string& aNewAttributeName,
const string& aOldAttributeName)
const;
258 void set_attribute(
const string& aAttributeName,
const string& aAttributeValue);
266 mutable string iText;
267 bool iUseEmptyElementTag;
270 template <
typename CharT,
typename Alloc = std::allocator<CharT> >
275 static void*
operator new(std::size_t) {
return typename Alloc::template rebind<html_text>::other().allocate(1); }
276 static void operator delete(
void* ptr) {
return typename Alloc::template rebind<html_text>::other().deallocate(
static_cast<html_text*
>(ptr), 1); }
289 const string&
content()
const {
return iContent; }
297 template <
typename CharT,
typename Alloc = std::allocator<CharT> >
302 static void*
operator new(std::size_t) {
return typename Alloc::template rebind<html_comment>::other().allocate(1); }
303 static void operator delete(
void* ptr) {
return typename Alloc::template rebind<html_comment>::other().deallocate(
static_cast<html_comment*
>(ptr), 1); }
316 const string&
content()
const {
return iContent; }
329 html(std::string
const& aFragment);
334 std::shared_ptr<std::istream> iDocument;
const_iterator(const iterator &aIterator)
const html_element * operator->() const
const html_element & operator*() const
const_iterator(typename node::const_iterator aIterator)
iterator(typename node::iterator aIterator)
html_element * operator->() const
html_element & operator*() const
html_element & append(const CharT *aName)
html_element(type_e aType)
void set_use_empty_element_tag(bool aUseEmptyElementTag)
node::iterator insert(typename node::iterator aPosition, const CharT *aName)
std::map< string, string, std::less< string >, typename allocator_type::template rebind< attribute >::other > attribute_list
const string & text() const
void set_attribute(const string &aAttributeName, const string &aAttributeValue)
void append_text(const string &aText)
bool use_empty_element_tag() const
html_node< CharT, Alloc > node
const string & attribute_value(const string &aAttributeName) const
const_iterator begin() const
attribute_list & attributes()
std::pair< const string, string > attribute
const string & attribute_value(const string &aNewAttributeName, const string &aOldAttributeName) const
const attribute_list & attributes() const
const_iterator end() const
bool has_attribute(const string &aAttributeName) const
node::allocator_type allocator_type
const node * operator->() const
const_iterator operator--(int)
const_iterator & operator--()
const_iterator(const node &aNode, typename node::node_list::const_iterator aIterator, typename node::type_e aFilter=node::All)
const_iterator & operator=(const iterator &aOther)
const_iterator(const const_iterator &aOther)
const_iterator(const iterator aIterator)
const_iterator & operator=(const const_iterator &aOther)
const node & operator*() const
node::node_list::const_iterator base() const
const_iterator operator++(int)
bool operator==(const const_iterator &aOther) const
bool operator!=(const const_iterator &aOther) const
const_iterator & operator++()
node::node_list::iterator base() const
iterator & operator=(const iterator &aOther)
bool operator==(const iterator &aOther) const
node * operator->() const
iterator(const iterator &aOther)
bool operator!=(const iterator &aOther) const
iterator(node &aNode, typename node::node_list::iterator aIterator, typename node::type_e aFilter=node::All)
iterator begin(type_e aFilter=All)
iterator find_or_append(const string &aName)
const node & back() const
const_iterator begin(type_e aFilter=All) const
html_node(type_e aType=Document)
void push_back(node_ptr aNode)
void erase(iterator aIterator)
neolib::basic_quick_string< CharT > string
iterator end(type_e aFilter=All)
html_node< CharT, allocator_type > node
iterator find_or_throw(const string &aName)
iterator insert(iterator aIterator, node_ptr aNode)
const_iterator find(const string &aName) const
iterator find(const string &aName)
const_iterator end(type_e aFilter=All) const
const_iterator find_or_throw(const string &aName) const
const string & content() const
html_text(const string &aContent=string())
html_node< CharT, Alloc > node
html(std::istream &aDocument)
html(std::string const &aFragment)