/usr/include/xmms2/xmmsclient/xmmsclient++/mainloop.h is in libxmmsclient++-dev 0.8+dfsg-12.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 | /* XMMS2 - X Music Multiplexer System
* Copyright (C) 2003-2011 XMMS2 Team
*
* PLUGINS ARE NOT CONSIDERED TO BE DERIVED WORK !!!
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*/
#ifndef XMMSCLIENTPP_MAINLOOP_H
#define XMMSCLIENTPP_MAINLOOP_H
#include <xmmsclient/xmmsclient++/listener.h>
#include <list>
namespace Xmms
{
/** @class MainloopInterface mainloop.h "xmmsclient/xmmsclient++/mainloop.h"
* @brief Interface to all mainloops run by Client.
*/
class MainloopInterface
{
public:
/** Constructor.
*
* @param conn xmmsc_connection_t* of the connection to
* use in the mainloop.
*
* @note The constructor should only initialize the
* mainloop, not start it!
*/
MainloopInterface( xmmsc_connection_t* conn ) :
running_( false ), conn_( conn ) { }
/** Destructor. Should also stop the loop.
*/
virtual ~MainloopInterface() { }
/** Start the mainloop.
*
* @note Some mainloop implementations might require the
* use of a separate function to be run.
*/
virtual void run() = 0;
/** Check if the mainloop is currently running.
*/
bool isRunning() const {
return running_;
}
protected:
bool running_;
xmmsc_connection_t*& conn_;
};
/** @class MainLoop mainloop.h "xmmsclient/xmmsclient++/mainloop.h"
* @brief A standalone mainloop allowing additional custom Listeners.
* Can only be created by the Client class.
*/
class MainLoop : public MainloopInterface
{
public:
/** Copy-constructor.
*/
MainLoop( const MainLoop& src );
/** Destructor.
*
* @note The destructors frees all the registered listeners.
*/
virtual ~MainLoop();
/** Add a new listener to listen on in the loop.
*/
void addListener( ListenerInterface* l );
/** Remove an existing listener from the loop.
*
* @note The ListenerInterface comparison operator is used
* (i.e. compare the file descriptors), not pointer
* comparison.
*/
void removeListener( ListenerInterface* l );
/** Start the mainloop.
* Only stops if the connection is lost or all listeners
* are removed.
*/
virtual void run();
/** @cond */
private:
// Constructor, only to be called by Xmms::Client
friend class Client;
/** Constructor, only callable by Client.
*
* @param conn xmmsc_connection_t* of the connection used
* in the mainloop.
*/
MainLoop( xmmsc_connection_t*& conn );
/** Copy assignment operator, only callable by Client.
*/
MainLoop& operator=( const MainLoop& src ) const;
/** List of listeners listened on.
*/
std::list< ListenerInterface* > listeners;
/** The method actually doing the io operations on the
* listeners.
*/
void waitForData();
/** @endcond */
};
}
#endif // XMMSCLIENTPP_MAINLOOP_H
|