| 1 | // Copyright 2012 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 collatescip-go gomod golang.org/x/text . `golang.org/x/text/collate`/ |
| 6 | |
| 7 | // Export for testing. |
| 8 | // TODO: no longer necessary. Remove at some point. |
| 9 | |
| 10 | import ( |
| 11 | "fmtscip-go gomod github.com/golang/go/src go1.25.0 fmt/" |
| 12 | |
| 13 | "golang.org/x/text/internal/colltabscip-go gomod golang.org/x/text . `golang.org/x/text/internal/colltab`/" |
| 14 | ) |
| 15 | |
| 16 | const ( |
| 17 | defaultSecondaryscip-go gomod golang.org/x/text . `golang.org/x/text/collate`/defaultSecondary. = 0x20 |
| 18 | defaultTertiaryscip-go gomod golang.org/x/text . `golang.org/x/text/collate`/defaultTertiary. = 0x2 |
| 19 | ) |
| 20 | |
| 21 | type Weightsscip-go gomod golang.org/x/text . `golang.org/x/text/collate`/Weights# struct { |
| 22 | Primaryscip-go gomod golang.org/x/text . `golang.org/x/text/collate`/Weights#Primary., Secondaryscip-go gomod golang.org/x/text . `golang.org/x/text/collate`/Weights#Secondary., Tertiaryscip-go gomod golang.org/x/text . `golang.org/x/text/collate`/Weights#Tertiary., Quaternaryscip-go gomod golang.org/x/text . `golang.org/x/text/collate`/Weights#Quaternary. int |
| 23 | } |
| 24 | |
| 25 | func Wscip-go gomod golang.org/x/text . `golang.org/x/text/collate`/W().(ce ...int) Weightsscip-go gomod golang.org/x/text . `golang.org/x/text/collate`/Weights# { |
| 26 | w := Weightsscip-go gomod golang.org/x/text . `golang.org/x/text/collate`/Weights#{ce[0], defaultSecondaryscip-go gomod golang.org/x/text . `golang.org/x/text/collate`/defaultSecondary., defaultTertiaryscip-go gomod golang.org/x/text . `golang.org/x/text/collate`/defaultTertiary., 0} |
| 27 | if len(ce) > 1 { |
| 28 | w.Secondaryscip-go gomod golang.org/x/text . `golang.org/x/text/collate`/Weights#Secondary. = ce[1] |
| 29 | } |
| 30 | if len(ce) > 2 { |
| 31 | w.Tertiaryscip-go gomod golang.org/x/text . `golang.org/x/text/collate`/Weights#Tertiary. = ce[2] |
| 32 | } |
| 33 | if len(ce) > 3 { |
| 34 | w.Quaternaryscip-go gomod golang.org/x/text . `golang.org/x/text/collate`/Weights#Quaternary. = ce[3] |
| 35 | } |
| 36 | return w |
| 37 | } |
| 38 | func (w Weightsscip-go gomod golang.org/x/text . `golang.org/x/text/collate`/Weights#) Stringscip-go gomod golang.org/x/text . `golang.org/x/text/collate`/Weights#String().() string { |
| 39 | return fmtscip-go gomod github.com/golang/go/src go1.25.0 fmt/.Sprintfscip-go gomod github.com/golang/go/src go1.25.0 fmt/Sprintf().("[%X.%X.%X.%X]", w.Primaryscip-go gomod golang.org/x/text . `golang.org/x/text/collate`/Weights#Primary., w.Secondaryscip-go gomod golang.org/x/text . `golang.org/x/text/collate`/Weights#Secondary., w.Tertiaryscip-go gomod golang.org/x/text . `golang.org/x/text/collate`/Weights#Tertiary., w.Quaternaryscip-go gomod golang.org/x/text . `golang.org/x/text/collate`/Weights#Quaternary.) |
| 40 | } |
| 41 | |
| 42 | func convertFromWeightsscip-go gomod golang.org/x/text . `golang.org/x/text/collate`/convertFromWeights().(ws []Weightsscip-go gomod golang.org/x/text . `golang.org/x/text/collate`/Weights#) []colltabscip-go gomod golang.org/x/text . `golang.org/x/text/internal/colltab`/.Elemscip-go gomod golang.org/x/text . `golang.org/x/text/internal/colltab`/Elem# { |
| 43 | out := make([]colltabscip-go gomod golang.org/x/text . `golang.org/x/text/internal/colltab`/.Elemscip-go gomod golang.org/x/text . `golang.org/x/text/internal/colltab`/Elem#, len(ws)) |
| 44 | for i, w := range ws { |
| 45 | out[i], _ = colltabscip-go gomod golang.org/x/text . `golang.org/x/text/internal/colltab`/.MakeElemscip-go gomod golang.org/x/text . `golang.org/x/text/internal/colltab`/MakeElem().(w.Primaryscip-go gomod golang.org/x/text . `golang.org/x/text/collate`/Weights#Primary., w.Secondaryscip-go gomod golang.org/x/text . `golang.org/x/text/collate`/Weights#Secondary., w.Tertiaryscip-go gomod golang.org/x/text . `golang.org/x/text/collate`/Weights#Tertiary., 0) |
| 46 | if out[i] == colltabscip-go gomod golang.org/x/text . `golang.org/x/text/internal/colltab`/.Ignorescip-go gomod golang.org/x/text . `golang.org/x/text/internal/colltab`/Ignore. && w.Quaternaryscip-go gomod golang.org/x/text . `golang.org/x/text/collate`/Weights#Quaternary. > 0 { |
| 47 | out[i] = colltabscip-go gomod golang.org/x/text . `golang.org/x/text/internal/colltab`/.MakeQuaternaryscip-go gomod golang.org/x/text . `golang.org/x/text/internal/colltab`/MakeQuaternary().(w.Quaternaryscip-go gomod golang.org/x/text . `golang.org/x/text/collate`/Weights#Quaternary.) |
| 48 | } |
| 49 | } |
| 50 | return out |
| 51 | } |