// asString is a private helper method to keep the ugly string casting
// in once place. It returns the given named attribute as a string,
// returning "" if it isn't found.
425735
func (c *Config) asString(name string) string {
	value, _ := c.defined[name].(string)
	return value
}
249278
func (a Aux) String() string {
	switch a.Type() {
	case 'A':
		return fmt.Sprintf("%s:%c:%c", []byte(a[:2]), a.Kind(), a.Value())
	case 'H':
		return fmt.Sprintf("%s:%c:%02x", []byte(a[:2]), a.Kind(), a.Value())
	case 'B':
		return fmt.Sprintf("%s:%c:%c:%v", []byte(a[:2]), a.Kind(), a[3], a.Value())
	}
	return fmt.Sprintf("%s:%c:%v", []byte(a[:2]), a.Kind(), a.Value())
}
648006
func (primative *Primative) AsString() (string, error) {
	switch val := primative.value.(type) {
	case bool:
		strVal := "False"
		if val {
			strVal = "True"
		}
		return strVal, nil
	case float64:
		return strconv.FormatFloat(val, 10, -1, 64), nil
	case int64:
		return strconv.FormatInt(val, 10), nil
	case nil:
		return "Null", nil
	case string:
		return val, nil
	}

	msg := fmt.Sprintf("Could not convert value %s to type STRING", primative.value)
	return "", errors.New(msg)
}
162365
func formatAsString(v reflect.Value, kind reflect.Kind) string {
	if kind == reflect.Ptr && !v.IsNil() {
		v = v.Elem()
	}

	return fmt.Sprintf("%v", v.Interface())
}
425152
func TypeString(str string) {
	cstr := C.CString(str)
	C.type_string(cstr)

	C.free(unsafe.Pointer(cstr))
}
622630
func (j *JSON) String(name string) (string, error) {
	v, err := j.value(name)
	if err != nil {
		return "", err
	}

	s, ok := v.(string)
	if !ok {
		return "", errors.New(fmt.Sprintf("unable to cast %T", v))
	}

	return s, nil
}
1034586
func (c *Config) ValueString(name string) (string, bool) {
	v, ok := c.attrs[name].(string)
	return v, ok
}
1081112
func (n *Namer) String() string {
	ext := n.opts.extension
	if n.count == 0 {
		return fmt.Sprintf("%s%s", n.opts.base, ext)
	}
	return fmt.Sprintf("%s%d%s", n.opts.base, n.count, ext)
}
445729
func (h *XMLElement) Attr(k string) string {
	if h.isHTML {
		for _, a := range h.attributes.([]html.Attribute) {
			if a.Key == k {
				return a.Val
			}
		}
	} else {
		for _, a := range h.attributes.([]xml.Attr) {
			if a.Name.Local == k {
				return a.Value
			}
		}
	}
	return ""
}
853267
func (t Table) String() string {
	stringy := t.name + " ("
	for i, a := range t.attributes {
		if i != 0 {
			stringy += " | "
		}
		stringy += a.name + " " + a.typeName
	}
	stringy += ")"
	return stringy
}
878480
func (m Metadata) JsonString() (string, error) {
	// NB: method defined on value
	b, err := json.Marshal(m)
	return string(b), err
}
1069988
func (v *Argument) String() string {
	if v == nil {
		return "<nil>"
	}

	var fields [2]string
	i := 0
	fields[i] = fmt.Sprintf("Name: %v", v.Name)
	i++
	fields[i] = fmt.Sprintf("Type: %v", v.Type)
	i++

	return fmt.Sprintf("Argument{%v}", strings.Join(fields[:i], ", "))
}
377483
func (d *defaulter) AsStringMap(v Valuer, rsep, kvsep string, dv map[string]string) map[string]string {
	value, err := v.Value()
	if err != nil {
		d.logValuerError(err)
		return dv
	}
	rows := strings.Split(value, rsep)
	mvalue := make(map[string]string, len(rows))
	for _, row := range rows {
		kv := strings.SplitN(row, kvsep, 2)
		if len(kv) == 2 {
			mvalue[kv[0]] = kv[1]
		} else {
			mvalue[kv[0]] = kv[0]
		}
	}
	return mvalue
}
619278
func toString(name, target string, att *design.AttributeDefinition) string {
	switch actual := att.Type.(type) {
	case design.Primitive:
		switch actual.Kind() {
		case design.IntegerKind:
			return fmt.Sprintf("%s := strconv.Itoa(%s)", target, name)
		case design.BooleanKind:
			return fmt.Sprintf("%s := strconv.FormatBool(%s)", target, name)
		case design.NumberKind:
			return fmt.Sprintf("%s := strconv.FormatFloat(%s, 'f', -1, 64)", target, name)
		case design.StringKind:
			return fmt.Sprintf("%s := %s", target, name)
		case design.DateTimeKind:
			return fmt.Sprintf("%s := %s.Format(time.RFC3339)", target, strings.Replace(name, "*", "", -1)) // remove pointer if present
		case design.UUIDKind:
			return fmt.Sprintf("%s := %s.String()", target, strings.Replace(name, "*", "", -1)) // remove pointer if present
		case design.AnyKind:
			return fmt.Sprintf("%s := fmt.Sprintf(\"%%v\", %s)", target, name)
		case design.FileKind:
			return fmt.Sprintf("%s := fmt.Sprintf(\"%%v\", %s)", target, name)
		default:
			panic("unknown primitive type")
		}
	case *design.Array:
		data := map[string]interface{}{
			"Name":     name,
			"Target":   target,
			"ElemType": actual.ElemType,
		}
		return codegen.RunTemplate(arrayToStringTmpl, data)
	default:
		panic("cannot convert non simple type " + att.Type.Name() + " to string") // bug
	}
}
655460
func (sa samAux) String() string {
	a := Aux(sa)
	switch a.Type() {
	case 'A':
		return fmt.Sprintf("%s:%c:%c", []byte(a[:2]), a.Kind(), a.Value())
	case 'H':
		return fmt.Sprintf("%s:%c:%02x", []byte(a[:2]), a.Kind(), a.Value())
	case 'B':
		var buf bytes.Buffer
		fmt.Fprintf(&buf, "%s:%c:%c", []byte(a[:2]), a.Kind(), a[3])
		rv := reflect.ValueOf(a.Value())
		for i := 0; i < rv.Len(); i++ {
			fmt.Fprintf(&buf, ",%v", rv.Index(i).Interface())
		}
		return buf.String()
	}
	return fmt.Sprintf("%s:%c:%v", []byte(a[:2]), a.Kind(), a.Value())
}
69330
func (af *aggFunction) String() string {
	result := af.name + "("
	for i, arg := range af.Args {
		result += arg.String()
		if i+1 != len(af.Args) {
			result += ", "
		}
	}
	result += ")"
	return result
}
1078659
func (ag *ArgSet) ArgString() string {
	args := make([]string, len(ag.set))
	for i, arg := range ag.set {
		args[i] = arg.ArgString()
	}
	return strings.Join(args, " ")
}