#include "net/tools/huffman_trie/trie/trie_writer.h"
#include <algorithm>
#include <ostream>
#include "base/check.h"
#include "net/tools/huffman_trie/trie/trie_bit_buffer.h"
namespace net::huffman_trie {
namespace {
bool CompareReversedEntries(
const std::unique_ptr<net::huffman_trie::ReversedEntry>& lhs,
const std::unique_ptr<net::huffman_trie::ReversedEntry>& rhs) { … }
std::vector<uint8_t> LongestCommonPrefix(ReversedEntries::const_iterator start,
ReversedEntries::const_iterator end) { … }
std::vector<uint8_t> ReverseName(const std::string& hostname) { … }
void RemovePrefix(size_t length,
ReversedEntries::iterator start,
ReversedEntries::iterator end) { … }
}
ReversedEntry::ReversedEntry(std::vector<uint8_t> reversed_name,
const TrieEntry* entry)
: … { … }
ReversedEntry::~ReversedEntry() = default;
TrieWriter::TrieWriter(
const huffman_trie::HuffmanRepresentationTable& huffman_table,
huffman_trie::HuffmanBuilder* huffman_builder)
: … { … }
TrieWriter::~TrieWriter() = default;
bool TrieWriter::WriteEntries(const TrieEntries& entries,
uint32_t* root_position) { … }
bool TrieWriter::WriteDispatchTables(ReversedEntries::iterator start,
ReversedEntries::iterator end,
uint32_t* position) { … }
uint32_t TrieWriter::position() const { … }
void TrieWriter::Flush() { … }
}