// AddNewStringRule adds a new stringRule with the specified args to the stringRules map.
// The required arguments are ns([]string), key(string), req(bool)
// and optionally:
//		plugin.SetDefaultString(string)
14586
func (c *ConfigPolicy) AddNewStringRule(ns []string, key string, req bool, opts ...stringRuleOpt) error {
	if key == "" {
		return ErrEmptyKey
	}
	rule := &rpc.StringRule{
		Required: req,
	}

	for _, opt := range opts {
		opt(rule)
	}
	k := strings.Join(ns, ".") // Method used in daemon/ctree
	if c.stringRules[k] == nil {
		c.stringRules[k] = &rpc.StringPolicy{
			Rules: map[string]*rpc.StringRule{},
			Key:   ns,
		}
	}
	c.stringRules[k].Rules[key] = rule
	return nil
}
1005435
func NewStringFlag(fl cli.StringFlag) *StringFlag {
	return &StringFlag{StringFlag: fl, set: nil}
}
751492
func AddStringFuncs(f map[string]interface{}) {
	f["strings"] = StrNS

	f["replaceAll"] = StrNS().ReplaceAll
	f["title"] = StrNS().Title
	f["toUpper"] = StrNS().ToUpper
	f["toLower"] = StrNS().ToLower
	f["trimSpace"] = StrNS().TrimSpace
	f["indent"] = StrNS().Indent
	f["quote"] = StrNS().Quote
	f["squote"] = StrNS().Squote

	// these are legacy aliases with non-pipelinable arg order
	f["contains"] = strings.Contains
	f["hasPrefix"] = strings.HasPrefix
	f["hasSuffix"] = strings.HasSuffix
	f["split"] = strings.Split
	f["splitN"] = strings.SplitN
	f["trim"] = strings.Trim
}
244344
func NewString(value string) (DataType, error) {
	returnValue := new(String)
	returnValue.value = value
	return returnValue, nil
}
431324
func NewStringSimple(s string) StringAttribute {
	result := &StringSimple{
		NewAttribute(NORMAL, nil, nil),
	}
	result.Set(s)
	return result
}
682476
func NewRule(resource string, verbs []string) Rule {
	return Rule{
		Resources: []string{resource},
		Verbs:     verbs,
	}
}
1333965
func NewStringTypeParser(setter SetStringFunc) *StringTypeParser {
	parser := new(StringTypeParser)
	parser.setter = setter
	return parser
}
1174062
func NewValueString(v string) Value {
	return Value{
		typ:     TBinary,
		tbinary: unsafeStringToBytes(v),
	}
}
1261473
func (f *BloomFilter) AddString(data string) *BloomFilter {
	return f.Add([]byte(data))
}
912584
func NewString(str string) *String {
	s := &String{}
	if str != "" {
		s.Store(str)
	}
	return s
}
1246688
func NewBoolRule(key string, req bool, opts ...bool) (*BoolRule, error) {
	// Return error if key is empty
	if key == "" {
		return nil, EmptyKeyError
	}

	b := &BoolRule{
		key:      key,
		required: req,
	}
	if len(opts) != 0 {
		b.default_ = &opts[0]
	}
	return b, nil
}
165768
func (f *ScmpFilter) AddRule(call ScmpSyscall, action ScmpAction) error {
	return f.addRuleGeneric(call, action, false, nil)
}
584293
func (rank *Rank) AddNewWord(word string, prevWordIdx int, sentenceID int) (wordID int) {
	wordID = len(rank.Words)
	connectionLeft := make(map[int]int)

	if prevWordIdx >= 0 {
		connectionLeft[prevWordIdx] = 1
	}

	newWord := &Word{
		ID:              wordID,
		SentenceIDs:     []int{sentenceID},
		ConnectionLeft:  connectionLeft,
		ConnectionRight: make(map[int]int),
		Token:           word,
		Qty:             1,
		Weight:          0,
	}

	rank.Words[wordID] = newWord
	rank.WordValID[word] = wordID

	return
}
874529
func (v *StringRule) Error(message string) *StringRule {
	return NewStringRule(v.validate, message)
}
401064
func (c *ConfigPolicy) AddNewBoolRule(ns []string, key string, req bool, opts ...boolRuleOpt) error {
	if key == "" {
		return ErrEmptyKey
	}
	rule := &rpc.BoolRule{
		Required: req,
	}

	for _, opt := range opts {
		opt(rule)
	}
	k := strings.Join(ns, ".") // Method used in daemon/ctree
	if c.boolRules[k] == nil {
		c.boolRules[k] = &rpc.BoolPolicy{
			Rules: map[string]*rpc.BoolRule{},
			Key:   ns,
		}
	}
	c.boolRules[k].Rules[key] = rule
	return nil
}
980649
func NewAddRuleArgs(styleSheetID StyleSheetID, ruleText string, location SourceRange) *AddRuleArgs {
	args := new(AddRuleArgs)
	args.StyleSheetID = styleSheetID
	args.RuleText = ruleText
	args.Location = location
	return args
}
446622
func NewString(vals ...V) StringA {
	a := &arg{}

	d := Default.Get(vals)
	a.defv = d

	f := A(flagA).Get(vals)
	if f != nil {
		f := f.(flagT)
		a.defv = flag.String(f.name, f.defv.(string), f.usage)
	}

	as := a.getA()
	return func(s string) V {
		return as(s)
	}
}