forked from ying32/govcl
-
Notifications
You must be signed in to change notification settings - Fork 0
/
stringlistdef.go
47 lines (41 loc) · 1 KB
/
stringlistdef.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
//----------------------------------------
//
// Copyright © ying32. All Rights Reserved.
//
// Licensed under Apache License 2.0
//
//----------------------------------------
package vcl
func (s *TStringList) AddStrings(list IStrings) {
s.AddStrings3(list, false)
}
func (s *TStringList) AddStrings2(sArr []string) {
s.BeginUpdate()
defer s.EndUpdate()
for _, v := range sArr {
s.Add(v)
}
}
func (s *TStringList) AddStrings3(list IStrings, clearFirst bool) {
if list == nil {
return
}
s.BeginUpdate()
defer s.EndUpdate()
if clearFirst {
s.Clear()
}
if s.Count()+list.Count() > s.Capacity() {
s.SetCapacity(s.Count() + list.Count())
for i := int32(0); i < list.Count(); i++ {
s.AddObject(list.S(i), list.Objects(i))
}
}
}
func (s *TStringList) AddPair(name, value string) *TStrings {
return s.AddPair2(name, value, nil)
}
func (s *TStringList) AddPair2(name, value string, object IObject) *TStrings {
s.AddObject(name+string(s.NameValueSeparator())+value, object)
return AsStrings(s)
}