本文整理匯總了Golang中github.com/quarnster/completion/content.Field.Flags方法的典型用法代碼示例。如果您正苦於以下問題:Golang Field.Flags方法的具體用法?Golang Field.Flags怎麽用?Golang Field.Flags使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/quarnster/completion/content.Field
的用法示例。
在下文中一共展示了Field.Flags方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: Fields
func (td *TypeDef) Fields() (fields []content.Field, err error) {
if td.ct.Name.Relative != "" {
return td.ct.Fields, nil
}
var (
mu = td.index.(*ConcreteTableIndex).metadataUtil
startRow, endRow = td.ListRange(td.index.Index(), id_TypeDef, id_Field, func(i interface{}) uint32 { return i.(*TypeDefRow).FieldList.Index() })
idx = ConcreteTableIndex{mu, startRow, id_Field}
)
cn := stripProto(td.Name().Absolute)
for i := startRow; i < endRow; i++ {
idx.index = i
if rawfield, err := idx.Data(); err != nil {
return nil, err
} else {
var (
field = rawfield.(*FieldRow)
f content.Field
dec *SignatureDecoder
sig FieldSig
)
f.Name.Relative = string(field.Name)
f.Name.Absolute = fmt.Sprintf("net://field/%s;%d", cn, i-startRow)
if dec, err = NewSignatureDecoder(field.Signature); err != nil {
return nil, err
} else if err = dec.Decode(&sig); err != nil {
return nil, err
} else {
f.Type = td.initContentType(td.index, &sig.Type)
}
if field.Flags&FieldAttributes_Static != 0 {
f.Flags |= content.FLAG_STATIC
}
if field.Flags&FieldAttributes_Public != 0 {
f.Flags |= content.FLAG_ACC_PUBLIC
} else if field.Flags&FieldAttributes_Private != 0 {
f.Flags |= content.FLAG_ACC_PRIVATE
} else if field.Flags&FieldAttributes_Family != 0 {
f.Flags |= content.FLAG_ACC_PROTECTED
}
if err := check(&f, f.Name); err != nil {
log4go.Fine("Skipping field: %s, %+v, %+v", err, f, field)
continue
}
fields = append(fields, f)
}
}
return fields, nil
}
示例2: toContentField
func (d *DWARFHelper) toContentField(e *dwarf.Entry) (content.Field, error) {
var f content.Field
if v, ok := e.Val(dwarf.AttrName).(string); ok {
f.Name.Relative = v
}
if v, ok := e.Val(dwarf.AttrType).(dwarf.Offset); ok {
if t, err := d.GetType(v); err != nil {
return f, err
} else {
f.Type = t
}
}
f.Flags = d.Flags(e)
return f, nil
}