khenaidoo | ac63710 | 2019-01-14 15:44:34 -0500 | [diff] [blame] | 1 | // Copyright 2013 The Go Authors. All rights reserved. |
| 2 | // Use of this source code is governed by a BSD-style |
| 3 | // license that can be found in the LICENSE file. |
| 4 | |
| 5 | package colltab // import "golang.org/x/text/internal/colltab" |
| 6 | |
| 7 | // A Weighter can be used as a source for Collator and Searcher. |
| 8 | type Weighter interface { |
| 9 | // Start finds the start of the segment that includes position p. |
| 10 | Start(p int, b []byte) int |
| 11 | |
| 12 | // StartString finds the start of the segment that includes position p. |
| 13 | StartString(p int, s string) int |
| 14 | |
| 15 | // AppendNext appends Elems to buf corresponding to the longest match |
| 16 | // of a single character or contraction from the start of s. |
| 17 | // It returns the new buf and the number of bytes consumed. |
| 18 | AppendNext(buf []Elem, s []byte) (ce []Elem, n int) |
| 19 | |
| 20 | // AppendNextString appends Elems to buf corresponding to the longest match |
| 21 | // of a single character or contraction from the start of s. |
| 22 | // It returns the new buf and the number of bytes consumed. |
| 23 | AppendNextString(buf []Elem, s string) (ce []Elem, n int) |
| 24 | |
| 25 | // Domain returns a slice of all single characters and contractions for which |
| 26 | // collation elements are defined in this table. |
| 27 | Domain() []string |
| 28 | |
| 29 | // Top returns the highest variable primary value. |
| 30 | Top() uint32 |
| 31 | } |