OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [libgo/] [go/] [net/] [textproto/] [header.go] - Blame information for rev 747

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 747 jeremybenn
// Copyright 2010 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 textproto
6
 
7
// A MIMEHeader represents a MIME-style header mapping
8
// keys to sets of values.
9
type MIMEHeader map[string][]string
10
 
11
// Add adds the key, value pair to the header.
12
// It appends to any existing values associated with key.
13
func (h MIMEHeader) Add(key, value string) {
14
        key = CanonicalMIMEHeaderKey(key)
15
        h[key] = append(h[key], value)
16
}
17
 
18
// Set sets the header entries associated with key to
19
// the single element value.  It replaces any existing
20
// values associated with key.
21
func (h MIMEHeader) Set(key, value string) {
22
        h[CanonicalMIMEHeaderKey(key)] = []string{value}
23
}
24
 
25
// Get gets the first value associated with the given key.
26
// If there are no values associated with the key, Get returns "".
27
// Get is a convenience method.  For more complex queries,
28
// access the map directly.
29
func (h MIMEHeader) Get(key string) string {
30
        if h == nil {
31
                return ""
32
        }
33
        v := h[CanonicalMIMEHeaderKey(key)]
34
        if len(v) == 0 {
35
                return ""
36
        }
37
        return v[0]
38
}
39
 
40
// Del deletes the values associated with key.
41
func (h MIMEHeader) Del(key string) {
42
        delete(h, CanonicalMIMEHeaderKey(key))
43
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.