introduced "namespace SyncEvo" consistently

Added syncevo/declarations.h, which has

This is now used for all SyncEvolution source files, except
for the GTK UI, which is written in plain C. In the library
it helps to avoid name clashes.

The reason for using defines instead of spelling out "namespace SyncEvo"
is twofold:
1. if that should ever become necessary, it is easier to
   rename the namespace via configure options by changing
   the define
2. editors don't indent the whole file content
This commit is contained in:
Patrick Ohly 2009-10-02 17:23:53 +02:00
parent 7e0770461f
commit f87ffd682d
82 changed files with 457 additions and 110 deletions

View File

@ -24,6 +24,9 @@ extern "C" {
}
#endif
#include "syncevo/declarations.h"
SE_BEGIN_CXX
using namespace std;
CmdlineSyncClient::CmdlineSyncClient(const string &server,
@ -129,3 +132,5 @@ bool CmdlineSyncClient::savePassword(const string &passwordName,
#endif
return false;
}
SE_END_CXX

View File

@ -22,6 +22,9 @@
#include "EvolutionSyncClient.h"
#include "syncevo/declarations.h"
SE_BEGIN_CXX
/**
* a command line sync client for the purpose of
* supporting a mechanism to save and retrieve password
@ -50,4 +53,6 @@ class CmdlineSyncClient : public EvolutionSyncClient {
bool m_keyring;
};
SE_END_CXX
#endif // INCL_CMDLINESYNCCLIENT

View File

@ -36,6 +36,8 @@
#include <set>
#include <map>
using namespace SyncEvo;
class DBusSyncClient : public EvolutionSyncClient {
public:
@ -90,5 +92,4 @@ private:
}
};
#endif

View File

@ -23,6 +23,9 @@
#include <CoreFoundation/CoreFoundation.h>
#include "syncevo/declarations.h"
SE_BEGIN_CXX
/**
* constants missing from AddressBook framework on iPhone: use strings
* as found in SQLite database on iPhone
@ -140,4 +143,6 @@ public:
}
} constants;
SE_END_CXX
#endif // ENABLE_ADDRESSBOOK

View File

@ -118,6 +118,9 @@ enum {
#include <CoreFoundation/CoreFoundation.h>
#include "syncevo/declarations.h"
SE_BEGIN_CXX
using namespace vocl;
/** converts a CFString to std::string in UTF-8 - does not free input, throws exception if conversion impossible */
@ -1466,4 +1469,6 @@ void AddressBookSource::logItem(const SyncItem &item, const string &info, bool d
}
}
SE_END_CXX
#endif /* ENABLE_ADDRESSBOOK */

View File

@ -27,6 +27,9 @@
#include <AddressBook/ABAddressBookC.h>
#include "syncevo/declarations.h"
SE_BEGIN_CXX
/**
* a smart pointer for CoreFoundation object references
*
@ -188,4 +191,6 @@ class AddressBookSource : public TrackingSyncSource
#endif // ENABLE_EBOOK
SE_END_CXX
#endif // INCL_ADDRESSBOOKSOURCE

View File

@ -20,6 +20,9 @@
#include "AddressBookSource.h"
#include "SyncEvolutionUtil.h"
#include "syncevo/declarations.h"
SE_BEGIN_CXX
static SyncSource *createSource(const SyncSourceParams &params)
{
SourceType sourceType = SyncSource::getSourceType(params.m_nodes);
@ -118,3 +121,5 @@ public:
#endif // ENABLE_INTEGRATION_TESTS
#endif // ENABLE_ADDRESSBOOK
SE_END_CXX

View File

@ -39,6 +39,9 @@ using namespace std;
#include <boost/foreach.hpp>
#include "syncevo/declarations.h"
SE_BEGIN_CXX
static const string
EVOLUTION_CALENDAR_PRODID("PRODID:-//ACME//NONSGML SyncEvolution//EN"),
EVOLUTION_CALENDAR_VERSION("VERSION:2.0");
@ -745,6 +748,8 @@ string EvolutionCalendarSource::icalTime2Str(const icaltimetype &tt)
}
}
SE_END_CXX
#endif /* ENABLE_ECAL */
#ifdef ENABLE_MODULES

View File

@ -27,6 +27,9 @@
#include <boost/noncopyable.hpp>
#include "syncevo/declarations.h"
SE_BEGIN_CXX
#ifdef ENABLE_ECAL
/**
@ -206,4 +209,6 @@ typedef int ECalSourceType;
#endif // ENABLE_ECAL
SE_END_CXX
#endif // INCL_EVOLUTIONSYNCSOURCE

View File

@ -24,6 +24,9 @@
#include <boost/algorithm/string.hpp>
#include "syncevo/declarations.h"
SE_BEGIN_CXX
static SyncSource *createSource(const SyncSourceParams &params)
{
SourceType sourceType = SyncSource::getSourceType(params.m_nodes);
@ -339,3 +342,5 @@ public:
#endif // ENABLE_INTEGRATION_TESTS
#endif // ENABLE_ECAL
SE_END_CXX

View File

@ -39,6 +39,9 @@ using namespace std;
#include <boost/algorithm/string/join.hpp>
#include <boost/foreach.hpp>
#include "syncevo/declarations.h"
SE_BEGIN_CXX
class unrefEBookChanges {
public:
/** free list of EBookChange instances */
@ -393,6 +396,8 @@ const char *EvolutionContactSource::getMimeVersion() const
}
}
SE_END_CXX
#endif /* ENABLE_EBOOK */
#ifdef ENABLE_MODULES

View File

@ -31,6 +31,9 @@
#include <set>
#include "syncevo/declarations.h"
SE_BEGIN_CXX
/**
* Implements access to Evolution address books.
*/
@ -124,6 +127,7 @@ class EvolutionContactSource : public EvolutionSyncSource,
} m_uniqueProperties;
};
#endif // ENABLE_EBOOK
SE_END_CXX
#endif // ENABLE_EBOOK
#endif // INCL_EVOLUTIONCONTACTSOURCE

View File

