本文整理汇总了Golang中container/vector.StringVector类的典型用法代码示例。如果您正苦于以下问题:Golang StringVector类的具体用法?Golang StringVector怎么用?Golang StringVector使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了StringVector类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: iterFiles
//loops through root and subfolders to locate files with
//extensions specified in settings file
func (this *Settings) iterFiles(f string, pages *vector.StringVector) (err os.Error) {
file, err := os.OpenFile(f, os.O_RDONLY, 0666)
if err != nil {
println(err.String())
return
}
stat, er := file.Stat()
if er != nil {
err = er
return
}
if stat.IsDirectory() {
fmt.Println("iterFiles55555")
dirs, err := file.Readdir(-1)
if err != nil {
return
}
for _, d := range dirs {
this.iterFiles(path.Join(file.Name(), d.Name), pages)
}
} else {
if hasExt(file.Name(), this.Data["extensions"]) {
err = generate(file.Name())
fmt.Println("iterFiles_eekkkk")
if err != nil {
return
}
pages.Push(file.Name())
}
file.Close()
}
return
}
示例2: outputDot
func (p *Trie) outputDot(vec *vector.StringVector, rune int, serial int64, rgen *rand.Rand) {
this := make([]byte, 10)
child := make([]byte, 10)
utf8.EncodeRune(this, rune)
thisChar := string(this[0])
if serial == -1 {
thisChar = "root"
}
for childRune, childNode := range p.children {
utf8.EncodeRune(child, childRune)
childSerial := rgen.Int63()
childNodeStr := fmt.Sprintf("\"%s(%d)\"", string(child[0]), childSerial)
var notation string
if string(child[0]) == "/" {
notation = fmt.Sprintf("[label=\"%s\" shape=box color=red]", string(child[0]))
} else {
notation = fmt.Sprintf("[label=\"%s\"]", string(child[0]))
}
vec.Push(fmt.Sprintf("\t%s %s\n\t\"%s(%d)\" -> \"%s(%d)\"", childNodeStr, notation, thisChar, serial, string(child[0]), childSerial))
childNode.outputDot(vec, childRune, childSerial, rgen)
}
}
示例3: ReadDotLines
// ReadDotLines reads a dot-encoding and returns a slice
// containing the decoded lines, with the final \r\n or \n elided from each.
//
// See the documentation for the DotReader method for details about dot-encoding.
func (r *Reader) ReadDotLines() ([]string, os.Error) {
// We could use ReadDotBytes and then Split it,
// but reading a line at a time avoids needing a
// large contiguous block of memory and is simpler.
var v vector.StringVector
var err os.Error
for {
var line string
line, err = r.ReadLine()
if err != nil {
if err == os.EOF {
err = io.ErrUnexpectedEOF
}
break
}
// Dot by itself marks end; otherwise cut one dot.
if len(line) > 0 && line[0] == '.' {
if len(line) == 1 {
break
}
line = line[1:]
}
v.Push(line)
}
return v, err
}
示例4: signatureBase
func signatureBase(httpMethod string, base_uri string, params map[string]string) string {
var buf bytes.Buffer
buf.WriteString(httpMethod)
buf.WriteString("&")
buf.WriteString(URLEscape(base_uri))
buf.WriteString("&")
var keys vector.StringVector
for k, _ := range params {
keys.Push(k)
}
sort.SortStrings(keys)
for i, k := range keys {
v := params[k]
buf.WriteString(URLEscape(k))
buf.WriteString("%3D")
buf.WriteString(URLEscape(v))
//don't include the dangling %26
if i < len(params)-1 {
buf.WriteString("%26")
}
i++
}
return buf.String()
}
示例5: importConnections
func (p *Pipeline) importConnections(client oauth2_client.OAuth2Client, ds DataStoreService, cs ContactsService, dsocialUserId string, allowAdd, allowDelete, allowUpdate bool, groupMappings map[string]*list.List, contactChangesetIds *vector.StringVector) (err os.Error) {
checkGroupsInContacts := cs.ContactInfoIncludesGroups()
var nextToken NextToken = "blah"
for connections, useNextToken, err := cs.RetrieveConnections(client, ds, dsocialUserId, nil); (len(connections) > 0 && nextToken != nil) || err != nil; connections, useNextToken, err = cs.RetrieveConnections(client, ds, dsocialUserId, nextToken) {
if err != nil {
break
}
for _, connection := range connections {
contact, err := cs.RetrieveContact(client, ds, dsocialUserId, connection.ExternalContactId)
if err != nil {
break
}
finalContact, changesetId, err := p.contactImport(cs, ds, dsocialUserId, contact, allowAdd, allowDelete, allowUpdate)
if changesetId != "" {
contactChangesetIds.Push(changesetId)
}
if checkGroupsInContacts && finalContact != nil && finalContact != nil && finalContact.GroupReferences != nil && len(finalContact.GroupReferences) > 0 {
p.addContactToGroupMappings(groupMappings, finalContact)
}
if err != nil {
break
}
}
nextToken = useNextToken
if err != nil {
break
}
}
return
}
示例6: intLogc
// Send a closure log message internally
func (log *Logger) intLogc(level int, closure func() string) {
// Create a vector long enough to not require resizing
var logto vector.StringVector
logto.Resize(0, len(log.filterLevels))
// Determine if any logging will be done
for filt := range log.filterLevels {
if level >= log.filterLevels[filt] {
logto.Push(filt)
}
}
// Only log if a filter requires it
if len(logto) > 0 {
// Determine caller func
pc, _, lineno, ok := runtime.Caller(2)
src := ""
if ok {
src = fmt.Sprintf("%s:%d", runtime.FuncForPC(pc).Name(), lineno)
}
// Make the log record from the closure's return
rec := newLogRecord(level, src, closure())
// Dispatch the logs
for _, filt := range logto {
log.filterLogWriters[filt].LogWrite(rec)
}
}
}
示例7: Log
// Send a log message manually
func (log *Logger) Log(level int, source, message string) {
// Create a vector long enough to not require resizing
var logto vector.StringVector
logto.Resize(0, len(log.filterLevels))
// Determine if any logging will be done
for filt := range log.filterLevels {
if level >= log.filterLevels[filt] {
logto.Push(filt)
}
}
// Only log if a filter requires it
if len(logto) > 0 {
// Make the log record
rec := newLogRecord(level, source, message)
// Dispatch the logs
for _, filt := range logto {
lw := log.filterLogWriters[filt]
if lw.Good() {
lw.LogWrite(rec)
}
}
}
}
示例8: parseParamsInUnquotedSubstring
func parseParamsInUnquotedSubstring(s string, name2value map[string]string) (lastKeyword string) {
var words vector.StringVector
for {
index := strings.IndexAny(s, "= \n\r\t")
if index == -1 {
break
}
word := s[:index]
if word != "" {
words.Push(word)
}
s = s[index+1:]
}
if len(s) > 0 {
words.Push(s)
}
for i := 0; i < len(words)-1; i += 2 {
name2value[words[i]] = words[i+1]
}
if len(words) > 0 && len(words)%2 == 1 {
lastKeyword = words[len(words)-1]
}
return
}
示例9: prepare
// Reordering, compressing, optimization.
func prepare(ops []op) string {
var cmds vector.StringVector
for _, o := range ops {
cmds.Push(o.cmd)
}
return strings.Join([]string(cmds), "")
}
示例10: getSorted
func getSorted(set *StringSet) []string {
var sorted vector.StringVector
for val := range set.Iter() {
sorted.Push(val)
}
sort.SortStrings(sorted)
return sorted.Data()
}
示例11: BenchmarkMGet
func BenchmarkMGet(b *testing.B) {
client.Set("bmg", []byte("hi"))
var vals vector.StringVector
for i := 0; i < b.N; i++ {
vals.Push("bmg")
}
client.Mget(vals...)
client.Del("bmg")
}
示例12: Matches
func (self *Regex) Matches(s string) []string {
res := new(vector.StringVector)
self.l.StartString(s)
for !self.l.Eof() {
if self.l.Next() == 0 {
res.Push(self.l.String())
}
}
return res.Data()
}
示例13: resultsJson
func resultsJson(results chan string) []byte {
var ids vector.StringVector
for id := range results {
ids.Push(id)
}
raw, _ := json.Marshal(map[string]interface{}{
"results": ids,
})
return raw
}
示例14: removeEmptyStrings
func removeEmptyStrings(arr []string) []string {
sv := new(vector.StringVector)
sv.Resize(0, len(arr))
for _, s := range arr {
if s != "" {
sv.Push(s)
}
}
return *sv
}
示例15: variances
func (p *wmDecisionCore) variances() []string {
var v vector.StringVector
var ctp []MediaTypeHandler
var ep []EncodingHandler
var cp []CharsetHandler
arr := make([]string, 1)
arr[0] = "*"
ctp, p.req, p.cxt, _, _ = p.handler.ContentTypesProvided(p.req, p.cxt)
ep, p.req, p.cxt, _, _ = p.handler.EncodingsProvided(arr, p.req, p.cxt)
cp, p.req, p.cxt, _, _ = p.handler.CharsetsProvided(arr, p.req, p.cxt)
if len(ctp) > 1 {
v.Push("Accept")
}
if len(ep) > 1 {
v.Push("Accept-Encoding")
}
if len(cp) > 1 {
v.Push("Accept-Charset")
}
var headers []string
headers, p.req, p.cxt, _, _ = p.handler.Variances(p.req, p.cxt)
v2 := vector.StringVector(headers)
v.AppendVector(&v2)
return v
}