// Content assigns the value of the result into the valuePtr using default decoding.
764378
func (d *GetResult) Content(valuePtr interface{}) error {
	return DefaultDecode(d.contents, d.flags, valuePtr)
}
909917
func Encode(content string, interleaved bool) (barcode.Barcode, error) {
	if content == "" {
		return nil, errors.New("content is empty")
	}

	if interleaved && len(content)%2 == 1 {
		return nil, errors.New("can only encode even number of digits in interleaved mode")
	}

	mode := modes[interleaved]
	resBits := new(utils.BitList)
	resBits.AddBit(mode.start...)

	var lastRune *rune
	for _, r := range content {
		var a, b pattern
		if interleaved {
			if lastRune == nil {
				lastRune = new(rune)
				*lastRune = r
				continue
			} else {
				var o1, o2 bool
				a, o1 = encodingTable[*lastRune]
				b, o2 = encodingTable[r]
				if !o1 || !o2 {
					return nil, fmt.Errorf("can not encode \"%s\"", content)
				}
				lastRune = nil
			}
		} else {
			var ok bool
			a, ok = encodingTable[r]
			if !ok {
				return nil, fmt.Errorf("can not encode \"%s\"", content)
			}
			b = nonInterleavedSpace
		}

		for i := 0; i < patternWidth; i++ {
			for x := 0; x < mode.widths[a[i]]; x++ {
				resBits.AddBit(true)
			}
			for x := 0; x < mode.widths[b[i]]; x++ {
				resBits.AddBit(false)
			}
		}
	}

	resBits.AddBit(mode.end...)

	if interleaved {
		return utils.New1DCode(barcode.Type2of5Interleaved, content, resBits), nil
	} else {
		return utils.New1DCode(barcode.Type2of5, content, resBits), nil
	}
}
1161058
func (c *Context) ResolveContentType() string {
	contentType := c.Header("Content-Type")
	if contentType == "" {
		return "text/html"
	}
	return strings.ToLower(strings.TrimSpace(strings.Split(contentType, ";")[0]))
}
237073
func (s *PutLexiconInput) SetContent(v string) *PutLexiconInput {
	s.Content = &v
	return s
}
811256
func DecodeContent(filename string, data []byte, json bool) (string, error) {
	name := path.Base(filename)

	var p proto.Message
	switch name {
	case topo.CellInfoFile:
		p = new(topodatapb.CellInfo)
	case topo.KeyspaceFile:
		p = new(topodatapb.Keyspace)
	case topo.ShardFile:
		p = new(topodatapb.Shard)
	case topo.VSchemaFile:
		p = new(vschemapb.Keyspace)
	case topo.ShardReplicationFile:
		p = new(topodatapb.ShardReplication)
	case topo.TabletFile:
		p = new(topodatapb.Tablet)
	case topo.SrvVSchemaFile:
		p = new(vschemapb.SrvVSchema)
	case topo.SrvKeyspaceFile:
		p = new(topodatapb.SrvKeyspace)
	case topo.RoutingRulesFile:
		p = new(vschemapb.RoutingRules)
	default:
		if json {
			return "", fmt.Errorf("unknown topo protobuf type for %v", name)
		} else {
			return string(data), nil
		}
	}

	if err := proto.Unmarshal(data, p); err != nil {
		return string(data), err
	}

	if json {
		return new(jsonpb.Marshaler).MarshalToString(p)
	} else {
		return proto.MarshalTextString(p), nil
	}
}
939325
func (s *AppSpecContent) SetContent(v string) *AppSpecContent {
	s.Content = &v
	return s
}
1164733
func (list *List) Contents() []string {
	slice := make([]string, 0)
	if list.length == 0 {
		return slice
	}
	tmp := list.first
	for i := 0; i < list.length; i++ {
		slice = append(slice, tmp.Content)
		if tmp.IsLast() {
			break
		}
		tmp = tmp.Next
	}
	return slice
}
258914
func (r *RepositoryLicense) GetContent() string {
	if r == nil || r.Content == nil {
		return ""
	}
	return *r.Content
}
1048748
func (c *stringChanger) Value() (string, error) {
	if c.err != nil {
		return "", c.err
	}
	if c.node.content.value() == nil {
		return "", nil
	}
	return c.node.content.value().(string), nil
}
294145
func (s *PublicTxPoolAPI) Content() map[string]map[string]map[string]*RPCTransaction {
	content := map[string]map[string]map[string]*RPCTransaction{
		"pending": make(map[string]map[string]*RPCTransaction),
		"queued":  make(map[string]map[string]*RPCTransaction),
	}
	pending, queue := s.b.TxPoolContent()

	// Flatten the pending transactions
	for account, txs := range pending {
		dump := make(map[string]*RPCTransaction)
		for _, tx := range txs {
			dump[fmt.Sprintf("%d", tx.Nonce())] = newRPCPendingTransaction(tx)
		}
		content["pending"][account.Hex()] = dump
	}
	// Flatten the queued transactions
	for account, txs := range queue {
		dump := make(map[string]*RPCTransaction)
		for _, tx := range txs {
			dump[fmt.Sprintf("%d", tx.Nonce())] = newRPCPendingTransaction(tx)
		}
		content["queued"][account.Hex()] = dump
	}
	return content
}
489735
func (pool *TxPool) Content() (map[common.Address]types.Transactions, map[common.Address]types.Transactions) {
	pool.mu.RLock()
	defer pool.mu.RUnlock()

	// Retrieve all the pending transactions and sort by account and by nonce
	pending := make(map[common.Address]types.Transactions)
	for _, tx := range pool.pending {
		account, _ := types.Sender(pool.signer, tx)
		pending[account] = append(pending[account], tx)
	}
	// There are no queued transactions in a light pool, just return an empty map
	queued := make(map[common.Address]types.Transactions)
	return pending, queued
}
732965
func (c *Context) Data(code int, data interface{}, mime string) (err error) {
	c.response.Header().Set("Content-Type", mime)
	c.response.WriteHeader(code)
	switch conv := data.(type) {
	case []byte:
		c.response.Write(conv)
	case string:
		c.response.Write([]byte(conv))
	}
	return
}
177438
func CompressEncodeString(content string) string {
	return base64.StdEncoding.EncodeToString(CompressContent([]byte(content)))
}
895016
func GenerateContent(reader io.ReadSeeker) (Content, error) {
	var sizer utils.SizeTracker
	sizingReader := io.TeeReader(reader, &sizer)
	fp, err := charmresource.GenerateFingerprint(sizingReader)
	if err != nil {
		return Content{}, errors.Trace(err)
	}
	if _, err := reader.Seek(0, os.SEEK_SET); err != nil {
		return Content{}, errors.Trace(err)
	}
	size := sizer.Size()

	content := Content{
		Data:        reader,
		Size:        size,
		Fingerprint: fp,
	}
	return content, nil
}
135312
func (s *InventoryResultItem) SetContent(v []map[string]*string) *InventoryResultItem {
	s.Content = v
	return s
}
75763
func indentContent(indent int, content string) string {
	var b bytes.Buffer
	length := len(strings.Split(content, "\n")) - 1
	for i, x := range strings.Split(content, "\n") {
		// @check if the length of the line is zero and set spacer
		spacer := indent
		if i == 0 || len(x) <= 0 {
			spacer = 0
		}
		// @step: write the line to the buffer
		line := fmt.Sprintf("%"+fmt.Sprintf("%d", spacer)+"s%s", "", x)
		b.WriteString(line)

		// @check if we need a newline
		if i < length {
			b.WriteString("\n")
		}
	}

	return b.String()
}
1182556
func (c *xContext) NoContent(codes ...int) error {
	if len(codes) > 0 {
		c.code = codes[0]
	}
	if c.code == 0 {
		c.code = http.StatusOK
	}
	c.response.WriteHeader(c.code)
	return nil
}