@ -21,6 +21,9 @@
#include "EvolutionContactSource.h"
#include "test.h"
#include "syncevo/declarations.h"
SE_BEGIN_CXX
static SyncSource *createSource(const SyncSourceParams &params)
{
SourceType sourceType = SyncSource::getSourceType(params.m_nodes);
@ -183,3 +186,5 @@ public:
#endif // ENABLE_EBOOK
SE_END_CXX

View File

@ -29,6 +29,9 @@ using namespace std;
#include <syncevo/Logging.h>
#include "syncevo/declarations.h"
SE_BEGIN_CXX
void EvolutionMemoSource::readItem(const string &luid, std::string &item, bool raw)
{
if (raw) {
@ -215,4 +218,7 @@ bool EvolutionMemoSource::isNativeType(const char *type)
!strcasecmp(type, "text/calendar"));
}
SE_END_CXX
#endif /* ENABLE_ECAL */

View File

@ -23,6 +23,9 @@
#include <config.h>
#include <EvolutionCalendarSource.h>
#include "syncevo/declarations.h"
SE_BEGIN_CXX
#ifdef ENABLE_ECAL
/**
@ -51,4 +54,6 @@ class EvolutionMemoSource : public EvolutionCalendarSource
#endif // ENABLE_ECAL
SE_END_CXX
#endif // INCL_EVOLUTIONMEMOSOURCE

View File

@ -20,6 +20,9 @@
#include "EvolutionSyncSource.h"
#include "syncevo/declarations.h"
SE_BEGIN_CXX
#ifdef HAVE_EDS
ESource *EvolutionSyncSource::findSource( ESourceList *list, const string &id )
@ -56,3 +59,5 @@ void EvolutionSyncSource::throwError(const string &action, GError *gerror)
throwError(action + gerrorstr);
}
#endif // HAVE_EDS
SE_END_CXX

View File

@ -24,7 +24,9 @@
#include <syncevo/TrackingSyncSource.h>
#include <syncevo/eds_abi_wrapper.h>
using namespace SyncEvolution;
#include "syncevo/declarations.h"
SE_BEGIN_CXX
/**
* The base class for all Evolution backends.
@ -75,4 +77,6 @@ class EvolutionSyncSource : public TrackingSyncSource
#endif
};
SE_END_CXX
#endif // INCL_EVOLUTIONSYNCSOURCE

View File

@ -88,5 +88,4 @@ extern char *ical_strdup(const char *x);
}
#endif /* __cplusplus */
#endif /* ICALSTRDUP_H */

View File

@ -42,6 +42,9 @@
#include <sstream>
#include <fstream>
#include "syncevo/declarations.h"
SE_BEGIN_CXX
FileSyncSource::FileSyncSource(const SyncSourceParams &params,
const string &dataformat) :
TrackingSyncSource(params),
@ -221,6 +224,8 @@ string FileSyncSource::createFilename(const string &entry)
return filename;
}
SE_END_CXX
#endif /* ENABLE_FILE */
#ifdef ENABLE_MODULES

View File

@ -27,6 +27,9 @@
#include <memory>
#include <boost/noncopyable.hpp>
#include "syncevo/declarations.h"
SE_BEGIN_CXX
/**
* Stores each SyncML item as a separate file in a directory. The
* directory has to be specified via the database name, using
@ -102,5 +105,7 @@ class FileSyncSource : public TrackingSyncSource, private boost::noncopyable
string createFilename(const string &entry);
};
SE_END_CXX
#endif // ENABLE_FILE
#endif // INCL_FILESYNCSOURCE

View File

@ -21,6 +21,9 @@
#include "FileSyncSource.h"
#include "test.h"
#include "syncevo/declarations.h"
SE_BEGIN_CXX
static SyncSource *createSource(const SyncSourceParams &params)
{
SourceType sourceType = SyncSource::getSourceType(params.m_nodes);
@ -171,3 +174,5 @@ public:
#endif // ENABLE_INTEGRATION_TESTS
#endif // ENABLE_FILE
SE_END_CXX

View File

@ -37,6 +37,9 @@
#include <boost/algorithm/string/case_conv.hpp>
#include "syncevo/declarations.h"
SE_BEGIN_CXX
enum {
PERSON_LAST,
PERSON_MIDDLE,
@ -367,6 +370,8 @@ std::string SQLiteContactSource::endSync(bool success)
return "";
}
SE_END_CXX
#endif /* ENABLE_SQLITE */
#ifdef ENABLE_MODULES

View File

@ -27,6 +27,9 @@
#include <boost/bind.hpp>
#include "syncevo/declarations.h"
SE_BEGIN_CXX
#ifdef ENABLE_SQLITE
/**
@ -101,4 +104,6 @@ class SQLiteContactSource : public SyncSource,
};
#endif // ENABLE_SQLITE
SE_END_CXX
#endif // INCL_SQLITECONTACTSOURCE

View File

@ -25,6 +25,9 @@
# include <cppunit/extensions/HelperMacros.h>
#endif
#include "syncevo/declarations.h"
SE_BEGIN_CXX
static SyncSource *createSource(const SyncSourceParams &params)
{
SourceType sourceType = SyncSource::getSourceType(params.m_nodes);
@ -106,3 +109,5 @@ public:
#endif
#endif // ENABLE_SQLITE
SE_END_CXX

View File

@ -30,6 +30,9 @@
#include <sstream>
#include <cstring>
#include "syncevo/declarations.h"
SE_BEGIN_CXX
void SQLiteUtil::throwError(const string &operation)
{
string descr = m_name + ": '" + m_fileid + "': " + operation + " failed";
@ -193,4 +196,7 @@ void SQLiteUtil::close()
}
SE_END_CXX
#endif /* ENABLE_SQLITE */

View File

@ -26,6 +26,9 @@
#include <syncevo/EvolutionSmartPtr.h>
#include <string>
#include "syncevo/declarations.h"
SE_BEGIN_CXX
using namespace std;
class SQLiteUnref {
@ -133,5 +136,7 @@ class SQLiteUtil
eptr<sqlite3, sqlite3, SQLiteUnref> m_db;
};
SE_END_CXX
#endif // ENABLE_SQLITE
#endif // INCL_SQLITESYNCSOURCE

View File

@ -40,6 +40,9 @@
#include "SyncEvolutionUtil.h"
#include "VolatileConfigNode.h"
#include "syncevo/declarations.h"
SE_BEGIN_CXX
/*
* always provide this test class, even if not used:
* that way the test scripts can unconditionally
@ -439,3 +442,5 @@ private:
TestEvolution testClient;
} testEvolution;
SE_END_CXX

View File

@ -29,6 +29,9 @@ using namespace std;
#include <boost/shared_ptr.hpp>
#include <boost/algorithm/string/predicate.hpp>
#include "syncevo/declarations.h"
SE_BEGIN_CXX
/**
* This class corresponds to the Funambol C++ client
* DeviceManagementNode, but offers a slightly different API. See
@ -169,4 +172,6 @@ class ConfigNode {
virtual bool exists() const = 0;
};
SE_END_CXX
#endif

View File

@ -24,6 +24,9 @@
#include <map>
#include <list>
#include <string>
#include "syncevo/declarations.h"
SE_BEGIN_CXX
using namespace std;
class ConfigNode;
@ -106,4 +109,6 @@ class ConfigTree {
virtual list<string> getChildren(const string &path) = 0;
};
SE_END_CXX
#endif

View File

@ -26,7 +26,9 @@
#include <ctime>
#include "SyncEvolutionUtil.h"
namespace SyncEvolution {
#include "syncevo/declarations.h"
SE_BEGIN_CXX
CurlTransportAgent::CurlTransportAgent() :
m_easyHandle(easyInit()),
@ -302,6 +304,7 @@ int CurlTransportAgent::processCallback()
return 0;
}
} // namespace SyncEvolution
SE_END_CXX
#endif // ENABLE_LIBCURL

View File

@ -27,7 +27,9 @@
#include "TransportAgent.h"
#include <curl/curl.h>
namespace SyncEvolution {
#include "syncevo/declarations.h"
SE_BEGIN_CXX
/**
* message send/receive with curl
@ -115,8 +117,8 @@ class CurlTransportAgent : public TransportAgent
static CURL *easyInit();
};
} // namespace SyncEvolution
SE_END_CXX
#endif // ENABLE_LIBCURL
#endif // INCL_TRANSPORTAGENT

View File

@ -39,6 +39,9 @@ using namespace std;
#include <boost/scoped_array.hpp>
#include <boost/shared_ptr.hpp>
#include "syncevo/declarations.h"
SE_BEGIN_CXX
template<class T> class EvolutionUnrefFree {
public:
static void unref(T *pointer) { free(pointer); }
@ -174,4 +177,6 @@ template <class T> class arrayptr : public eptr<T, T, ArrayUnref<T> > {
};
};
SE_END_CXX
#endif

View File

@ -34,7 +34,6 @@
#include "TransportAgent.h"
#include "CurlTransportAgent.h"
#include "SoupTransportAgent.h"
using namespace SyncEvolution;
#include <list>
#include <memory>
@ -59,10 +58,15 @@ using namespace std;
#include <signal.h>
#include <dirent.h>
#include <errno.h>
#include <pthread.h>
#include <signal.h>
#include "synthesis/enginemodulebridge.h"
#include "synthesis/SDK_util.h"
#include "syncevo/declarations.h"
SE_BEGIN_CXX
SourceList *EvolutionSyncClient::m_sourceListPtr;
SuspendFlags EvolutionSyncClient::s_flags;
@ -1097,8 +1101,6 @@ void EvolutionSyncClient::fatalError(void *object, const char *error)
#endif
#ifdef RUN_GLIB_LOOP
#include <pthread.h>
#include <signal.h>
static void *mainLoopThread(void *)
{
// The test framework uses SIGALRM for timeouts.
@ -2194,3 +2196,5 @@ std::string EvolutionSyncClient::findSSLServerCertificate()
return "";
}
SE_END_CXX

View File

@ -34,10 +34,10 @@ using namespace std;
#include <boost/smart_ptr.hpp>
namespace SyncEvolution {
class TransportAgent;
}
using namespace SyncEvolution;
#include "syncevo/declarations.h"
SE_BEGIN_CXX
class TransportAgent;
class SourceList;
class SyncSource;
@ -528,4 +528,6 @@ public:
static bool transport_cb (void *data);
bool processTransportCb();
};
SE_END_CXX
#endif // INCL_EVOLUTIONSYNCCLIENT

View File

@ -30,6 +30,9 @@
#include <errno.h>
#include <fcntl.h>
#include "syncevo/declarations.h"
SE_BEGIN_CXX
/** @TODO: replace stdio.h with streams */
boost::shared_ptr<ConfigNode> ConfigNode::createFileNode(const string &filename)
@ -409,3 +412,5 @@ void HashFileConfigNode::setProperty(const string &property,
}
}
SE_END_CXX

View File

@ -24,6 +24,9 @@
#include <string>
#include <list>
#include "syncevo/declarations.h"
SE_BEGIN_CXX
using namespace std;
/**
@ -132,4 +135,6 @@ class HashFileConfigNode: public FileBaseConfigNode {
virtual void removeProperty(const string &property);
};
SE_END_CXX
#endif

View File

@ -33,6 +33,9 @@
#include <fcntl.h>
#include <dirent.h>
#include "syncevo/declarations.h"
SE_BEGIN_CXX
FileConfigTree::FileConfigTree(const string &root,
bool oldLayout) :
m_root(root),
@ -184,3 +187,5 @@ list<string> FileConfigTree::getChildren(const string &path)
return res;
}
SE_END_CXX

View File

@ -24,6 +24,9 @@
#include <string>
#include <map>
#include "syncevo/declarations.h"
SE_BEGIN_CXX
using namespace std;
/**
@ -64,4 +67,6 @@ class FileConfigTree : public ConfigTree {
NodeCache_t m_nodes;
};
SE_END_CXX
#endif

View File

@ -23,6 +23,9 @@
#include <boost/foreach.hpp>
#include <boost/algorithm/string/join.hpp>
#include "syncevo/declarations.h"
SE_BEGIN_CXX
FilterConfigNode::FilterConfigNode(const boost::shared_ptr<ConfigNode> &node,
const ConfigFilter &filter) :
m_filter(filter),
@ -117,3 +120,5 @@ FilterConfigNode::ConfigFilter::operator string () const {
sort(res.begin(), res.end());
return boost::join(res, "\n");
}
SE_END_CXX

View File

@ -31,6 +31,9 @@
#include <utility>
#include <vector>
#include <string>
#include "syncevo/declarations.h"
SE_BEGIN_CXX
using namespace std;
/**
@ -86,4 +89,6 @@ class FilterConfigNode : public ConfigNode {
boost::shared_ptr<const ConfigNode> m_readOnlyNode;
};
SE_END_CXX
#endif

View File

@ -10,6 +10,9 @@
#include <string>
#include <map>
#include "syncevo/declarations.h"
SE_BEGIN_CXX
/**
* Implements a ConfigNode with an in-memory hash table.
*/
@ -46,4 +49,6 @@ class HashConfigNode : public ConfigNode {
virtual bool exists() const { return true; }
};
SE_END_CXX
#endif

View File

