// Copyright 2018 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef NET_TOOLS_HUFFMAN_TRIE_TRIE_ENTRY_H_ #define NET_TOOLS_HUFFMAN_TRIE_TRIE_ENTRY_H_ #include #include #include namespace net { namespace huffman_trie { class TrieBitBuffer; class TrieEntry { public: TrieEntry(); virtual ~TrieEntry(); // The name to be used when inserting the entry to the trie. E.g. for HSTS // preload list, this is the hostname. virtual std::string name() const = 0; virtual bool WriteEntry(huffman_trie::TrieBitBuffer* writer) const = 0; }; // std::unique_ptr's are not covariant, so operations on TrieEntry uses a vector // of raw pointers instead. using TrieEntries = std::vector; // ReversedEntry points to a TrieEntry and contains the reversed name for // that entry. This is used to construct the trie. struct ReversedEntry { ReversedEntry(std::vector reversed_name, const TrieEntry* entry); ~ReversedEntry(); std::vector reversed_name; const TrieEntry* entry; }; using ReversedEntries = std::vector>; } // namespace huffman_trie } // namespace net #endif // NET_TOOLS_HUFFMAN_TRIE_TRIE_ENTRY_H_