APT2 Reference Manual | ||||
---|---|---|---|---|
Top | Description |
#include <apt.h> AptSession; AptSession * apt_session_new (GError **error
); void apt_session_unref (AptSession *session
); AptSession * apt_session_ref (AptSession *session
); AptConfiguration * apt_session_get_configuration (AptSession *session
); AptCache * apt_session_get_cache (AptSession *session
); AptSystem * apt_session_get_system (AptSession *session
); AptPolicy * apt_session_get_policy (AptSession *session
);
When writing a program using the APTLib API, the correct initialization of the classes, reading configuration, etc can become slightly annoying. The AptSession API is provided to make this setup as easy as possible. It takes care of reading the configuration files, loading the system, opening the cache, creating a new cache if none exists, updating the cache if it is outdated.
Programs using APTLib are expected to create a single AptSession at the beginning of the program execution and retrieve pointers to the AptSession members by calling the getter functions documented in this section.
typedef struct _AptSession AptSession;
AptSession is an opaque type which may only be accessed by the following functions.
AptSession * apt_session_new (GError **error
);
Parses the configuration files, constructs the needed objects and creates a new AptSession.
|
Location to store a GError. |
Returns : |
A newly allocated AptSession with reference count 1. |
void apt_session_unref (AptSession *session
);
Decrements the reference count of session
. If the reference count drops
to 0, release all references held to the members and free the memory
session
points to.
|
An AptSession |
AptSession * apt_session_ref (AptSession *session
);
Increments the reference count of session
.
|
An AptSession |
Returns : |
session . |
AptConfiguration * apt_session_get_configuration (AptSession *session
);
Gets an unowned reference to the AptConfiguration of session
. Do not
call apt_configuration_unref()
on it, unless you previously called
apt_configuration_ref()
on it.
|
An AptSession |
Returns : |
An unowned reference to the AptConfiguration of session . |
AptCache * apt_session_get_cache (AptSession *session
);
Gets an unowned reference to the AptCache contained in session
. You must
not call apt_cache_unref()
on the return value, unless you previously called
apt_cache_ref()
on it.
|
An AptSession |
Returns : |
An unowned reference to the AptCache of session . |
AptSystem * apt_session_get_system (AptSession *session
);
Gets an unowned reference to the AptSystem contained in session
. You must
not call apt_system_unref()
on the return value, unless you previously
called apt_system_ref()
on it.
|
An AptSession |
Returns : |
An unowned reference to the AptSystem of session . |
AptPolicy * apt_session_get_policy (AptSession *session
);
Gets an unowned reference to the AptPolicy contained in session
. You must
not call apt_policy_unref()
on the return value, unless you previously
called apt_policy_ref()
on it.