@ -21,6 +21,7 @@
#include <config.h>
#include "LogRedirect.h"
#include "Logging.h"
#include "test.h"
#include "SyncEvolutionUtil.h"
#include <sys/types.h>
#include <sys/socket.h>
@ -40,7 +41,9 @@
# include <glib.h>
#endif
namespace SyncEvolution {
#include "syncevo/declarations.h"
SE_BEGIN_CXX
LogRedirect *LogRedirect::m_redirect;
@ -333,10 +336,8 @@ void LogRedirect::process() throw()
m_processing = false;
}
} // namespace SyncEvolution
#ifdef ENABLE_UNIT_TESTS
#include "test.h"
class LogRedirectTest : public CppUnit::TestFixture {
CPPUNIT_TEST_SUITE(LogRedirectTest);
@ -353,15 +354,15 @@ class LogRedirectTest : public CppUnit::TestFixture {
* redirect stdout/stderr, then intercept the log messages and
* store them for inspection
*/
class LogBuffer : public SyncEvolution::LoggerBase
class LogBuffer : public LoggerBase
{
public:
std::stringstream m_streams[DEBUG + 1];
SyncEvolution::LogRedirect *m_redirect;
LogRedirect *m_redirect;
LogBuffer(bool both = true)
{
m_redirect = new SyncEvolution::LogRedirect(both);
m_redirect = new LogRedirect(both);
pushLogger(this);
}
~LogBuffer()
@ -392,7 +393,7 @@ public:
CPPUNIT_ASSERT_EQUAL((ssize_t)strlen(simpleMessage), write(STDOUT_FILENO, simpleMessage, strlen(simpleMessage)));
buffer.m_redirect->process();
CPPUNIT_ASSERT_EQUAL(buffer.m_streams[SyncEvolution::Logger::INFO].str(), std::string(simpleMessage));
CPPUNIT_ASSERT_EQUAL(buffer.m_streams[Logger::INFO].str(), std::string(simpleMessage));
}
void largeChunk()
@ -404,8 +405,8 @@ public:
CPPUNIT_ASSERT_EQUAL((ssize_t)large.size(), write(STDOUT_FILENO, large.c_str(), large.size()));
buffer.m_redirect->process();
CPPUNIT_ASSERT_EQUAL(large.size(), buffer.m_streams[SyncEvolution::Logger::INFO].str().size());
CPPUNIT_ASSERT_EQUAL(large, buffer.m_streams[SyncEvolution::Logger::INFO].str());
CPPUNIT_ASSERT_EQUAL(large.size(), buffer.m_streams[Logger::INFO].str().size());
CPPUNIT_ASSERT_EQUAL(large, buffer.m_streams[Logger::INFO].str());
}
void streams()
@ -418,8 +419,8 @@ public:
CPPUNIT_ASSERT_EQUAL((ssize_t)strlen(errorMessage), write(STDERR_FILENO, errorMessage, strlen(errorMessage)));
buffer.m_redirect->process();
CPPUNIT_ASSERT_EQUAL(std::string(simpleMessage), buffer.m_streams[SyncEvolution::Logger::INFO].str());
CPPUNIT_ASSERT_EQUAL(std::string(errorMessage), buffer.m_streams[SyncEvolution::Logger::DEV].str());
CPPUNIT_ASSERT_EQUAL(std::string(simpleMessage), buffer.m_streams[Logger::INFO].str());
CPPUNIT_ASSERT_EQUAL(std::string(errorMessage), buffer.m_streams[Logger::DEV].str());
}
void overload()
@ -433,7 +434,7 @@ public:
}
buffer.m_redirect->process();
CPPUNIT_ASSERT(buffer.m_streams[SyncEvolution::Logger::INFO].str().size() > large.size());
CPPUNIT_ASSERT(buffer.m_streams[Logger::INFO].str().size() > large.size());
}
#ifdef HAVE_GLIB
@ -469,8 +470,8 @@ public:
buffer.m_redirect->process();
std::string debug = buffer.m_streams[SyncEvolution::Logger::DEBUG].str();
std::string dev = buffer.m_streams[SyncEvolution::Logger::DEV].str();
std::string debug = buffer.m_streams[Logger::DEBUG].str();
std::string dev = buffer.m_streams[Logger::DEV].str();
CPPUNIT_ASSERT(debug.find("test warning") != debug.npos);
CPPUNIT_ASSERT(dev.find("normal message stderr") != dev.npos);
} catch(...) {
@ -493,3 +494,5 @@ SYNCEVOLUTION_TEST_SUITE_REGISTRATION(LogRedirectTest);
#endif // ENABLE_UNIT_TESTS
SE_END_CXX

View File

@ -22,6 +22,9 @@
#include "LogStdout.h"
#include "syncevo/declarations.h"
SE_BEGIN_CXX
/**
* Intercepts all text written to stdout or stderr and passes it
* through the currently active logger, which may or may not be
@ -75,7 +78,6 @@
* variable SYNCEVOLUTION_DEBUG is set (regardless of its value).
*/
namespace SyncEvolution {
class LogRedirect : public LoggerStdout
{
@ -116,6 +118,5 @@ class LogRedirect : public LoggerStdout
va_list args);
};
} // namespace
SE_END_CXX
#endif // INCL_LOGREDIRECT

View File

@ -22,7 +22,9 @@
#include <string.h>
#include <errno.h>
namespace SyncEvolution {
#include "syncevo/declarations.h"
SE_BEGIN_CXX
LoggerStdout::LoggerStdout(FILE *file) :
m_file(file),
@ -83,4 +85,4 @@ void LoggerStdout::messagev(Level level,
format, args);
}
}
SE_END_CXX

View File

