github.com/insionng/yougam@v0.0.0-20170714101924-2bc18d833463/libraries/golang/text/secure/precis/transformer.go (about) 1 // Copyright 2015 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 precis 6 7 import ( 8 "github.com/insionng/yougam/libraries/x/text/transform" 9 ) 10 11 // Transformer implements the transform.Transformer interface. 12 type Transformer struct { 13 t transform.Transformer 14 } 15 16 // Reset implements the transform.Transformer interface. 17 func (t Transformer) Reset() { t.t.Reset() } 18 19 // Transform implements the transform.Transformer interface. 20 func (t Transformer) Transform(dst, src []byte, atEOF bool) (nDst, nSrc int, err error) { 21 return t.t.Transform(dst, src, atEOF) 22 } 23 24 // Bytes returns a new byte slice with the result of applying t to b. 25 func (t Transformer) Bytes(b []byte) []byte { 26 b, _, _ = transform.Bytes(t, b) 27 return b 28 } 29 30 // String returns a string with the result of applying t to s. 31 func (t Transformer) String(s string) string { 32 s, _, _ = transform.String(t, s) 33 return s 34 }