/
githubmirror
/
amphtml
Обзор
Документация
Войти
/
githubmirror
/
amphtml
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
validator/cpp/htmlparser/document.cc
29 строк
907 B
Boxiao Cao
♻️ Use single bazel workspace for validator (#37131)
14 дек 2021, 00:56
Не верифицирован
14 дек 2021, 00:56
9b8d9f4
Код
Авторство
О чём код?
#include "absl/flags/flag.h" #include "cpp/htmlparser/document.h" ABSL_FLAG(std::size_t, htmlparser_nodes_allocator_block_size, 256 << 10 /* 256k */, "Allocator block size for html nodes."); namespace htmlparser { Document::Document() : node_allocator_(new Allocator<Node>( ::absl::GetFlag(FLAGS_htmlparser_nodes_allocator_block_size))), root_node_(NewNode(NodeType::DOCUMENT_NODE)) {} Node* Document::NewNode(NodeType node_type, Atom atom) { return node_allocator_->Construct(node_type, atom); } Node* Document::CloneNode(const Node* from) { Node* clone = NewNode(from->Type()); clone->atom_ = from->atom_; clone->data_ = from->data_; clone->attributes_.reserve(from->Attributes().size()); std::copy(from->Attributes().begin(), from->Attributes().end(), std::back_inserter(clone->attributes_)); return clone; } } // namespace htmlparser