Freya  0.0.1
A Gtk3 MPD Client
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
Public Member Functions
MPD::Connection Class Reference

A convinience Wrapper around mpd_connection*. More...

#include <Connection.hh>

Public Member Functions

 Connection ()
 Initializes a new connection object.
 ~Connection ()
 Automatically disconnects.
bool is_connected ()
 is connected?
bool connect ()
 Tries to connect accordingly to the values in the config.
bool disconnect ()
 Disconnects connection.
bool clear_error ()
 Clears any occured errors.
bool check_error ()
 check if an error occured
ErrorNotify & signal_error ()
 get a sigc::connection that is emit()'d once an error occures
ConnectionNotifier & signal_connection_change ()
 Use this to register for connection changes.
void emit_connection_change ()
 Call emit() on the ConnectionNotifier signal.
mpd_connection * get_connection ()
 Returns the underlying C structure.

Detailed Description

A convinience Wrapper around mpd_connection*.

It features error notifying, error clearing, and doing the actual connection work.

Definition at line 59 of file Connection.hh.


Constructor & Destructor Documentation

Initializes a new connection object.

Automatically disconnects.


Member Function Documentation

check if an error occured

Clears error, calls emit() on ErrorNotify

Returns:
true if yes

Clears any occured errors.

If an error occured you might have to call this before you continue to use the connection, mostly this called automatically by check_error(), which is executed in every idle/busy cycle.

Returns:
true if error was not fatal

Tries to connect accordingly to the values in the config.

is_connected() hast to be false.

Returns:
true on success

Disconnects connection.

Returns:
true on success

Call emit() on the ConnectionNotifier signal.

This is a separate function because one want to emit the signal after making other things ready first. You have to call connect() or disconnect() BEFORE emitting though!

mpd_connection* MPD::Connection::get_connection ( )

Returns the underlying C structure.

Returns:
NULL if disconnected.

is connected?

Returns:
true if connected

Use this to register for connection changes.

Returns:
a ref to a sigc::signal - call connect() on it

get a sigc::connection that is emit()'d once an error occures

Returns:
a ref to a sigc::signal - call connect() on it

The documentation for this class was generated from the following file: