2013-10-30 12:14:58 +00:00
|
|
|
// This work is subject to the CC0 1.0 Universal (CC0 1.0) Public Domain Dedication
|
|
|
|
// license. Its contents can be found at:
|
|
|
|
// http://creativecommons.org/publicdomain/zero/1.0/
|
|
|
|
|
|
|
|
package bindata
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
"io"
|
|
|
|
)
|
|
|
|
|
|
|
|
// writeTOC writes the table of contents file.
|
2013-10-30 13:45:04 +00:00
|
|
|
func writeTOC(w io.Writer, toc []Asset) error {
|
|
|
|
err := writeTOCHeader(w)
|
2013-10-30 12:14:58 +00:00
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
|
|
|
|
for i := range toc {
|
2013-10-30 13:45:04 +00:00
|
|
|
err = writeTOCAsset(w, &toc[i])
|
2013-10-30 12:14:58 +00:00
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-10-30 13:45:04 +00:00
|
|
|
return writeTOCFooter(w)
|
2013-10-30 12:14:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// writeTOCHeader writes the table of contents file header.
|
2013-10-30 13:45:04 +00:00
|
|
|
func writeTOCHeader(w io.Writer) error {
|
|
|
|
_, err := fmt.Fprintf(w, `
|
2013-10-30 12:14:58 +00:00
|
|
|
// Asset loads and returns the asset for the given name.
|
2013-11-08 15:38:45 +00:00
|
|
|
// It returns an error if the asset could not be found or
|
|
|
|
// could not be loaded.
|
|
|
|
func Asset(name string) ([]byte, error) {
|
2013-10-30 12:14:58 +00:00
|
|
|
if f, ok := _bindata[name]; ok {
|
|
|
|
return f()
|
|
|
|
}
|
2013-11-08 15:38:45 +00:00
|
|
|
return nil, fmt.Errorf("Asset %%s not found", name)
|
2013-10-30 12:14:58 +00:00
|
|
|
}
|
|
|
|
|
2014-05-12 04:59:00 +00:00
|
|
|
// AssetNames returns the names of the assets.
|
|
|
|
func AssetNames() []string {
|
|
|
|
names := make([]string, 0, len(_bindata))
|
2014-05-12 09:15:42 +00:00
|
|
|
for name := range _bindata {
|
|
|
|
names = append(names, name)
|
2014-05-12 04:59:00 +00:00
|
|
|
}
|
|
|
|
return names
|
|
|
|
}
|
|
|
|
|
2013-10-30 12:14:58 +00:00
|
|
|
// _bindata is a table, holding each asset generator, mapped to its name.
|
2013-11-08 15:38:45 +00:00
|
|
|
var _bindata = map[string] func() ([]byte, error) {
|
2013-10-30 13:45:04 +00:00
|
|
|
`)
|
2013-10-30 12:14:58 +00:00
|
|
|
return err
|
|
|
|
}
|
|
|
|
|
|
|
|
// writeTOCAsset write a TOC entry for the given asset.
|
2013-10-30 13:45:04 +00:00
|
|
|
func writeTOCAsset(w io.Writer, asset *Asset) error {
|
2013-10-30 12:14:58 +00:00
|
|
|
_, err := fmt.Fprintf(w, "\t%q: %s,\n", asset.Name, asset.Func)
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
|
|
|
|
// writeTOCFooter writes the table of contents file footer.
|
2013-10-30 13:45:04 +00:00
|
|
|
func writeTOCFooter(w io.Writer) error {
|
2013-10-30 12:14:58 +00:00
|
|
|
_, err := fmt.Fprintf(w, `
|
|
|
|
}
|
|
|
|
`)
|
|
|
|
return err
|
|
|
|
}
|