keyfile

package
v0.0.0-...-0caaa62 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 1, 2017 License: GPL-3.0-or-later Imports: 3 Imported by: 0

Documentation

Overview

Package keyfile provides Go bindings for GLib's GKeyFile.

Index

Constants

View Source
const (
	DesktopGroup             = "Desktop Entry"
	DesktopKeyCategories     = "Categories"
	DesktopKeyComment        = "Comment"
	DesktopKeyExec           = "Exec"
	DesktopKeyFullname       = "X-GNOME-FullName"
	DesktopKeyGenericName    = "GenericName"
	DesktopKeyGettextDomain  = "X-GNOME-Gettext-Domain"
	DesktopKeyHidden         = "Hidden"
	DesktopKeyIcon           = "Icon"
	DesktopKeyKeywords       = "Keywords"
	DesktopKeyMIMEType       = "MimeType"
	DesktopKeyName           = "Name"
	DesktopKeyNotShowIn      = "NotShowIn"
	DesktopKeyNoDisplay      = "NoDisplay"
	DesktopKeyOnlyShowIn     = "OnlyShowIn"
	DesktopKeyPath           = "Path"
	DesktopKeyStartupNotify  = "StartupNotify"
	DesktopKeyStartupWmClass = "StartupWMClass"
	DesktopKeyTerminal       = "Terminal"
	DesktopKeyTryExec        = "TryExec"
	DesktopKeyType           = "Type"
	DesktopKeyURL            = "URL"
	DesktopKeyVersion        = "Version"
	DesktopTypeApplication   = "Application"
	DesktopTypeDirectory     = "Directory"
	DesktopTypeLink          = "Link"
)

Desktop files entries.

Variables

This section is empty.

Functions

This section is empty.

Types

type Error

type Error C.gint

Error is a representation of GLib's KeyFileError.

const (
	ErrorUnknownEncoding Error = 0
	ErrorParse           Error = 1
	ErrorNotFound        Error = 2
	ErrorKeyNotFound     Error = 3
	ErrorGroupNotFound   Error = 4
	ErrorInvalidValue    Error = 5
)

Error type list.

type Flags

type Flags C.gint

Flags is a representation of GLib's KeyFileFlags.

const (
	FlagsNone             Flags = 0
	FlagsKeepComments     Flags = 1
	FlagsKeepTranslations Flags = 2
)

Keyfile loading flags.

type KeyFile

type KeyFile struct {
	// contains filtered or unexported fields
}

KeyFile is a representation of Glib's GKeyFile.

func New

func New() *KeyFile

New is a wrapper around g_key_file_new().

func NewFromFile

func NewFromFile(file string, flags Flags) (*KeyFile, error)

NewFromFile returns a loaded keyfile if possible.

func NewFromNative

func NewFromNative(p unsafe.Pointer) *KeyFile

NewFromNative wraps a pointer to a C keyfile.

func (*KeyFile) Bool

func (kf *KeyFile) Bool(group string, key string) (bool, error)

Bool is a wrapper around g_key_file_get_boolean().

func (*KeyFile) Float

func (kf *KeyFile) Float(group string, key string) (float64, error)

Float is a wrapper around g_key_file_get_double().

func (*KeyFile) Free

func (kf *KeyFile) Free()

Free is a wrapper around g_key_file_free().

func (*KeyFile) Get

func (kf *KeyFile) Get(group string, key string, val interface{}) error

Get gets a value from the keyfile. Must be used with a pointer to value.

func (*KeyFile) GetComment

func (kf *KeyFile) GetComment(group string, key string) (string, error)

GetComment is a wrapper around g_key_file_get_comment().

func (*KeyFile) GetGroups

func (kf *KeyFile) GetGroups() (uint64, []string)

GetGroups is a wrapper around g_key_file_get_groups().

func (*KeyFile) GetKeys

func (kf *KeyFile) GetKeys(group string) (uint64, []string, error)

GetKeys is a wrapper around g_key_file_get_keys().

func (*KeyFile) GetOne

func (kf *KeyFile) GetOne(group string, key string, typ string) (interface{}, error)

GetOne returns a key value as interface.

valid types are:

bool, int, float64, string, comment
listbool, listint, listfloat64, liststring,

func (*KeyFile) HasKey

func (kf *KeyFile) HasKey(group string, key string) bool

HasKey is a wrapper around g_key_file_has_key().

func (*KeyFile) Int

func (kf *KeyFile) Int(group string, key string) (int, error)

Int is a wrapper around g_key_file_get_integer().

func (*KeyFile) ListBool

