// Copyright 2018 The Chromium Authors // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef COMPONENTS_LANGUAGE_CONTENT_BROWSER_ULP_LANGUAGE_CODE_LOCATOR_S2LANGQUADTREE_H_ #define COMPONENTS_LANGUAGE_CONTENT_BROWSER_ULP_LANGUAGE_CODE_LOCATOR_S2LANGQUADTREE_H_ #include <algorithm> #include <bitset> #include <map> #include <string> #include <vector> #include "base/bits.h" class S2CellId; // A serialized language tree. The bits given by GetBitAt represent a // depth-first traversal of the tree with (1) internal nodes represented by a // single bit 0, and (2) leaf nodes represented by a bit 1 followed by the // binary form of the index of the language at that leaf into the tree's // languages, accessible through GetLanguageAt. We assume those indexes have the // smallest number of bits necessary. Indices are 1-based; index 0 represents // absent language. class SerializedLanguageTree { … }; // An implementation of SerializedLanguageTree that backs the tree's structure // by a bitset. template <size_t numbits> class BitsetSerializedLanguageTree : public SerializedLanguageTree { … }; // The node of a S2Cell-based quadtree holding string languages in its leaves. class S2LangQuadTreeNode { … }; #endif // COMPONENTS_LANGUAGE_CONTENT_BROWSER_ULP_LANGUAGE_CODE_LOCATOR_S2LANGQUADTREE_H_