• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Golang vector.StringVector类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Golang中container/vector.StringVector的典型用法代码示例。如果您正苦于以下问题:Golang StringVector类的具体用法?Golang StringVector怎么用?Golang StringVector使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了StringVector类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
}
开发者ID:santinopnipa,项目名称:SUT_gopages,代码行数:35,代码来源:util.go


示例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)
	}
}
开发者ID:alangenfeld,项目名称:cs639,代码行数:27,代码来源:trie.go


示例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
}
开发者ID:IntegerCompany,项目名称:linaro-android-gcc,代码行数:31,代码来源:reader.go


示例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()
}
开发者ID:gmarik,项目名称:twitterstream,代码行数:27,代码来源:oauth.go


示例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
}
开发者ID:pombredanne,项目名称:dsocial.go,代码行数:30,代码来源:pipeline.go


示例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)
		}
	}
}
开发者ID:Kissaki,项目名称:log4go,代码行数:31,代码来源:log4go.go


示例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)
			}
		}
	}
}
开发者ID:Kissaki,项目名称:log4go,代码行数:27,代码来源:log4go.go


示例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
}
开发者ID:lalitjsraks,项目名称:go-pgsql,代码行数:29,代码来源:conn.go


示例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), "")
}
开发者ID:schmichael,项目名称:beanstalk.go,代码行数:9,代码来源:beanstalk.go


示例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()
}
开发者ID:jacobsa,项目名称:igo,代码行数:9,代码来源:set_test.go


示例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")
}
开发者ID:rjmcguire,项目名称:redis.go,代码行数:9,代码来源:redis_test.go


示例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()
}
开发者ID:ypb,项目名称:bwl,代码行数:10,代码来源:regex.go


示例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
}
开发者ID:darkhelmet,项目名称:fetch,代码行数:10,代码来源:web.go


示例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
}
开发者ID:pombredanne,项目名称:dsocial.go,代码行数:10,代码来源:util.go


示例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
}
开发者ID:pombredanne,项目名称:webmachine.go,代码行数:25,代码来源:decision.go


示例16: UrlEncode

// Naive utility url encode method.  Converts a string map into a query string
//
// Returns a string in the format "?param1=value1&param2=value2"
func UrlEncode(urlmap map[string]string) string {
	url := "?"
	var temp vector.StringVector
	var key, value string

	for key, value = range urlmap {
		temp.Push(key + "=" + value)
	}
	url += strings.Join(temp, "&")
	return url
}
开发者ID:elimisteve,项目名称:GoFluidDB,代码行数:14,代码来源:fluiddb.go


示例17: filter

func filter(v *vector.StringVector, f func(string) bool) *vector.StringVector {

	r := new(vector.StringVector)

	for _, s := range *v {
		if f(s) {
			r.Push(s)
		}
	}

	return r
}
开发者ID:jmettraux,项目名称:glaive,代码行数:12,代码来源:main.go


示例18: Hmset

func (client *Client) Hmset(key string, mapping interface{}) os.Error {
	args := new(vector.StringVector)
	args.Push(key)
	err := containerToString(reflect.ValueOf(mapping), args)
	if err != nil {
		return err
	}
	_, err = client.sendCommand("HMSET", *args...)
	if err != nil {
		return err
	}
	return nil
}
开发者ID:alangenfeld,项目名称:flock,代码行数:13,代码来源:redis.go


示例19: SearchAndFetch

func (connection *Connection) SearchAndFetch(query string) (*vector.StringVector, os.Error) {
	ids, err := connection.Search(query)
	if err != nil {
		return nil, err
	}

	var result vector.StringVector
	for _, id := range *ids {
		result.Push(connection.Fetch(id))
	}

	return &result, nil
}
开发者ID:patrickxb,项目名称:godystopia,代码行数:13,代码来源:dystopia.go


示例20: expectContentsEqual

func expectContentsEqual(t *testing.T, set *set.StringSet, expected []string) {
	var contents vector.StringVector
	for val := range set.Iter() {
		contents.Push(val)
	}

	sort.SortStrings(contents)
	sort.SortStrings(expected)

	if !reflect.DeepEqual(contents.Data(), expected) {
		t.Errorf("Expected:%v\nGot: %v", expected, contents)
	}
}
开发者ID:jacobsa,项目名称:igo,代码行数:13,代码来源:parse_test.go



注:本文中的container/vector.StringVector类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Golang vector.Vector类代码示例发布时间:2022-05-24
下一篇:
Golang vector.IntVector类代码示例发布时间:2022-05-24
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap