diff options
author | LarsAC <LarsAC@e10066b5-e1e2-0310-b819-94efdf66514b> | 2005-01-07 18:43:03 +0000 |
---|---|---|
committer | LarsAC <LarsAC@e10066b5-e1e2-0310-b819-94efdf66514b> | 2005-01-07 18:43:03 +0000 |
commit | 0756ae40d68d403082c86adef042a4c0daba219f (patch) | |
tree | 6ca3220de192057fc48a22a616445ff8a759c6d5 /mg_tools.h | |
parent | 1823baf159eaa175dd0e5c7ef46fdeeabe92d779 (diff) | |
download | vdr-plugin-muggle-0756ae40d68d403082c86adef042a4c0daba219f.tar.gz vdr-plugin-muggle-0756ae40d68d403082c86adef042a4c0daba219f.tar.bz2 |
Merged branch osd_extensions back to main trunk
git-svn-id: https://vdr-muggle.svn.sourceforge.net/svnroot/vdr-muggle/trunk/muggle-plugin@324 e10066b5-e1e2-0310-b819-94efdf66514b
Diffstat (limited to 'mg_tools.h')
-rw-r--r-- | mg_tools.h | 85 |
1 files changed, 36 insertions, 49 deletions
@@ -1,4 +1,4 @@ -/*! \file muggle_tools.h +/*! \file mg_tools.h * \ingroup muggle * \brief A few utility functions for standalone and plugin messaging for the vdr muggle plugindatabase * @@ -6,7 +6,7 @@ * \date $Date$ * \author Ralf Klueber, Lars von Wedel, Andreas Kellner * \author file owner: $Author$ - * + * */ /* makes sure we don't use the same declarations twice */ @@ -17,36 +17,21 @@ #include <string> #include <mysql.h> -#define STANDALONE 1 // what's this? - +#define STANDALONE 1 // what's this? -/*! \brief mySql helper function to execute read queries - * \ingroup muggle - * - * \todo Could be a member of mgDatabase? - */ -MYSQL_RES* mgSqlReadQuery( MYSQL *db, const char *fmt, ... ); - -/*! \brief mySql helper function to execute write queries - * \ingroup muggle +/*! + * \brief Logging utilities * - * \todo Could be a member of mgDatabase? - */ -void mgSqlWriteQuery( MYSQL *db, const char *fmt, ... ); - - -/*! - * \brief Logging utilities - * * \todo these could be static members in the mgLog class * \todo code of these functions should be compiled conditionally */ //@{ -void mgSetDebugLevel(int new_level); -void mgDebug(int level, const char *fmt, ...); -void mgDebug( const char *fmt, ... ); -void mgWarning(const char *fmt, ...); -void mgError(const char *fmt, ...); +void mgSetDebugLevel (int new_level); +void mgDebug (int level, const char *fmt, ...); +void mgDebug (const char *fmt, ...); +void mgWarning (const char *fmt, ...); +//! \todo mgError should display the message on the OSD. How? +void mgError (const char *fmt, ...); //@} #ifdef DEBUG @@ -63,38 +48,40 @@ void mgError(const char *fmt, ...); /*! \brief simplified logging class * \ingroup muggle - * + * * Create a local instance at the beginning of the method * and entering/leaving the function will be logged * as constructors/destructors are called. */ class mgLog { - public: - enum - { - LOG, WARNING, ERROR, FATAL - } mgLogLevel; + public: + enum + { + LOG, WARNING, ERROR, FATAL + } mgLogLevel; - std::ostream& getStream() - { - return std::cout; - } - - mgLog( std::string methodname ) : m_methodname( methodname ) - { - getStream() << m_methodname << " entered" << std::endl; - }; + std::ostream & getStream () + { + return std::cout; + } - ~mgLog() - { - getStream() << m_methodname << " terminated" << std::endl; - } + mgLog (std::string methodname):m_methodname (methodname) + { + getStream () << m_methodname << " entered" << std::endl; + }; - private: - - std::string m_methodname; + ~mgLog () + { + getStream () << m_methodname << " terminated" << std::endl; + } + + private: + + std::string m_methodname; }; -#endif /* _MUGGLE_TOOLS_H */ +std::string trim(std::string const& source, char const* delims = " \t\r\n"); + +#endif /* _MUGGLE_TOOLS_H */ |