@ -25,7 +25,9 @@
#include <stdio.h>
#include <string>
namespace SyncEvolution {
#include "syncevo/declarations.h"
SE_BEGIN_CXX
/**
* A logger which writes to stdout or a file.
@ -70,6 +72,5 @@ class LoggerStdout : public LoggerBase
va_list args);
};
} // namespace
SE_END_CXX
#endif // INCL_LOGSTDOUT

View File

@ -23,7 +23,8 @@
#include <vector>
namespace SyncEvolution {
#include "syncevo/declarations.h"
SE_BEGIN_CXX
static LoggerStdout DefaultLogger;
@ -77,5 +78,4 @@ const char *Logger::levelToStr(Level level)
}
}
}
SE_END_CXX

View File

@ -23,7 +23,8 @@
#include <stdarg.h>
namespace SyncEvolution {
#include "syncevo/declarations.h"
SE_BEGIN_CXX
/**
* Abstract interface for logging in SyncEvolution. Can be
@ -176,7 +177,7 @@ class LoggerBase : public Logger
#define SE_LOG(_level, _instance, _prefix, _format, _args...) \
do { \
if (_instance) { \
static_cast<SyncEvolution::Logger *>(_instance)->message(_level, \
static_cast<Logger *>(_instance)->message(_level, \
_prefix, \
__FILE__, \
__LINE__, \
@ -184,7 +185,7 @@ class LoggerBase : public Logger
_format, \
##_args); \
} else { \
SyncEvolution::LoggerBase::instance().message(_level, \
LoggerBase::instance().message(_level, \
_prefix, \
__FILE__, \
__LINE__, \
@ -194,12 +195,11 @@ class LoggerBase : public Logger
} \
} while(false)
#define SE_LOG_ERROR(_instance, _prefix, _format, _args...) SE_LOG(SyncEvolution::Logger::ERROR, _instance, _prefix, _format, ##_args)
#define SE_LOG_WARNING(_instance, _prefix, _format, _args...) SE_LOG(SyncEvolution::Logger::WARNING, _instance, _prefix, _format, ##_args)
#define SE_LOG_INFO(_instance, _prefix, _format, _args...) SE_LOG(SyncEvolution::Logger::INFO, _instance, _prefix, _format, ##_args)
#define SE_LOG_DEV(_instance, _prefix, _format, _args...) SE_LOG(SyncEvolution::Logger::DEV, _instance, _prefix, _format, ##_args)
#define SE_LOG_DEBUG(_instance, _prefix, _format, _args...) SE_LOG(SyncEvolution::Logger::DEBUG, _instance, _prefix, _format, ##_args)
#define SE_LOG_ERROR(_instance, _prefix, _format, _args...) SE_LOG(Logger::ERROR, _instance, _prefix, _format, ##_args)
#define SE_LOG_WARNING(_instance, _prefix, _format, _args...) SE_LOG(Logger::WARNING, _instance, _prefix, _format, ##_args)
#define SE_LOG_INFO(_instance, _prefix, _format, _args...) SE_LOG(Logger::INFO, _instance, _prefix, _format, ##_args)
#define SE_LOG_DEV(_instance, _prefix, _format, _args...) SE_LOG(Logger::DEV, _instance, _prefix, _format, ##_args)
#define SE_LOG_DEBUG(_instance, _prefix, _format, _args...) SE_LOG(Logger::DEBUG, _instance, _prefix, _format, ##_args)
} // namespace
SE_END_CXX
#endif // INCL_LOGGING

View File

@ -81,7 +81,9 @@ SYNCEVOLUTION_SOURCES = \
TrackingSyncSource.cpp
libsyncevolution_includedir= $(includedir)/syncevo
libsyncevolution_include_HEADERS= TrackingSyncSource.h \
libsyncevolution_include_HEADERS = \
declarations.h \
TrackingSyncSource.h \
FilterConfigNode.h \
PrefixConfigNode.h \
SafeConfigNode.h \

View File

@ -23,6 +23,9 @@
#include <boost/foreach.hpp>
#include <boost/algorithm/string/predicate.hpp>
#include "syncevo/declarations.h"
SE_BEGIN_CXX
PrefixConfigNode::PrefixConfigNode(const string prefix,
const boost::shared_ptr<ConfigNode> &node) :
m_prefix(prefix),
@ -81,3 +84,5 @@ void PrefixConfigNode::flush()
}
m_node->flush();
}
SE_END_CXX

View File

@ -27,6 +27,9 @@
#include <utility>
#include <vector>
#include <string>
#include "syncevo/declarations.h"
SE_BEGIN_CXX
using namespace std;
/**
@ -67,4 +70,6 @@ class PrefixConfigNode : public ConfigNode {
boost::shared_ptr<const ConfigNode> m_readOnlyNode;
};
SE_END_CXX
#endif

View File

@ -22,6 +22,9 @@
#include <boost/foreach.hpp>
#include "syncevo/declarations.h"
SE_BEGIN_CXX
SafeConfigNode::SafeConfigNode(const boost::shared_ptr<ConfigNode> &node) :
m_node(node),
m_readOnlyNode(node),
@ -143,3 +146,5 @@ string SafeConfigNode::unescape(const string &str) const
return res;
}
SE_END_CXX

View File

@ -27,6 +27,9 @@
#include <utility>
#include <vector>
#include <string>
#include "syncevo/declarations.h"
SE_BEGIN_CXX
using namespace std;
/**
@ -84,4 +87,6 @@ class SafeConfigNode : public ConfigNode {
string unescape(const string &str) const;
};
SE_END_CXX
#endif

View File

@ -30,7 +30,8 @@
#include <libsoup/soup-gnome-features.h>
#endif
namespace SyncEvolution {
#include "syncevo/declarations.h"
SE_BEGIN_CXX
SoupTransportAgent::SoupTransportAgent(GMainLoop *loop) :
m_session(soup_session_async_new()),
@ -272,6 +273,8 @@ gboolean SoupTransportAgent::TimeoutCallback(gpointer transport)
SoupTransportAgent * sTransport = static_cast<SoupTransportAgent *>(transport);
return sTransport->processCallback();
}
} // namespace SyncEvolution
SE_END_CXX
#endif // ENABLE_LIBSOUP

View File

@ -29,7 +29,9 @@
#include <libsoup/soup.h>
#include <glib/gmain.h>
namespace SyncEvolution {
#include "syncevo/declarations.h"
SE_BEGIN_CXX
class GLibUnref {
public:
@ -108,7 +110,7 @@ class SoupTransportAgent : public TransportAgent
SoupMessage *msg);
};
} // namespace SyncEvolution
SE_END_CXX
#endif // ENABLE_LIBSOUP
#endif // INCL_TRANSPORTAGENT

View File

@ -24,6 +24,7 @@
#include "SyncSource.h"
#include "EvolutionSyncClient.h"
#include "SyncEvolutionUtil.h"
#include "test.h"
#include <unistd.h>
#include <errno.h>
@ -41,6 +42,9 @@ using namespace std;
#include <boost/algorithm/string.hpp>
#include <boost/foreach.hpp>
#include "syncevo/declarations.h"
SE_BEGIN_CXX
SyncEvolutionCmdline::SyncEvolutionCmdline(int argc, const char * const * argv, ostream &out, ostream &err) :
m_argc(argc),
m_argv(argv),
@ -811,7 +815,6 @@ EvolutionSyncClient* SyncEvolutionCmdline::createSyncClient() {
}
#ifdef ENABLE_UNIT_TESTS
#include "test.h"
/** simple line-by-line diff */
static string diffStrings(const string &lhs, const string &rhs)
@ -1985,3 +1988,5 @@ private:
SYNCEVOLUTION_TEST_SUITE_REGISTRATION(SyncEvolutionCmdlineTest);
#endif // ENABLE_UNIT_TESTS
SE_END_CXX

View File

@ -22,14 +22,17 @@
#include "SyncEvolutionConfig.h"
#include "FilterConfigNode.h"
class SyncSource;
class EvolutionSyncClient;
#include <set>
using namespace std;
#include <boost/shared_ptr.hpp>
#include "syncevo/declarations.h"
SE_BEGIN_CXX
class SyncSource;
class EvolutionSyncClient;
class SyncEvolutionCmdlineTest;
class SyncEvolutionCmdline {
@ -149,4 +152,6 @@ protected:
friend class SyncEvolutionCmdlineTest;
};
SE_END_CXX
#endif // INCL_SYNC_EVOLUTION_CMDLINE

View File

@ -36,6 +36,9 @@
#include <unistd.h>
#include "config.h"
#include "syncevo/declarations.h"
SE_BEGIN_CXX
static bool SourcePropSourceTypeIsSet(boost::shared_ptr<SyncSourceConfig> source);
static bool SourcePropURIIsSet(boost::shared_ptr<SyncSourceConfig> source);
@ -1186,3 +1189,5 @@ ConfigPasswordKey EvolutionPasswordConfigProperty::getPasswordKey(const string &
return key;
}
SE_END_CXX

View File

@ -30,6 +30,9 @@
#include <string>
#include <sstream>
#include <set>
#include "syncevo/declarations.h"
SE_BEGIN_CXX
using namespace std;
/**
@ -1170,4 +1173,6 @@ class PersistentSyncSourceConfig : public SyncSourceConfig {
/**@}*/
SE_END_CXX
#endif

View File

@ -41,6 +41,9 @@
CPPUNIT_REGISTRY_ADD_TO_DEFAULT("SyncEvolution");
#endif
#include "syncevo/declarations.h"
SE_BEGIN_CXX
string normalizePath(const string &path)
{
string res;
@ -347,3 +350,5 @@ std::string SubstEnvironment(const std::string &str)
return res.str();
}
SE_END_CXX

View File

@ -34,11 +34,12 @@
#include <string>
#include <utility>
#include <exception>
#include "syncevo/declarations.h"
SE_BEGIN_CXX
using namespace std;
namespace SyncEvolution {
class Logger;
}
class Logger;
/** case-insensitive less than for assoziative containers */
template <class T> class Nocase : public std::binary_function<T, T, bool> {
@ -200,8 +201,8 @@ class SyncEvolutionException : public std::runtime_error
*
* @param logger the class which does the logging
*/
static SyncMLStatus handle(SyncMLStatus *status = NULL, SyncEvolution::Logger *logger = NULL);
static SyncMLStatus handle(SyncEvolution::Logger *logger) { return handle(NULL, logger); }
static SyncMLStatus handle(SyncMLStatus *status = NULL, Logger *logger = NULL);
static SyncMLStatus handle(Logger *logger) { return handle(NULL, logger); }
};
/**
@ -224,4 +225,6 @@ inline string getHome() {
#define SE_THROW_EXCEPTION(_class, _what) \
throw _class(__FILE__, __LINE__, _what)
SE_END_CXX
#endif // INCL_SYNCEVOLUTION_UTIL

View File

@ -31,6 +31,9 @@
#include <boost/algorithm/string/predicate.hpp>
#include <boost/algorithm/string/replace.hpp>
#include "syncevo/declarations.h"
SE_BEGIN_CXX
std::string PrettyPrintSyncMode(SyncMode mode, bool userVisible)
{
switch (mode) {
@ -587,3 +590,5 @@ ConfigNode &operator >> (ConfigNode &node, SyncReport &report)
return node;
}
SE_END_CXX

View File

@ -26,6 +26,9 @@
#include <ostream>
#include <string.h>
#include "syncevo/declarations.h"
SE_BEGIN_CXX
enum SyncMode {
SYNC_NONE,
SYNC_TWO_WAY,
@ -261,4 +264,6 @@ ConfigNode &operator << (ConfigNode &node, const SyncReport &report);
/** read report from a ConfigNode */
ConfigNode &operator >> (ConfigNode &node, SyncReport &report);
SE_END_CXX
#endif // INCL_SYNCML

View File

@ -40,6 +40,9 @@
#include <fstream>
#include <iostream>
#include "syncevo/declarations.h"
SE_BEGIN_CXX
void SyncSourceBase::throwError(const string &action, int error)
{
throwError(action + ": " + strerror(error));
@ -850,3 +853,5 @@ void SyncSourceLogging::init(const std::list<std::string> &fields,
this, _1, ops.m_deleteItem);
}
SE_END_CXX

View File

@ -24,13 +24,15 @@
#include <syncevo/SyncEvolutionConfig.h>
#include <syncevo/Logging.h>
#include <syncevo/SyncML.h>
using namespace SyncEvolution;
#include <synthesis/sync_declarations.h>
#include <synthesis/syerror.h>
#include <boost/function.hpp>
#include "syncevo/declarations.h"
SE_BEGIN_CXX
class SyncSource;
class SDKInterface;
@ -1436,4 +1438,6 @@ class TestingSyncSource : public SyncSource,
}
};
SE_END_CXX
#endif // INCL_SYNCSOURCE

View File

@ -36,6 +36,9 @@ using namespace sysync;
#include <sstream>
#include "syncevo/declarations.h"
SE_BEGIN_CXX
#define BuildNumber 0 /* User defined build number, can be 0..255 */
#define MyDB "SyncEvolution" /* example debug name */
#define MY_ID 42 /* example datastore context */
@ -859,3 +862,5 @@ TSyError SyncEvolution_DeleteContext( CContext aContext )
source->popSynthesisAPI();
return LOCERR_OK;
}
SE_END_CXX

View File

@ -22,6 +22,9 @@
#include <synthesis/SDK_util.h>
#include "syncevo/declarations.h"
SE_BEGIN_CXX
void SharedEngine::Connect(const string &aEngineName,
sysync::CVersion aPrgVersion,
sysync::uInt16 aDebugFlags)
@ -207,7 +210,7 @@ void SharedEngine::SetInt32Value(const SharedKey &aKeyH, const string &aValName,
}
}
void SharedEngine::doDebug(SyncEvolution::Logger::Level level,
void SharedEngine::doDebug(Logger::Level level,
const char *prefix,
const char *file,
int line,
@ -217,8 +220,8 @@ void SharedEngine::doDebug(SyncEvolution::Logger::Level level,
{
std::string str = StringPrintfV(format, args);
SySyncDebugPuts(m_engine->fCI, file, line, function,
level <= SyncEvolution::Logger::ERROR ? DBG_ERROR :
level <= SyncEvolution::Logger::INFO ? DBG_HOT :
level <= Logger::ERROR ? DBG_ERROR :
level <= Logger::INFO ? DBG_HOT :
0, prefix,
str.c_str());
}
@ -262,3 +265,5 @@ sysync::TSyError SDKInterface::getValue(sysync::KeyH aItemKey,
return res;
}
SE_END_CXX

View File

@ -38,6 +38,9 @@
#include <boost/scoped_array.hpp>
#include <stdexcept>
#include "syncevo/declarations.h"
SE_BEGIN_CXX
typedef boost::shared_ptr<sysync::SessionType> SharedSession;
typedef boost::shared_ptr<sysync::KeyType> SharedKey;
class SharedBuffer : public boost::shared_array<char>
@ -101,7 +104,7 @@ class SharedEngine {
sysync::sInt32 GetInt32Value(const SharedKey &aKeyH, const string &aValName);
void SetInt32Value(const SharedKey &aKeyH, const string &aValName, sysync::sInt32 aValue);
void doDebug(SyncEvolution::Logger::Level level,
void doDebug(Logger::Level level,
const char *prefix,
const char *file,
int line,
@ -154,4 +157,6 @@ struct SDKInterface : public sysync::SDK_InterfaceType
SharedBuffer &data);
};
SE_END_CXX
#endif // INCL_SYNTHESISENGINE

View File

@ -24,6 +24,9 @@
#include <boost/bind.hpp>
#include "syncevo/declarations.h"
SE_BEGIN_CXX
TrackingSyncSource::TrackingSyncSource(const SyncSourceParams &params,
int granularitySeconds) :
TestingSyncSource(params),
@ -90,3 +93,5 @@ void TrackingSyncSource::deleteItem(const std::string &luid)
removeItem(luid);
deleteRevision(*m_trackingNode, luid);
}
SE_END_CXX

View File

@ -27,6 +27,9 @@
#include <boost/shared_ptr.hpp>
#include <string>
#include <map>
#include "syncevo/declarations.h"
SE_BEGIN_CXX
using namespace std;
/**
@ -191,4 +194,6 @@ class TrackingSyncSource : public TestingSyncSource, virtual public SyncSourceRe
boost::shared_ptr<ConfigNode> m_trackingNode;
};
SE_END_CXX
#endif // INCL_TRACKINGSYNCSOURCE

View File

@ -19,6 +19,11 @@
#include "TransportAgent.h"
#include "syncevo/declarations.h"
SE_BEGIN_CXX
static const char * const TransportAgent::m_contentTypeSyncML = "application/vnd.syncml+xml";
static const char * const TransportAgent::m_contentTypeSyncWBXML = "application/vnd.syncml+wbxml";
static const char * const TransportAgent::m_contentTypeURLEncoded = "application/x-www-form-urlencoded";
SE_END_CXX

View File

@ -23,7 +23,9 @@
#include <string>
#include "SyncEvolutionUtil.h"
namespace SyncEvolution {
#include "syncevo/declarations.h"
SE_BEGIN_CXX
/**
* Abstract API for a message send/receive agent.
@ -173,6 +175,7 @@ class TransportException : public SyncEvolutionException
~TransportException() throw() {}
};
} // namespace SyncEvolution
SE_END_CXX
#endif // INCL_TRANSPORTAGENT

View File

@ -23,6 +23,9 @@
#include "FilterConfigNode.h"
#include "FileConfigNode.h"
#include "syncevo/declarations.h"
SE_BEGIN_CXX
/**
* This class can store properties while in memory, but will never
* save them persistently. Implemented by instantiating a FileConfigNode
@ -38,4 +41,6 @@ class VolatileConfigNode : public FilterConfigNode {
virtual void flush() {}
};
SE_END_CXX
#endif

View File

@ -20,7 +20,10 @@
#ifndef INCL_EVOLUTION_VOLATILE_CONFIG_TREE
# define INCL_EVOLUTION_VOLATILE_CONFIG_TREE
# include "FileConfigTree.h"
#include "FileConfigTree.h"
#include "syncevo/declarations.h"
SE_BEGIN_CXX
/**
* This class can store properties while in memory, but will never
@ -36,4 +39,6 @@ class VolatileConfigTree : public FileConfigTree {
virtual void flush() {}
};
SE_END_CXX
#endif

View File

@ -26,6 +26,8 @@
#include <dlfcn.h>
#include <stdarg.h>
#include "syncevo/declarations.h"
namespace {
std::string lookupDebug, lookupInfo;
@ -280,3 +282,4 @@ extern "C" void EDSAbiWrapperInit()
extern "C" const char *EDSAbiWrapperInfo() { return lookupInfo.c_str(); }
extern "C" const char *EDSAbiWrapperDebug() { return lookupDebug.c_str(); }

View File

@ -35,10 +35,13 @@ using namespace std;
#include "LogRedirect.h"
#include "CmdlineSyncClient.h"
#if defined(ENABLE_MAEMO) && defined (ENABLE_EBOOK)
#include <dlfcn.h>
#include "syncevo/declarations.h"
SE_BEGIN_CXX
#if defined(ENABLE_MAEMO) && defined (ENABLE_EBOOK)
// really override the symbol, even if redefined by EDSAbiWrapper
#undef e_contact_new_from_vcard
extern "C" EContact *e_contact_new_from_vcard(const char *vcard)
@ -80,7 +83,7 @@ class KeyringSyncCmdline : public SyncEvolutionCmdline {
}
};
extern "C"
int main( int argc, char **argv )
{
#ifdef ENABLE_MAEMO
@ -99,7 +102,7 @@ int main( int argc, char **argv )
// stdout is printed normally. Deconstructing it when
// leaving main() does one final processing of pending
// output.
SyncEvolution::LogRedirect redirect(false);
LogRedirect redirect(false);
#if defined(HAVE_GLIB)
// this is required when using glib directly or indirectly
@ -150,3 +153,5 @@ int main( int argc, char **argv )
return 1;
}
SE_END_CXX

View File

@ -49,8 +49,13 @@
#include <iostream>
#include <algorithm>
#include <fcntl.h>
#include <boost/bind.hpp>
#include "syncevo/declarations.h"
SE_BEGIN_CXX
/**
* Using this pointer automates the open()/beginSync()/endSync()/close()
* life cycle: it automatically calls these functions when a new
@ -3223,11 +3228,6 @@ bool ClientTest::compare(ClientTest &client, const char *fileA, const char *file
return success;
}
#ifndef WIN32
#include <fcntl.h>
#endif
void ClientTest::postSync(int res, const std::string &logname)
{
#ifdef WIN32
@ -3810,3 +3810,5 @@ void CheckSyncReport::check(SyncMLStatus status, SyncReport &report) const
/** @} */
/** @endcond */
#endif // ENABLE_INTEGRATION_TESTS
SE_END_CXX

View File

@ -29,11 +29,6 @@
#include <boost/function.hpp>
#include <boost/shared_ptr.hpp>
class EvolutionSyncClient;
class EvolutionSyncSource;
class TransportWrapper;
class TestingSyncSource;
#include <SyncML.h>
#include <TransportAgent.h>
#include <SyncSource.h>
@ -46,6 +41,14 @@ class TestingSyncSource;
#include <cppunit/TestAssert.h>
#include <cppunit/TestFixture.h>
#include "syncevo/declarations.h"
SE_BEGIN_CXX
class EvolutionSyncClient;
class EvolutionSyncSource;
class TransportWrapper;
class TestingSyncSource;
/**
* This class encapsulates logging and checking of a SyncReport.
* When constructed with default parameters, no checking will be done.
@ -122,7 +125,7 @@ struct SyncOptions {
*/
Callback_t m_startCallback;
boost::shared_ptr<SyncEvolution::TransportAgent> m_transport;
boost::shared_ptr<TransportAgent> m_transport;
SyncOptions(SyncMode syncMode = SYNC_NONE,
const CheckSyncReport &checkReport = CheckSyncReport(),
@ -131,8 +134,8 @@ struct SyncOptions {
bool loSupport = false,
bool isWBXML = defaultWBXML(),
Callback_t startCallback = EmptyCallback,
boost::shared_ptr<SyncEvolution::TransportAgent> transport =
boost::shared_ptr<SyncEvolution::TransportAgent>()) :
boost::shared_ptr<TransportAgent> transport =
boost::shared_ptr<TransportAgent>()) :
m_syncMode(syncMode),
m_checkReport(checkReport),
m_maxMsgSize(maxMsgSize),
@ -152,7 +155,7 @@ struct SyncOptions {
SyncOptions &setLOSupport(bool loSupport) { m_loSupport = loSupport; return *this; }
SyncOptions &setWBXML(bool isWBXML) { m_isWBXML = isWBXML; return *this; }
SyncOptions &setStartCallback(const Callback_t &callback) { m_startCallback = callback; return *this; }
SyncOptions &setTransportAgent(const boost::shared_ptr<SyncEvolution::TransportAgent> transport)
SyncOptions &setTransportAgent(const boost::shared_ptr<TransportAgent> transport)
{m_transport = transport; return *this;}
static bool EmptyCallback(EvolutionSyncClient &,
@ -715,17 +718,17 @@ protected:
* We use UserSuspendInjector to emulate a user suspend after receving
* a response.
*/
class TransportWrapper : public SyncEvolution::TransportAgent {
class TransportWrapper : public TransportAgent {
protected:
int m_interruptAtMessage, m_messageCount;
boost::shared_ptr<SyncEvolution::TransportAgent> m_wrappedAgent;
boost::shared_ptr<TransportAgent> m_wrappedAgent;
Status m_status;
SyncOptions *m_options;
public:
TransportWrapper() {
m_messageCount = 0;
m_interruptAtMessage = -1;
m_wrappedAgent = boost::shared_ptr<SyncEvolution::TransportAgent>();
m_wrappedAgent = boost::shared_ptr<TransportAgent>();
m_status = INACTIVE;
m_options = NULL;
}
@ -743,7 +746,7 @@ public:
bool verifyHost) { m_wrappedAgent->setSSL(cacerts, verifyServer, verifyHost); }
virtual void setContentType(const std::string &type) { m_wrappedAgent->setContentType(type); }
virtual void setUserAgent(const::string &agent) { m_wrappedAgent->setUserAgent(agent); }
virtual void setAgent(boost::shared_ptr<SyncEvolution::TransportAgent> agent) {m_wrappedAgent = agent;}
virtual void setAgent(boost::shared_ptr<TransportAgent> agent) {m_wrappedAgent = agent;}
virtual void setSyncOptions(SyncOptions *options) {m_options = options;}
virtual void setInterruptAtMessage (int interrupt) {m_interruptAtMessage = interrupt;}
virtual void cancel() { m_wrappedAgent->cancel(); }
@ -807,5 +810,7 @@ public:
#define ADD_TEST_TO_SUITE(_suite, _class, _function) \
_suite->addTest(FilterTest(new CppUnit::TestCaller<_class>(_suite->getName() + "::" #_function, &_class::_function, *this)))
SE_END_CXX
#endif // ENABLE_INTEGRATION_TESTS
#endif // INCL_TESTSYNCCLIENT

View File

@ -22,6 +22,9 @@
#include <stdlib.h>
#include "syncevo/declarations.h"
SE_BEGIN_CXX
int main(int argc, char **argv)
{
// Check that we catch stderr message generated
@ -31,8 +34,8 @@ int main(int argc, char **argv)
// appears in abort-redirect.log instead of
// stderr. A core file should be written normally.
SyncEvolution::LogRedirect redirect;
SyncEvolution::LoggerStdout out(fopen("abort-redirect.log", "w"));
LogRedirect redirect;
LoggerStdout out(fopen("abort-redirect.log", "w"));
out.pushLogger(&out);
// write without explicit flushing
@ -51,3 +54,5 @@ int main(int argc, char **argv)
return 0;
}
SE_END_CXX

View File

@ -50,6 +50,9 @@
#include <string>
#include <stdexcept>
#include "syncevo/declarations.h"
SE_BEGIN_CXX
using namespace std;
void simplifyFilename(string &filename)
@ -101,8 +104,8 @@ public:
}
~ClientListener() {
if (&SyncEvolution::LoggerBase::instance() == m_logger.get()) {
SyncEvolution::LoggerBase::popLogger();
if (&LoggerBase::instance() == m_logger.get()) {
LoggerBase::popLogger();
}
}
@ -125,9 +128,9 @@ public:
cerr << m_currentTest;
string logfile = m_currentTest + ".log";
simplifyFilename(logfile);
m_logger.reset(new SyncEvolution::LoggerStdout(logfile));
m_logger->setLevel(SyncEvolution::Logger::DEBUG);
SyncEvolution::LoggerBase::pushLogger(m_logger.get());
m_logger.reset(new LoggerStdout(logfile));
m_logger->setLevel(Logger::DEBUG);
LoggerBase::pushLogger(m_logger.get());
SE_LOG_DEBUG(NULL, NULL, "*** starting %s ***", m_currentTest.c_str());
m_failures.reset();
m_testFailed = false;
@ -172,7 +175,7 @@ public:
if (!failure.empty()) {
SE_LOG_DEBUG(NULL, NULL, "%s", failure.c_str());
}
SyncEvolution::LoggerBase::popLogger();
LoggerBase::popLogger();
m_logger.reset();
string logfile = m_currentTest + ".log";
@ -201,7 +204,7 @@ private:
bool m_failed, m_testFailed;
string m_currentTest;
int m_alarmSeconds;
auto_ptr<SyncEvolution::LoggerStdout> m_logger;
auto_ptr<LoggerStdout> m_logger;
CppUnit::TestResultCollector m_failures;
static void alarmTriggered(int signal) {
@ -226,6 +229,7 @@ static void printTests(CppUnit::Test *test, int indention)
}
}
extern "C"
int main(int argc, char* argv[])
{
// Get the top level suite from the registry
@ -281,3 +285,5 @@ int main(int argc, char* argv[])
/** @} */
/** @endcond */
SE_END_CXX

View File

@ -137,6 +137,9 @@ CLIENT_TEST_SERVER=funambol CLIENT_TEST_SOURCES=vcard30,ical20 ./client-test
#endif
#include <sys/stat.h>
#include "syncevo/declarations.h"
SE_BEGIN_CXX
#ifdef ENABLE_INTEGRATION_TESTS
class TestFileSource : public ClientTest {
@ -347,3 +350,5 @@ private:
/** @} */
/** @endcond */
#endif // ENABLE_INTEGRATION_TESTS
SE_END_CXX

View File

@ -32,6 +32,9 @@
#include <boost/algorithm/string/classification.hpp>
#include <boost/algorithm/string/predicate.hpp>
#include "syncevo/declarations.h"
SE_BEGIN_CXX
class SkipTest : public CppUnit::TestCase {
public:
SkipTest(const std::string &name) :
@ -64,4 +67,8 @@ CppUnit::Test *FilterTest(CppUnit::Test *test)
}
}
#endif
SE_END_CXX
#endif // defined(ENABLE_INTEGRATION_TESTS) || defined(ENABLE_UNIT_TESTS)

View File

@ -32,6 +32,8 @@
# include <config.h>
#endif
#include "syncevo/declarations.h"
// These defines are set in config.h when using the autotools
// mechanism and by the project setup on Windows. They control whether
// tests inside the libraries source code (ENABLE_UNIT_TESTS) or of
@ -43,13 +45,7 @@
# include <cppunit/extensions/HelperMacros.h>
# include <string>
// use this macros instead of the plain CPPUNIT_ one to ensure
// that the autotools Makefile and Visual Studio helper script can find
// all tests and link them into the test binary
#define FUNAMBOL_TEST_SUITE_REGISTRATION( ATestFixtureType ) \
CPPUNIT_TEST_SUITE_REGISTRATION( ATestFixtureType ); \
extern "C" { int funambolAutoRegisterRegistry ## ATestFixtureType = 12345; }
SE_BEGIN_CXX
// until a better solution is found use the helper function from TestMain.cpp
// to get the name of the currently running test; beware, will contain colons
@ -72,7 +68,10 @@ extern void simplifyFilename(std::string &filename);
*/
CppUnit::Test *FilterTest(CppUnit::Test *test);
SE_END_CXX
#endif // ENABLE_UNIT_TESTS
/** @endcond */
#endif // INCL_TEST_H