CpgImport

CpgImport — Network import object

Synopsis

#define             CPG_IMPORT_CONST                    (obj)
#define             CPG_IMPORT_ERROR
enum                CpgImportError;
struct              CpgImport;
struct              CpgImportClass;
GQuark              cpg_import_error_quark              (void);
CpgImport *         cpg_import_new                      (CpgNetwork *network,
                                                         CpgGroup *parent,
                                                         const gchar *id,
                                                         GFile *file,
                                                         GError **error);
CpgImport *         cpg_import_new_from_path            (CpgNetwork *network,
                                                         CpgGroup *parent,
                                                         const gchar *id,
                                                         const gchar *path,
                                                         GError **error);
gboolean            cpg_import_load                     (CpgImport *self,
                                                         CpgNetwork *network,
                                                         CpgGroup *parent,
                                                         GError **error);
GFile *             cpg_import_get_file                 (CpgImport *self);
gchar *             cpg_import_get_path                 (CpgImport *self);
gboolean            cpg_import_imports_object           (CpgImport *self,
                                                         CpgObject *object);
const gchar * const * cpg_import_get_search_path        ();
void                cpg_import_set_search_path          (gchar **path);
void                cpg_import_append_search_path       (const gchar *path);
void                cpg_import_prepend_search_path      (const gchar *path);
                    CpgImportPrivate;

Object Hierarchy

  GEnum
   +----CpgImportError
  GObject
   +----CpgObject
         +----CpgGroup
               +----CpgImport
                     +----CpgImportAlias

Implemented Interfaces

CpgImport implements CpgUsable, CpgAnnotatable, CpgLayoutable, CpgTaggable and CpgModifiable.

Properties

  "file"                     GFile*                : Read / Write / Construct Only
  "path"                     gchar*                : Read

Description

The CpgImport object can be used to import templates and objects from an external network file.

Details

CPG_IMPORT_CONST()

#define CPG_IMPORT_CONST(obj)		(G_TYPE_CHECK_INSTANCE_CAST ((obj), CPG_TYPE_IMPORT, CpgImport const))


CPG_IMPORT_ERROR

#define CPG_IMPORT_ERROR (cpg_import_error_quark ())


enum CpgImportError

typedef enum
{
	CPG_IMPORT_ERROR_REMOVE,
} CpgImportError;

Import error types.

CPG_IMPORT_ERROR_REMOVE

cannot remove imported object

struct CpgImport

struct CpgImport;


struct CpgImportClass

struct CpgImportClass {
};

The CpgImport class


cpg_import_error_quark ()

GQuark              cpg_import_error_quark              (void);


cpg_import_new ()

CpgImport *         cpg_import_new                      (CpgNetwork *network,
                                                         CpgGroup *parent,
                                                         const gchar *id,
                                                         GFile *file,
                                                         GError **error);

Import objects from an external file. The import object will automatically be added to the parent group. If the import is done in the normal object tree of the network, templates that are defined in the imported file will be automatically imported in the networks' templates.

network :

A CpgNetwork

parent :

A CpgGroup. [allow-none]

id :

The import object id

file :

The file to import

error :

A GError

Returns :

A CpgImport or NULL if the import failed.

cpg_import_new_from_path ()

CpgImport *         cpg_import_new_from_path            (CpgNetwork *network,
                                                         CpgGroup *parent,
                                                         const gchar *id,
                                                         const gchar *path,
                                                         GError **error);

Convenience function to create a new import for a path. See cpg_import_new for more information. Note that the specified path should be an absolute path. The search directories are not used to resolve the full path.

network :

A CpgNetwork

parent :

A CpgGroup. [allow-none]

id :

The import object id

path :

The import file path

error :

A GError

Returns :

A CpgImport

cpg_import_load ()

gboolean            cpg_import_load                     (CpgImport *self,
                                                         CpgNetwork *network,
                                                         CpgGroup *parent,
                                                         GError **error);

Perform the actual import. This function is called by cpg_import_new and should never have to be used manually. It's provided for use in bindings.

self :

A CpgImport

network :

A CpgNetwork

parent :

A CpgGroup. [allow-none]

error :

A GError

Returns :

TRUE if the import was successful, FALSE otherwise.

cpg_import_get_file ()

GFile *             cpg_import_get_file                 (CpgImport *self);

Get the file that was imported.

self :

A CpgImport

Returns :

A GFile. [transfer full][allow-none]

cpg_import_get_path ()

gchar *             cpg_import_get_path                 (CpgImport *self);

Get the path that was imported.

self :

A CpgImport

Returns :

the path. [transfer full][allow-none]

cpg_import_imports_object ()

gboolean            cpg_import_imports_object           (CpgImport *self,
                                                         CpgObject *object);


cpg_import_get_search_path ()

const gchar * const * cpg_import_get_search_path        ();

Get the search directories used to resolve import file names.

Returns :

a NULL terminated list of strings. [array zero-terminated=1][transfer none]

cpg_import_set_search_path ()

void                cpg_import_set_search_path          (gchar **path);

Set the search directories used to resolve import file names. path should be a NULL terminated list of strings.

path :

The search directories. [array zero-terminated=1]

cpg_import_append_search_path ()

void                cpg_import_append_search_path       (const gchar *path);

Append a search directory path to the list of paths to be searched when resolving an import file.

path :

A directory path

cpg_import_prepend_search_path ()

void                cpg_import_prepend_search_path      (const gchar *path);

Prepend a search directory path to the list of paths to be searched when resolving an import file.

path :

A directory path

CpgImportPrivate

typedef struct _CpgImportPrivate CpgImportPrivate;

Property Details

The "file" property

  "file"                     GFile*                : Read / Write / Construct Only

The imported file


The "path" property

  "path"                     gchar*                : Read

Path.

Default value: NULL