Git-Url: 
http://git.frugalware.org/gitweb/gitweb.cgi?p=pacman-g2.git;a=commitdiff;h=ef6445794165adfbffef087c96245c0fcf046a8b

commit ef6445794165adfbffef087c96245c0fcf046a8b
Author: Michel Hermier <[email protected]>
Date:   Mon Sep 29 17:18:09 2014 +0200

libpacman: Rename FLogger to FAbstractLogger.

diff --git a/lib/libpacman/CMakeLists.txt b/lib/libpacman/CMakeLists.txt
index 00c042d..9e1887e 100644
--- a/lib/libpacman/CMakeLists.txt
+++ b/lib/libpacman/CMakeLists.txt
@@ -20,6 +20,8 @@ set(FLIB_SOURCES
io/archive.c
io/ffilelock.c
io/ftp.c
+       util/fabstractlogger.cpp
+       util/fabstractlogger.h
util/falgorithms.h
util/fdispatchlogger.cpp
util/fdispatchlogger.h
@@ -29,8 +31,6 @@ set(FLIB_SOURCES
util/ffunctional.h
util/flog.cpp
util/flog.h
-       util/flogger.cpp
-       util/flogger.h
util/fptrlist.cpp
util/fptrlist.h
util/fstringlist.cpp
diff --git a/lib/libpacman/util/flogger.cpp 
b/lib/libpacman/util/fabstractlogger.cpp
similarity index 78%
rename from lib/libpacman/util/flogger.cpp
rename to lib/libpacman/util/fabstractlogger.cpp
index f387026..5d14d35 100644
--- a/lib/libpacman/util/flogger.cpp
+++ b/lib/libpacman/util/fabstractlogger.cpp
@@ -1,5 +1,5 @@
/*
- *  flogger.c
+ *  fabstractlogger.c
*
*  Copyright (c) 2013 by Michel Hermier <[email protected]>
*
@@ -26,19 +26,19 @@
#include <time.h>

/* pacman-g2 */
-#include "util/flogger.h"
+#include "util/fabstractlogger.h"

#include "fstdlib.h"
#include "fstring.h"

-FLogger::FLogger(unsigned char mask, FLogFunc fn, void *data)
+FAbstractLogger::FAbstractLogger(unsigned char mask, FLogFunc fn, void *data)
: m_mask(mask), m_fn(fn), m_data(data)
{ }

-FLogger::~FLogger()
+FAbstractLogger::~FAbstractLogger()
{ }

-void FLogger::log(unsigned char flag, const char *format, ...)
+void FAbstractLogger::log(unsigned char flag, const char *format, ...)
{
va_list ap;

@@ -47,7 +47,7 @@ void FLogger::log(unsigned char flag, const char *format, ...)
va_end(ap);
}

-void FLogger::logs(unsigned char flag, const char *s)
+void FAbstractLogger::logs(unsigned char flag, const char *s)
{
if(m_fn == NULL ||
(flag & m_mask) == 0) {
@@ -57,7 +57,7 @@ void FLogger::logs(unsigned char flag, const char *s)
m_fn(flag, s, m_data);
}

-void FLogger::vlog(unsigned char flag, const char *format, va_list ap)
+void FAbstractLogger::vlog(unsigned char flag, const char *format, va_list ap)
{
char str[LOG_STR_LEN];

diff --git a/lib/libpacman/util/flogger.h b/lib/libpacman/util/fabstractlogger.h
similarity index 80%
rename from lib/libpacman/util/flogger.h
rename to lib/libpacman/util/fabstractlogger.h
index 8deaaca..8df20ca 100644
--- a/lib/libpacman/util/flogger.h
+++ b/lib/libpacman/util/fabstractlogger.h
@@ -1,5 +1,5 @@
/*
- *  flogger.h
+ *  fabstractlogger.h
*
*  Copyright (c) 2013 by Michel Hermier <[email protected]>
*
@@ -18,23 +18,22 @@
*  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
*  USA.
*/
-#ifndef F_LOGGER_H
-#define F_LOGGER_H
+#ifndef F_ABSTRACTLOGGER_H
+#define F_ABSTRACTLOGGER_H

#include "pacman.h"

#define LOG_STR_LEN 256

-typedef struct FLogger FLogger;
typedef void (*FLogFunc)(unsigned char flag, const char *message, void *data);

-class FLogger {
+class FAbstractLogger {
public:
-       FLogger(unsigned char mask, FLogFunc fn, void *data);
-       virtual ~FLogger();
+       FAbstractLogger(unsigned char mask, FLogFunc fn, void *data);
+       virtual ~FAbstractLogger();

void log(unsigned char flag, const char *format, ...);
-       void logs(unsigned char flag, const char *s);
+       virtual void logs(unsigned char flag, const char *s);
void vlog(unsigned char flag, const char *format, va_list ap);

protected:
@@ -43,6 +42,6 @@ protected:
void *m_data;
};

-#endif /* F_LOGGER_H */
+#endif /* F_ABSTRACTLOGGER_H */

/* vim: set ts=2 sw=2 noet: */
diff --git a/lib/libpacman/util/fdispatchlogger.cpp 
b/lib/libpacman/util/fdispatchlogger.cpp
index f1eec5e..2fa1711 100644
--- a/lib/libpacman/util/fdispatchlogger.cpp
+++ b/lib/libpacman/util/fdispatchlogger.cpp
@@ -32,12 +32,12 @@ void f_dispatchlogger_log(unsigned char flag, const char 
*message, void *data)
FPtrList *list = (FPtrList *)data;

for (auto it = f_ptrlist_first(list), end = f_ptrlist_end(list); it != end; it 
= it->next()) {
-               ((FLogger *)f_ptrlistitem_data(it))->logs(flag, message);
+               ((FAbstractLogger *)f_ptrlistitem_data(it))->logs(flag, 
message);
}
}

FDispatchLogger::FDispatchLogger(unsigned char mask)
-       : FLogger(mask, f_dispatchlogger_log, f_ptrlist_new())
+       : FAbstractLogger(mask, f_dispatchlogger_log, f_ptrlist_new())
{ }

FDispatchLogger::~FDispatchLogger()
diff --git a/lib/libpacman/util/fdispatchlogger.h 
b/lib/libpacman/util/fdispatchlogger.h
index 3519ccc..7294eb3 100644
--- a/lib/libpacman/util/fdispatchlogger.h
+++ b/lib/libpacman/util/fdispatchlogger.h
@@ -23,10 +23,10 @@

#include <stdio.h>

-#include "util/flogger.h"
+#include "util/fabstractlogger.h"

class FDispatchLogger
-       : public FLogger
+       : public FAbstractLogger
{
public:
FDispatchLogger(unsigned char mask);
diff --git a/lib/libpacman/util/ffilelogger.cpp 
b/lib/libpacman/util/ffilelogger.cpp
index 9487796..f86cd36 100644
--- a/lib/libpacman/util/ffilelogger.cpp
+++ b/lib/libpacman/util/ffilelogger.cpp
@@ -45,7 +45,7 @@ void f_filelogger_log(unsigned char flag, const char 
*message, void *data)
}

FFileLogger::FFileLogger(unsigned char mask, FILE *file)
-       : FLogger(mask, f_filelogger_log, file)
+       : FAbstractLogger(mask, f_filelogger_log, file)
{ }

FFileLogger::~FFileLogger()
diff --git a/lib/libpacman/util/ffilelogger.h b/lib/libpacman/util/ffilelogger.h
index 12be91d..4ac3958 100644
--- a/lib/libpacman/util/ffilelogger.h
+++ b/lib/libpacman/util/ffilelogger.h
@@ -23,10 +23,10 @@

#include <stdio.h>

-#include "util/flogger.h"
+#include "util/fabstractlogger.h"

class FFileLogger
-       : public FLogger
+       : public FAbstractLogger
{
public:
FFileLogger(unsigned char mask, FILE *file);
diff --git a/lib/libpacman/util/flog.cpp b/lib/libpacman/util/flog.cpp
index eadc40a..0716765 100644
--- a/lib/libpacman/util/flog.cpp
+++ b/lib/libpacman/util/flog.cpp
@@ -27,9 +27,9 @@
/* pacman-g2 */
#include "util/flog.h"

-#include "util/flogger.h"
+#include "util/fabstractlogger.h"

-FLogger *_f_sys_logger = NULL;
+FAbstractLogger *_f_sys_logger = NULL;

void f_log(unsigned char flag, const char *format, ...)
{
diff --git a/lib/libpacman/util/fsyslogger.cpp 
b/lib/libpacman/util/fsyslogger.cpp
index 5186523..24c7515 100644
--- a/lib/libpacman/util/fsyslogger.cpp
+++ b/lib/libpacman/util/fsyslogger.cpp
@@ -37,7 +37,7 @@ void f_syslogger_log(unsigned char flag, const char *message, 
void *data)
}

FSysLogger::FSysLogger(unsigned char mask)
-       : FLogger(mask, f_syslogger_log, NULL)
+       : FAbstractLogger(mask, f_syslogger_log, NULL)
{ }

FSysLogger::~FSysLogger()
diff --git a/lib/libpacman/util/fsyslogger.h b/lib/libpacman/util/fsyslogger.h
index 78bbbb7..c4fb24d 100644
--- a/lib/libpacman/util/fsyslogger.h
+++ b/lib/libpacman/util/fsyslogger.h
@@ -21,10 +21,10 @@
#ifndef F_SYSLOGGER_H
#define F_SYSLOGGER_H

-#include "util/flogger.h"
+#include "util/fabstractlogger.h"

class FSysLogger
-       : public FLogger
+       : public FAbstractLogger
{
public:
FSysLogger(unsigned char mask);
_______________________________________________
Frugalware-git mailing list
[email protected]
http://frugalware.org/mailman/listinfo/frugalware-git

Reply via email to