## IAnjutaSymbol

IAnjutaSymbol — Source code symbol interface

## Stability Level

Unstable, unless otherwise indicated

## Synopsis

    #include <libanjuta/interfaces/ianjuta-symbol.h>

    #define             IANJUTA_TYPE_SYMBOL_FIELD
    #define             IANJUTA_TYPE_SYMBOL_TYPE
    #define             IANJUTA_SYMBOL_ERROR
                        IAnjutaSymbol;
                        IAnjutaSymbolIface;
    enum                IAnjutaSymbolField;
    enum                IAnjutaSymbolType;
    GType               ianjuta_symbol_type_get_type        (void);
    GQuark              ianjuta_symbol_error_quark          (void);
    GType               ianjuta_symbol_get_type             (void);
    const gchar *       ianjuta_symbol_get_args             (IAnjutaSymbol *obj,
                                                             GError **err);
    const gchar *       ianjuta_symbol_get_extra_info_string
                                                            (IAnjutaSymbol *obj,
                                                             IAnjutaSymbolField sym_info,
                                                             GError **err);
    GFile *             ianjuta_symbol_get_file             (IAnjutaSymbol *obj,
                                                             GError **err);
    const GdkPixbuf *   ianjuta_symbol_get_icon             (IAnjutaSymbol *obj,
                                                             GError **err);
    gint                ianjuta_symbol_get_id               (IAnjutaSymbol *obj,
                                                             GError **err);
    gulong              ianjuta_symbol_get_line             (IAnjutaSymbol *obj,
                                                             GError **err);
    const gchar *       ianjuta_symbol_get_name             (IAnjutaSymbol *obj,
                                                             GError **err);
    IAnjutaSymbolType   ianjuta_symbol_get_sym_type         (IAnjutaSymbol *obj,
                                                             GError **err);
    gboolean            ianjuta_symbol_is_local             (IAnjutaSymbol *obj,
                                                             GError **err);

## Object Hierarchy

      GInterface
       +----IAnjutaSymbol

## Prerequisites

IAnjutaSymbol requires GObject.

## Description

## Details

### IANJUTA_TYPE_SYMBOL_FIELD

    #define IANJUTA_TYPE_SYMBOL_FIELD (ianjuta_symbol_field_get_type())

### IANJUTA_TYPE_SYMBOL_TYPE

    #define IANJUTA_TYPE_SYMBOL_TYPE (ianjuta_symbol_type_get_type())

### IANJUTA_SYMBOL_ERROR

    #define IANJUTA_SYMBOL_ERROR ianjuta_symbol_error_quark()

### IAnjutaSymbol

    typedef struct _IAnjutaSymbol IAnjutaSymbol;

### IAnjutaSymbolIface

    typedef struct {
    	GTypeInterface g_iface;

    	const gchar * (*get_args) (IAnjutaSymbol *obj, GError **err);
    	const gchar * (*get_extra_info_string) (IAnjutaSymbol *obj, IAnjutaSymbolField sym_info, GError **err);
    	GFile * (*get_file) (IAnjutaSymbol *obj, GError **err);
    	const GdkPixbuf * (*get_icon) (IAnjutaSymbol *obj, GError **err);
    	gint (*get_id) (IAnjutaSymbol *obj, GError **err);
    	gulong (*get_line) (IAnjutaSymbol *obj, GError **err);
    	const gchar * (*get_name) (IAnjutaSymbol *obj, GError **err);
    	const gchar * (*get_returntype) (IAnjutaSymbol *obj, GError **err);
    	IAnjutaSymbolType (*get_sym_type) (IAnjutaSymbol *obj, GError **err);
    	gboolean (*is_local) (IAnjutaSymbol *obj, GError **err);
    } IAnjutaSymbolIface;

### enum IAnjutaSymbolField

    typedef enum {
    	IANJUTA_SYMBOL_FIELD_SIMPLE = 1,
    	IANJUTA_SYMBOL_FIELD_FILE_PATH = 2,
    	IANJUTA_SYMBOL_FIELD_IMPLEMENTATION = 4,
    	IANJUTA_SYMBOL_FIELD_ACCESS = 8,
    	IANJUTA_SYMBOL_FIELD_KIND = 16,
    	IANJUTA_SYMBOL_FIELD_TYPE = 32,
    	IANJUTA_SYMBOL_FIELD_TYPE_NAME = 64,
    	IANJUTA_SYMBOL_FIELD_LANGUAGE = 128,
    	IANJUTA_SYMBOL_FIELD_FILE_IGNORE = 256,
    	IANJUTA_SYMBOL_FIELD_FILE_INCLUDE = 512,
    	IANJUTA_SYMBOL_FIELD_PROJECT_NAME = 1024,
    	IANJUTA_SYMBOL_FIELD_WORKSPACE_NAME = 2048
    } IAnjutaSymbolField;

`IANJUTA_SYMBOL_FIELD_SIMPLE`: With this field you will have name, line of declaration, is_file_scope and signature of the symbol. `IANJUTA_SYMBOL_FIELD_FILE_PATH`: The path to the file. It's obtained using something like g_strconcat ("/home/user/project_dir/", "src/db/realative/path/file.c"); `IANJUTA_SYMBOL_FIELD_IMPLEMENTATION`: implementation attribute of a symbol. It may be "pure virtual", "virtual", etc. `IANJUTA_SYMBOL_FIELD_ACCESS`: access attribute of a symbol. It may be "public", "private" etc. `IANJUTA_SYMBOL_FIELD_KIND`: kind attribute of a symbol. "enumerator", "namespace", "class" are some examples. `IANJUTA_SYMBOL_FIELD_TYPE`: type attribute of a symbol. Use this field in conjunction with IANJUTA_SYMBOL_FIELD_TYPE_NAME as the query would retrieve both attributes in a quicker way. `IANJUTA_SYMBOL_FIELD_TYPE_NAME`: type_name attribute of a symbol. If a type could be "class" then its type_name may be "MyFooClass" etc. `IANJUTA_SYMBOL_FIELD_LANGUAGE`: the language of the symbol, e.g. "C", "Java", etc. `IANJUTA_SYMBOL_FIELD_FILE_IGNORE`: field mainly ignored. `IANJUTA_SYMBOL_FIELD_FILE_INCLUDE`: field mainly ignored. `IANJUTA_SYMBOL_FIELD_PROJECT_NAME`: the project this symbol belongs to. `IANJUTA_SYMBOL_FIELD_WORKSPACE_NAME`: the workspace this symbol belongs to.

### enum IAnjutaSymbolType

    typedef enum {
    	IANJUTA_SYMBOL_TYPE_UNDEF = 1,
    	IANJUTA_SYMBOL_TYPE_CLASS = 2,
    	IANJUTA_SYMBOL_TYPE_ENUM = 4,
    	IANJUTA_SYMBOL_TYPE_ENUMERATOR = 8,
    	IANJUTA_SYMBOL_TYPE_FIELD = 16,
    	IANJUTA_SYMBOL_TYPE_FUNCTION = 32,
    	IANJUTA_SYMBOL_TYPE_INTERFACE = 64,
    	IANJUTA_SYMBOL_TYPE_MEMBER = 128,
    	IANJUTA_SYMBOL_TYPE_METHOD = 256,
    	IANJUTA_SYMBOL_TYPE_NAMESPACE = 512,
    	IANJUTA_SYMBOL_TYPE_PACKAGE = 1024,
    	IANJUTA_SYMBOL_TYPE_PROTOTYPE = 2048,
    	IANJUTA_SYMBOL_TYPE_STRUCT = 4096,
    	IANJUTA_SYMBOL_TYPE_TYPEDEF = 8192,
    	IANJUTA_SYMBOL_TYPE_UNION = 16384,
    	IANJUTA_SYMBOL_TYPE_VARIABLE = 32768,
    	IANJUTA_SYMBOL_TYPE_EXTERNVAR = 65536,
    	IANJUTA_SYMBOL_TYPE_MACRO = 131072,
    	IANJUTA_SYMBOL_TYPE_MACRO_WITH_ARG = 262144,
    	IANJUTA_SYMBOL_TYPE_FILE = 524288,
    	IANJUTA_SYMBOL_TYPE_OTHER = 1048576,
    	IANJUTA_SYMBOL_TYPE_SCOPE_CONTAINER = IANJUTA_SYMBOL_TYPE_CLASS | IANJUTA_SYMBOL_TYPE_ENUM | IANJUTA_SYMBOL_TYPE_ENUMERATOR | IANJUTA_SYMBOL_TYPE_INTERFACE | IANJUTA_SYMBOL_TYPE_NAMESPACE | IANJUTA_SYMBOL_TYPE_PACKAGE | IANJUTA_SYMBOL_TYPE_STRUCT | IANJUTA_SYMBOL_TYPE_TYPEDEF | IANJUTA_SYMBOL_TYPE_UNION,
    	IANJUTA_SYMBOL_TYPE_MAX = 2097151
    } IAnjutaSymbolType;

