📄 array_visitor.h
字号:
/*** HTML::Tree** array_visitor.h**** Copyright (C) 2001 Paul J. Lucas**** 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.**** This program is distributed in the hope that it will be useful,** but WITHOUT ANY WARRANTY; without even the implied warranty of** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the** GNU General Public License for more details.**** You should have received a copy of the GNU General Public License** along with this program; if not, write to the Free Software** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.*/#ifndef array_visitor_H#define array_visitor_H// standard#include <stack>// local#include "util.h" /* must go first */#include "HTML_Node.h"//*****************************************************************************//// SYNOPSIS// class array_visitor : public HTML_Tree::HTML_Node::visitor//// DESCRIPTION//// An array_visitor is-an HTML_Node::visitor that builds an array-of-// hashes data structure representing the entire HTML tree.//// All elements in an array are nodes at the same "depth" or "level." An// array element is either a string (strings that are entirely whitespace// are elided) or a reference to a hash for an HTML element. The hash has// a "name" key and may also have an "atts" key and/or a "content" key.//// The value of the "atts" key is a reference to a hash where the hash// keys are attribute names and the hash values are the attribute values.//// The value of the "content" key is a reference to an array containing// all of the node's child nodes at the next level down.////*****************************************************************************{public: array_visitor( SV* param_hash_ref = 0 ); virtual bool operator()( HTML_Tree::HTML_Node*, int depth, bool is_end_tag ); SV* array() const { dTHX; return newRV_inc( (SV*)av_root_ ); }private: AV *const av_root_; // the top-level array AV *av_cur_; // pointer to current array std::stack< AV* > stack_; // remember where we are during descent bool include_comments_; bool include_ws_text_;};#endif /* array_visitor */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -