// IsFormat checks if input is a correctly formatted URI template per RFC6570
354512
func (f URITemplateFormatChecker) IsFormat(input interface{}) bool {
	asString, ok := input.(string)
	if !ok {
		return false
	}

	u, err := url.Parse(asString)
	if err != nil || strings.Contains(asString, `\`) {
		return false
	}

	return rxURITemplate.MatchString(u.Path)
}
969808
func (s *UpdateBusinessReportScheduleInput) SetFormat(v string) *UpdateBusinessReportScheduleInput {
	s.Format = &v
	return s
}
1130512
func (surface *ImageSurface) GetFormat() Format {
	ret := Format(C.cairo_image_surface_get_format(surface.Ptr))
	if err := surface.status(); err != nil {
		panic(err)
	}
	return ret
}
894396
func (f URIFormatChecker) IsFormat(input interface{}) bool {
	asString, ok := input.(string)
	if !ok {
		return false
	}

	u, err := url.Parse(asString)

	if err != nil || u.Scheme == "" {
		return false
	}

	return !strings.Contains(asString, `\`)
}
454212
func GetFormat(in io.Reader) (*Format, error) {
	var dec vorbis.Decoder
	r := oggReader{source: in}
	p, err := r.NextPacket()
	if err != nil {
		return nil, err
	}
	err = dec.ReadHeader(p)
	if err != nil {
		return nil, err
	}
	return &Format{
		SampleRate: dec.SampleRate(),
		Channels:   dec.Channels(),
		Bitrate:    dec.Bitrate,
	}, nil
}
1256994
func (c *Context) ResolveFormat() string {
	format := c.Query("format")
	if format != `` {
		return format
	}
	accept := c.Header("Accept")
	switch {
	case accept == "",
		strings.HasPrefix(accept, "*/*"), // */
		strings.Contains(accept, "application/xhtml"),
		strings.Contains(accept, "text/html"):
		return "html"
	case strings.Contains(accept, "application/json"),
		strings.Contains(accept, "text/javascript"),
		strings.Contains(accept, "application/javascript"):
		return "json"
	case strings.Contains(accept, "application/xml"),
		strings.Contains(accept, "text/xml"):
		return "xml"
	case strings.Contains(accept, "text/plain"):
		return "text"
	}

	return "html"
}
812001
func (f JSONPointerFormatChecker) IsFormat(input interface{}) bool {
	asString, ok := input.(string)
	if !ok {
		return false
	}

	return rxJSONPointer.MatchString(asString)
}
1249259
func (s *WavSettings) SetFormat(v string) *WavSettings {
	s.Format = &v
	return s
}
1212101
func isXLMetaFormatValid(version, format string) bool {
	return ((version == xlMetaVersion || version == xlMetaVersion100) &&
		format == xlMetaFormat)
}
385731
func (d *API) RegisterFormat(name string, format strfmt.Format, validator strfmt.Validator) {
	if d.formats == nil {
		d.formats = strfmt.NewFormats()
	}
	d.formats.Add(name, format, validator)
}
229144
func IsFormatSupported(p StreamParameters, args ...interface{}) error {
	s := &Stream{}
	err := s.init(p, args...)
	if err != nil {
		return err
	}
	return newError(C.Pa_IsFormatSupported(s.inParams, s.outParams, C.double(p.SampleRate)))
}
869365
func (o *GreeterAPI) RegisterFormat(name string, format strfmt.Format, validator strfmt.Validator) {
	o.formats.Add(name, format, validator)
}
629784
func (s *JobManifestSpec) SetFormat(v string) *JobManifestSpec {
	s.Format = &v
	return s
}
1237787
func (s *Playlist) SetFormat(v string) *Playlist {
	s.Format = &v
	return s
}
397897
func (m xlMetaV1) IsValid() bool {
	return isXLMetaFormatValid(m.Version, m.Format) &&
		isXLMetaErasureInfoValid(m.Erasure.DataBlocks, m.Erasure.ParityBlocks)
}
60325
func (f HostnameFormatChecker) IsFormat(input interface{}) bool {
	asString, ok := input.(string)
	if !ok {
		return false
	}

	return rxHostname.MatchString(asString) && len(asString) < 256
}
19064
func validateFormatString(v contract.ValueDescriptor) error {
	// No formatting specified
	if v.Formatting == "" {
		return nil
	}

	match, err := regexp.MatchString(formatSpecifier, v.Formatting)

	if err != nil {
		LoggingClient.Error("Error checking for format string for value descriptor " + v.Name)
		return err
	}
	if !match {
		err = fmt.Errorf("format is not a valid printf format")
		LoggingClient.Error(fmt.Sprintf("Error posting value descriptor. %s", err.Error()))
		return errors.NewErrValueDescriptorInvalid(v.Name, err)
	}

	return nil
}