`IANJUTA_SYMBOL_TYPE_UNDEF`: Unknown type. If you have to search for all the known types use this flag because it's quicker than IANJUTA_SYMBOL_TYPE_MAX. `IANJUTA_SYMBOL_TYPE_CLASS`: Class declaration `IANJUTA_SYMBOL_TYPE_ENUM`: Enum declaration `IANJUTA_SYMBOL_TYPE_ENUMERATOR`: Enumerator value `IANJUTA_SYMBOL_TYPE_FIELD`: Field (Java only) `IANJUTA_SYMBOL_TYPE_FUNCTION`: Function definition `IANJUTA_SYMBOL_TYPE_INTERFACE`: Interface (Java only) `IANJUTA_SYMBOL_TYPE_MEMBER`: Member variable of class/struct `IANJUTA_SYMBOL_TYPE_METHOD`: Class method (Java only) `IANJUTA_SYMBOL_TYPE_NAMESPACE`: Namespace declaration `IANJUTA_SYMBOL_TYPE_PACKAGE`: Package (Java only) `IANJUTA_SYMBOL_TYPE_PROTOTYPE`: Function prototype `IANJUTA_SYMBOL_TYPE_STRUCT`: Struct declaration `IANJUTA_SYMBOL_TYPE_TYPEDEF`: Typedef `IANJUTA_SYMBOL_TYPE_UNION`: Union `IANJUTA_SYMBOL_TYPE_VARIABLE`: Variable `IANJUTA_SYMBOL_TYPE_EXTERNVAR`: Extern or forward declaration `IANJUTA_SYMBOL_TYPE_MACRO`: Macro (without arguments) `IANJUTA_SYMBOL_TYPE_MACRO_WITH_ARG`: Parameterized macro `IANJUTA_SYMBOL_TYPE_FILE`: File (Pseudo tag) `IANJUTA_SYMBOL_TYPE_OTHER`: Other (non C/C++/Java tag) `IANJUTA_SYMBOL_TYPE_SCOPE_CONTAINER`: types which are subjected to create a scope. `IANJUTA_SYMBOL_TYPE_MAX`: Maximum value, means all known values. You can reach the same result using IANJUTA_SYMBOL_TYPE_UNDEF, which is much faster.

### ianjuta_symbol_type_get_type ()

    GType               ianjuta_symbol_type_get_type        (void);

Returns : |

### ianjuta_symbol_error_quark ()

    GQuark              ianjuta_symbol_error_quark          (void);

Returns : |

### ianjuta_symbol_get_type ()

    GType               ianjuta_symbol_get_type             (void);

Returns : |

### ianjuta_symbol_get_args ()

    const gchar *       ianjuta_symbol_get_args             (IAnjutaSymbol *obj,
                                                             GError **err);

If symbol has a kind "function" then this will return a string with the args of the function itself.

`obj` : | Self
`err` : | Error propagation and reporting.
Returns : | args as const string or NULL

### ianjuta_symbol_get_extra_info_string ()

    const gchar *       ianjuta_symbol_get_extra_info_string
                                                            (IAnjutaSymbol *obj,
                                                             IAnjutaSymbolField sym_info,
                                                             GError **err);

`err`: Error propagation and reporting.

`obj` : | Self
`sym_info` : | Just one IANJUTA_SYMBOL_FIELD_* per time. It is NOT possible to pass something like FIELD_1 | FIELD_2 | .... Note: You will not have anything passing IANJUTA_SYMBOL_FIELD_SIMPLE, just a NULL value.
`err` : |
Returns : | a string representation of the field required. For instance passing IANJUTA_SYMBOL_FIELD_FILE_PATH you'll have a const gchar* representing the absolute file path, passing IANJUTA_SYMBOL_FIELD_ACCESS the access attribute, as "public", "private", etc.

### ianjuta_symbol_get_file ()

    GFile *             ianjuta_symbol_get_file             (IAnjutaSymbol *obj,
                                                             GError **err);

`obj` : | Self
`err` : | Error propagation and reporting.
Returns : | The file where the symbol is declared in.

### ianjuta_symbol_get_icon ()

    const GdkPixbuf *   ianjuta_symbol_get_icon             (IAnjutaSymbol *obj,
                                                             GError **err);

You *need* a symbol with IANJUTA_SYMBOL_FIELD_ACCESS | IANJUTA_SYMBOL_FIELD_KIND enabled attribute. e.g. use ianjuta_symbol_manager_search passing IANJUTA_SYMBOL_FIELD_ACCESS | IANJUTA_SYMBOL_FIELD_KIND as info_fields.

`obj` : | Self
`err` : | Error propagation and reporting.
Returns : | a Pixbuf icon representing the symbol.

### ianjuta_symbol_get_id ()

    gint                ianjuta_symbol_get_id               (IAnjutaSymbol *obj,
                                                             GError **err);

An unique identifier for the symbol: pay attention that when engine re-parse the files this id may change.

`obj` : | Self
`err` : | Error propagation and reporting.
Returns : | 0 on error, otherwise the id of the symbol mapped in the db.

### ianjuta_symbol_get_line ()

    gulong              ianjuta_symbol_get_line             (IAnjutaSymbol *obj,
                                                             GError **err);

`obj` : | Self
`err` : | Error propagation and reporting.
Returns : | Line of the file the symbol is declared in.

### ianjuta_symbol_get_name ()

    const gchar *       ianjuta_symbol_get_name             (IAnjutaSymbol *obj,
                                                             GError **err);

`obj` : | Self
`err` : | Error propagation and reporting.
Returns : | The name of the symbol

### ianjuta_symbol_get_sym_type ()

    IAnjutaSymbolType   ianjuta_symbol_get_sym_type         (IAnjutaSymbol *obj,
                                                             GError **err);

You can obtain an IAnjutaSymbolType of the symbol. To have a string representation see `ianjuta_symbol_get_extra_info_string()`. You *need* a symbol with IANJUTA_SYMBOL_FIELD_TYPE enabled attribute. e.g. use ianjuta_symbol_manager_search passing IANJUTA_SYMBOL_FIELD_TYPE as info_fields.

`obj` : | Self
`err` : | Error propagation and reporting.
Returns : | a IAnjutaSymbolType

### ianjuta_symbol_is_local ()

    gboolean            ianjuta_symbol_is_local             (IAnjutaSymbol *obj,
                                                             GError **err);

Is the symbol a static (private) one?

`obj` : | Self
`err` : | Error propagation and reporting.
Returns : | TRUE if the symbol is local (private, etc), FALSE elsewhere.

## See Also

#IAnjutaSymbolManager