// Add a new Sheet, with the provided name, to a File
769908
func (f *File) AddSheet(sheetName string) (sheet *Sheet, err error) {
	if _, exists := f.Sheet[sheetName]; exists {
		return nil, fmt.Errorf("Duplicate sheet name '%s'.", sheetName)
	}
	sheet = &Sheet{Name: sheetName, File: f}
	if len(f.Sheets) == 0 {
		sheet.Selected = true
	}
	f.Sheet[sheetName] = sheet
	f.Sheets = append(f.Sheets, sheet)
	return sheet, nil
}
453157
func ExcelSheetNameReplace(fileName string) string {
	r := []rune(fileName)
	size := len(r)
	for i := 0; i < size; i++ {
		switch r[i] {
		case ':', '：', '*', '?', '？', '/', '／', '\\', '╲', ']', '[':
			r[i] = '_'
		}
	}
	return strings.Replace(string(r), USE_KEYIN, ``, -1)
}
1096258
func (fi FileInfo) Name() string {
	if fi.CustomName != "" {
		return fi.CustomName
	}
	return fi.FileInfo.Name()
}
654082
func addFile(w *multipart.Writer, fieldName, path string) error {
	file, err := os.Open(path)
	if err != nil {
		return err
	}
	defer file.Close()

	part, err := w.CreateFormFile(fieldName, filepath.Base(path))
	if err != nil {
		return err
	}
	_, err = io.Copy(part, file)

	return err
}
1081831
func (b Buffer) Name(nametype *OID) (*Name, error) {
	var min C.OM_uint32
	var result C.gss_name_t

	maj := C.wrap_gss_import_name(b.Fp_gss_import_name, &min,
		b.C_gss_buffer_t, nametype.C_gss_OID, &result)
	err := b.stashLastStatus(maj, min)
	if err != nil {
		return nil, err
	}

	n := &Name{
		Lib:          b.Lib,
		C_gss_name_t: result,
	}
	return n, nil
}
667736
func (fs *fakeFs) Create(name string) (File, error) {
	file, err := fs.a.Fs.Create(name)
	if err != nil {
		return nil, err
	}
	return &fakeFile{file}, nil
}
753610
func NewFile() (file *File) {
	file = &File{}
	file.Sheet = make(map[string]*Sheet)
	file.Sheets = make([]*Sheet, 0)
	return
}
847190
func (c FSIndexBlobs) Add(name, path, sha1 string) (string, string, error) {
	dstPath, err := c.blobPath(sha1)
	if err != nil {
		return "", "", err
	}

	if !c.fs.FileExists(dstPath) {
		err := c.fs.CopyFile(path, dstPath)
		if err != nil {
			return "", "", bosherr.WrapErrorf(err, "Copying file '%s' with SHA1 '%s' into cache", path, sha1)
		}
	}

	if c.blobstore != nil {
		desc := fmt.Sprintf("sha1=%s", sha1)

		c.reporter.IndexEntryUploadStarted(name, desc)

		blobID, _, err := c.blobstore.Create(path)
		if err != nil {
			c.reporter.IndexEntryUploadFinished(name, desc, err)
			return "", "", bosherr.WrapErrorf(err, "Creating blob for path '%s'", path)
		}

		c.reporter.IndexEntryUploadFinished(name, desc, nil)

		return blobID, dstPath, nil
	}

	return "", dstPath, nil
}
226699
func NewFile() *File {
	return &File{
		Sheet:        make(map[string]*Sheet),
		Sheets:       make([]*Sheet, 0),
		DefinedNames: make([]*xlsxDefinedName, 0),
	}
}
1327530
func (m *FuncRegistry) Add(name string, fn CustomFunc) {
	name = strings.ToLower(name)
	newFunc := Func{Name: name, CustomFunc: fn}
	m.mu.Lock()
	defer m.mu.Unlock()
	aggfn, hasAggFlag := fn.(AggFunc)
	if hasAggFlag {
		newFunc.Aggregate = aggfn.IsAgg()
		if newFunc.Aggregate {
			m.aggs[name] = struct{}{}
		}
	}
	m.funcs[name] = newFunc
}
845127
func (cl FileChangelist) Add(c Change) error {
	cJSON, err := json.Marshal(c)
	if err != nil {
		return err
	}
	filename := fmt.Sprintf("%020d_%s.change", time.Now().UnixNano(), uuid.Generate())
	return ioutil.WriteFile(filepath.Join(cl.dir, filename), cJSON, 0644)
}
239338
func addFormFile(writer *multipart.Writer, name, path string) error {
	file, err := os.Open(path)
	if err != nil {
		return err
	}
	defer file.Close()
	part, err := writer.CreateFormFile(name, filepath.Base(path))
	if err != nil {
		return err
	}

	_, err = io.Copy(part, file)

	return err
}
100985
func (f *Folder) AddFile(name string, contentType string) error {
	return f.addFile(strings.Split(name, sep), contentType)
}
125458
func NewFile(name string, b []byte) (File, error) {
	return packd.NewFile(name, bytes.NewReader(b))
}
70949
func (w *Watcher) Add(name string) (err error) {
	w.mu.Lock()
	defer w.mu.Unlock()

	name, err = filepath.Abs(name)
	if err != nil {
		return err
	}

	// If name is on the ignored list or if hidden files are
	// ignored and name is a hidden file or directory, simply return.
	_, ignored := w.ignored[name]

	isHidden, err := isHiddenFile(name)
	if err != nil {
		return err
	}

	if ignored || (w.ignoreHidden && isHidden) {
		return nil
	}

	// Add the directory's contents to the files list.
	fileList, err := w.list(name)
	if err != nil {
		return err
	}
	for k, v := range fileList {
		w.files[k] = v
	}

	// Add the name to the names list.
	w.names[name] = false

	return nil
}
431367
func (m *DbMap) AddTableWithName(i interface{}, name string) *TableMap {
	return m.AddTable(i, name)
}
959354
func AddStylesheet(url string) {
	link := global.Get("document").Call("createElement", "link")
	link.Set("rel", "stylesheet")
	link.Set("href", url)
	global.Get("document").Get("head").Call("appendChild", link)
}