func (kf *KeyFile) ListBool(group string, key string) ([]bool, error)

ListBool is a wrapper around g_key_file_get_boolean_list().

func (*KeyFile) ListFloat

func (kf *KeyFile) ListFloat(group string, key string) ([]float64, error)

ListFloat is a wrapper around g_key_file_get_double_list().

func (*KeyFile) ListInt

func (kf *KeyFile) ListInt(group string, key string) ([]int, error)

ListInt is a wrapper around g_key_file_get_integer_list().

func (*KeyFile) ListString

func (kf *KeyFile) ListString(group string, key string) ([]string, error)

ListString is a wrapper around g_key_file_get_string_list().

func (*KeyFile) LoadFromFile

func (kf *KeyFile) LoadFromFile(file string, flags Flags) (bool, error)

LoadFromFile is a wrapper around g_key_file_load_from_file().

func (*KeyFile) Set

func (kf *KeyFile) Set(group string, key string, uncasted interface{}) error

Set is a generic wrapper around g_key_file_set_xxx() with type assertion.

func (*KeyFile) SetBool

func (kf *KeyFile) SetBool(group string, key string, value bool)

SetBool is a wrapper around g_key_file_set_boolean().

func (*KeyFile) SetFloat

func (kf *KeyFile) SetFloat(group string, key string, value float64)

SetFloat is a wrapper around g_key_file_set_double().

func (*KeyFile) SetInt

func (kf *KeyFile) SetInt(group string, key string, value int)

SetInt is a wrapper around g_key_file_set_integer().

func (*KeyFile) SetListBool

func (kf *KeyFile) SetListBool(group string, key string, value []bool)

SetListBool is a wrapper around g_key_file_set_boolean_list().

func (*KeyFile) SetListFloat

func (kf *KeyFile) SetListFloat(group string, key string, value []float64)

SetListFloat is a wrapper around g_key_file_set_double_list().

func (*KeyFile) SetListInt

func (kf *KeyFile) SetListInt(group string, key string, value []int)

SetListInt is a wrapper around g_key_file_set_integer_list().

func (*KeyFile) SetListString

func (kf *KeyFile) SetListString(group string, key string, value []string)

SetListString is a wrapper around g_key_file_set_string_list().

func (*KeyFile) SetString

func (kf *KeyFile) SetString(group string, key string, value string)

SetString is a wrapper around g_key_file_set_string().

func (*KeyFile) String

func (kf *KeyFile) String(group string, key string) (string, error)

String is a wrapper around g_key_file_get_string().

func (*KeyFile) ToData

func (kf *KeyFile) ToData() (uint64, string, error)

ToData is a wrapper around g_key_file_to_data().

func (*KeyFile) ToNative

func (kf *KeyFile) ToNative() *C.GKeyFile

ToNative returns the pointer to the underlying GKeyFile.

type Valuer

type Valuer struct {
	// contains filtered or unexported fields
}

Valuer gives access to a storage group/key value. Implements cftype.Valuer

func NewValuer

func NewValuer(kf *KeyFile, group, name string) *Valuer

NewValuer creates a valuer for the key matching group and name.

func (*Valuer) Bool

func (o *Valuer) Bool() (v bool)

Bool returns the value as bool.

func (*Valuer) Count

func (o *Valuer) Count() int

Count returns the number of elements in the list.

func (*Valuer) Float

func (o *Valuer) Float() (v float64)

Float returns the value as bool.

func (*Valuer) Get

func (o *Valuer) Get(v interface{})

Get assigns the value to the given pointer to value (of the matching type).

func (*Valuer) Int

func (o *Valuer) Int() (v int)

Int returns the value as bool.

func (*Valuer) ListBool

func (o *Valuer) ListBool() (v []bool)

ListBool returns the value as bool.

func (*Valuer) ListFloat

func (o *Valuer) ListFloat() (v []float64)

ListFloat returns the value as bool.

func (*Valuer) ListInt

func (o *Valuer) ListInt() (v []int)

ListInt returns the value as bool.

func (*Valuer) ListString

func (o *Valuer) ListString() (v []string)

ListString returns the value as bool.

func (*Valuer) Set

func (o *Valuer) Set(v interface{})

Set sets the pointed keyfile key value.

func (*Valuer) Sprint

func (o *Valuer) Sprint() string

Sprint returns the value as printable text.

func (*Valuer) SprintI

func (o *Valuer) SprintI(id int) string

SprintI returns the value as printable text of the element at position I in the list if possible.

func (*Valuer) String

func (o *Valuer) String() (v string)

String returns the value as bool.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL