summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--3rdParty/CppUnit/SConscript2
-rw-r--r--3rdParty/HippoMocks/hippomocks.h608
-rw-r--r--3rdParty/SCons/scons-local-2.0.0.final.0/SCons/Tool/MSCommon/vc.py35
-rw-r--r--BuildTools/SCons/SConscript.boot83
-rw-r--r--BuildTools/SCons/SConstruct100
-rw-r--r--BuildTools/SCons/Tools/Test.py11
-rw-r--r--BuildTools/SCons/Version.py11
-rw-r--r--COPYING.thirdparty35
-rw-r--r--Documentation/SwiftenDevelopersGuide/Examples/EchoBot/SConscript4
-rw-r--r--Documentation/SwiftenDevelopersGuide/SConscript6
-rw-r--r--QA/Checker/SConscript4
-rw-r--r--Slimber/SConscript8
-rw-r--r--SwifTools/Application/UnixApplicationPathProvider.cpp5
-rw-r--r--Swiften/Client/XMLBeautifier.h7
-rw-r--r--Swiften/EventLoop/EventLoop.h6
-rw-r--r--Swiften/LinkLocal/DNSSD/Bonjour/BonjourRegisterQuery.h16
-rw-r--r--Swiften/Network/PlatformNetworkEnvironment.h6
-rw-r--r--Swiften/Network/SConscript8
-rw-r--r--Swiften/Network/SolarisNetworkEnvironment.cpp292
-rw-r--r--Swiften/Network/SolarisNetworkEnvironment.h29
-rw-r--r--Swiften/Parser/PayloadParserFactoryCollection.cpp6
-rw-r--r--Swiften/Roster/XMPPRosterImpl.h2
-rw-r--r--Swiften/Serializer/PayloadSerializerCollection.cpp6
-rw-r--r--Swiften/Session/BasicSessionStream.cpp20
24 files changed, 892 insertions, 418 deletions
diff --git a/3rdParty/CppUnit/SConscript b/3rdParty/CppUnit/SConscript
index ad287f3..addc8ab 100644
--- a/3rdParty/CppUnit/SConscript
+++ b/3rdParty/CppUnit/SConscript
@@ -1,15 +1,17 @@
Import("env")
if env["TEST"] :
if env["PLATFORM"] == "win32" :
cppflags = ["/I" + Dir("src/include").abspath]
+ elif env["PLATFORM"] == "sunos" :
+ cppflags = [("-I" + Dir("src/include").abspath)]
else :
cppflags = [("-isystem", Dir("src/include").abspath)]
################################################################################
# Module flags
################################################################################
if env["SCONS_STAGE"] == "flags" :
env["CPPUNIT_FLAGS"] = {
diff --git a/3rdParty/HippoMocks/hippomocks.h b/3rdParty/HippoMocks/hippomocks.h
index 802d719..3483dce 100644
--- a/3rdParty/HippoMocks/hippomocks.h
+++ b/3rdParty/HippoMocks/hippomocks.h
@@ -4,19 +4,19 @@
#pragma GCC diagnostic ignored "-Wold-style-cast"
#pragma GCC diagnostic ignored "-Wnon-virtual-dtor"
#pragma clang diagnostic ignored "-Wshorten-64-to-32"
#pragma clang diagnostic ignored "-Wunreachable-code"
#ifndef EXCEPTION_BUFFER_SIZE
#define EXCEPTION_BUFFER_SIZE 65536
#endif
-#ifndef VIRT_FUNC_LIMIT
+#ifndef VIRT_FUNC_LIMIT
#define VIRT_FUNC_LIMIT 1024
#elif VIRT_FUNC_LIMIT > 1024
#error Adjust the code to support more than 1024 virtual functions before setting the VIRT_FUNC_LIMIT above 1024
#endif
#ifdef __EDG__
#define FUNCTION_BASE 3
#define FUNCTION_STRIDE 2
#else
@@ -24,21 +24,22 @@
#define FUNCTION_STRIDE 1
#endif
#include <list>
#include <map>
#include <memory>
#include <iostream>
#include <sstream>
#include <cstring>
+#include <string>
#ifdef _MSC_VER
-// these warnings are pointless and huge, and will confuse new users.
+// these warnings are pointless and huge, and will confuse new users.
#pragma warning(push)
// If you can't generate an assignment operator the least you can do is shut up.
#pragma warning(disable: 4512)
// Alignment not right in a union?
#pragma warning(disable: 4121)
// Template parameters have the tendency not to change between executions.
#pragma warning(disable: 4127)
// No deprecated warnings on functions that really aren't deprecated at all.
#pragma warning(disable: 4996)
@@ -50,73 +51,73 @@ enum RegistrationType {
Once,
DontCare
};
// base type
class base_mock {
public:
void destroy() { unwriteVft(); delete this; }
virtual ~base_mock() {}
- void *rewriteVft(void *newVf)
+ void *rewriteVft(void *newVf)
{
void *oldVf = *(void **)this;
*(void **)this = newVf;
return oldVf;
}
- void unwriteVft()
+ void unwriteVft()
{
*(void **)this = (*(void ***)this)[-1];
}
};
-class NullType
+class NullType
{
-public:
- bool operator==(const NullType &) const
+public:
+ bool operator==(const NullType &) const
{
- return true;
+ return true;
}
};
struct NotPrintable { template <typename T> NotPrintable(T const&) {} };
inline std::ostream &operator<<(std::ostream &os, NotPrintable const&)
{
os << "???";
return os;
}
template <typename T>
-struct printArg
+struct printArg
{
static inline void print(std::ostream &os, T arg, bool withComma)
{
if (withComma) os << ",";
os << arg;
}
};
template <>
struct printArg<NullType>
{
static void print(std::ostream &, NullType , bool)
{
}
};
-class base_tuple
+class base_tuple
{
protected:
- base_tuple()
+ base_tuple()
{
- }
-public:
- virtual ~base_tuple()
+ }
+public:
+ virtual ~base_tuple()
{
}
virtual bool operator==(const base_tuple &) const = 0;
virtual void printTo(std::ostream &os) const = 0;
};
template <typename X>
struct no_cref { typedef X type; };
@@ -133,21 +134,21 @@ inline bool operator==(NotComparable, NotComparable)
template <typename T>
struct comparer
{
static inline bool compare(T a, T b)
{
return a == b;
}
};
-template <typename A = NullType, typename B = NullType, typename C = NullType, typename D = NullType,
- typename E = NullType, typename F = NullType, typename G = NullType, typename H = NullType,
- typename I = NullType, typename J = NullType, typename K = NullType, typename L = NullType,
+template <typename A = NullType, typename B = NullType, typename C = NullType, typename D = NullType,
+ typename E = NullType, typename F = NullType, typename G = NullType, typename H = NullType,
+ typename I = NullType, typename J = NullType, typename K = NullType, typename L = NullType,
typename M = NullType, typename N = NullType, typename O = NullType, typename P = NullType>
class tuple : public base_tuple
{
public:
typename no_cref<A>::type a;
typename no_cref<B>::type b;
typename no_cref<C>::type c;
typename no_cref<D>::type d;
typename no_cref<E>::type e;
@@ -156,25 +157,25 @@ public:
typename no_cref<H>::type h;
typename no_cref<I>::type i;
typename no_cref<J>::type j;
typename no_cref<K>::type k;
typename no_cref<L>::type l;
typename no_cref<M>::type m;
typename no_cref<N>::type n;
typename no_cref<O>::type o;
typename no_cref<P>::type p;
- tuple(typename no_cref<A>::type a = typename no_cref<A>::type(), typename no_cref<B>::type b = typename no_cref<B>::type(),
- typename no_cref<C>::type c = typename no_cref<C>::type(), typename no_cref<D>::type d = typename no_cref<D>::type(),
- typename no_cref<E>::type e = typename no_cref<E>::type(), typename no_cref<F>::type f = typename no_cref<F>::type(),
+ tuple(typename no_cref<A>::type a = typename no_cref<A>::type(), typename no_cref<B>::type b = typename no_cref<B>::type(),
+ typename no_cref<C>::type c = typename no_cref<C>::type(), typename no_cref<D>::type d = typename no_cref<D>::type(),
+ typename no_cref<E>::type e = typename no_cref<E>::type(), typename no_cref<F>::type f = typename no_cref<F>::type(),
typename no_cref<G>::type g = typename no_cref<G>::type(), typename no_cref<H>::type h = typename no_cref<H>::type(),
- typename no_cref<I>::type i = typename no_cref<I>::type(), typename no_cref<J>::type j = typename no_cref<J>::type(),
- typename no_cref<K>::type k = typename no_cref<K>::type(), typename no_cref<L>::type l = typename no_cref<L>::type(),
- typename no_cref<M>::type m = typename no_cref<M>::type(), typename no_cref<N>::type n = typename no_cref<N>::type(),
+ typename no_cref<I>::type i = typename no_cref<I>::type(), typename no_cref<J>::type j = typename no_cref<J>::type(),
+ typename no_cref<K>::type k = typename no_cref<K>::type(), typename no_cref<L>::type l = typename no_cref<L>::type(),
+ typename no_cref<M>::type m = typename no_cref<M>::type(), typename no_cref<N>::type n = typename no_cref<N>::type(),
typename no_cref<O>::type o = typename no_cref<O>::type(), typename no_cref<P>::type p = typename no_cref<P>::type())
: a(a), b(b), c(c), d(d), e(e), f(f), g(g), h(h), i(i), j(j), k(k), l(l), m(m), n(n), o(o), p(p)
{}
bool operator==(const base_tuple &bo) const {
const tuple<A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P> &to = (const tuple<A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P> &)bo;
return (comparer<A>::compare(a, to.a) &&
comparer<B>::compare(b, to.b) &&
comparer<C>::compare(c, to.c) &&
comparer<D>::compare(d, to.d) &&
@@ -564,267 +565,267 @@ T getNonvirtualMemberFunctionAddress(U u)
template <typename T>
int getFunctionIndex(T func) {
func_index idx;
return ((&idx)->*reinterpret_cast<int (func_index::*)()>(func))() * FUNCTION_STRIDE + FUNCTION_BASE;
}
// mock types
template <class T>
-class mock : public base_mock
+class mock : public base_mock
{
friend class MockRepository;
unsigned char remaining[sizeof(T)];
void NotImplemented() { throw NotImplementedException(repo); }
protected:
void *oldVft;
void (*funcs[VIRT_FUNC_LIMIT])();
MockRepository *repo;
public:
int funcMap[VIRT_FUNC_LIMIT];
- mock(MockRepository *repo)
+ mock(MockRepository *repo)
: repo(repo)
{
- for (int i = 0; i < VIRT_FUNC_LIMIT; i++)
+ for (int i = 0; i < VIRT_FUNC_LIMIT; i++)
{
funcs[i] = getNonvirtualMemberFunctionAddress<void (*)()>(&mock<T>::NotImplemented);
funcMap[i] = -1;
}
memset(remaining, 0, sizeof(remaining));
oldVft = base_mock::rewriteVft(funcs);
}
- int translateX(int x)
+ int translateX(int x)
{
- for (int i = 0; i < VIRT_FUNC_LIMIT; i++)
+ for (int i = 0; i < VIRT_FUNC_LIMIT; i++)
{
if (funcMap[i] == x) return i;
}
return -1;
}
};
template <class T>
class classMock : public mock<T>
{
void *backupVft;
public:
- classMock(MockRepository *repo)
+ classMock(MockRepository *repo)
: mock<T>(repo)
{
mock<T>::oldVft = base_mock::rewriteVft((void *)mock<T>::funcs);
new(this)T();
backupVft = base_mock::rewriteVft((void *)mock<T>::funcs);
}
~classMock()
{
base_mock::rewriteVft(backupVft);
((T *)this)->~T();
}
};
//Type-safe exception wrapping
-class ExceptionHolder
-{
+class ExceptionHolder
+{
public:
virtual ~ExceptionHolder() {}
- virtual void rethrow() = 0;
+ virtual void rethrow() = 0;
};
template <class T>
class ExceptionWrapper : public ExceptionHolder {
T exception;
public:
ExceptionWrapper(T exception) : exception(exception) {}
void rethrow() { throw exception; }
};
// Do() function wrapping
class VirtualDestructable { public: virtual ~VirtualDestructable() {} };
template <typename Y>
-class TupleInvocable : public VirtualDestructable
+class TupleInvocable : public VirtualDestructable
{
public:
virtual Y operator()(const base_tuple &tupl) = 0;
};
template <typename Y,
- typename A = NullType, typename B = NullType, typename C = NullType, typename D = NullType,
- typename E = NullType, typename F = NullType, typename G = NullType, typename H = NullType,
- typename I = NullType, typename J = NullType, typename K = NullType, typename L = NullType,
+ typename A = NullType, typename B = NullType, typename C = NullType, typename D = NullType,
+ typename E = NullType, typename F = NullType, typename G = NullType, typename H = NullType,
+ typename I = NullType, typename J = NullType, typename K = NullType, typename L = NullType,
typename M = NullType, typename N = NullType, typename O = NullType, typename P = NullType>
class Invocable : public TupleInvocable<Y>
{
public:
virtual Y operator()(A a = A(), B b = B(), C c = C(), D d = D(), E e = E(), F f = F(), G g = G(), H h = H(), I i = I(), J j = J(), K k = K(), L l = L(), M m = M(), N n = N(), O o = O(), P p = P()) = 0;
virtual Y operator()(const base_tuple &tupl) {
const tuple<A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P> &rTupl = reinterpret_cast<const tuple<A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P> &>(tupl);
- return (*this)(rTupl.a, rTupl.b, rTupl.c, rTupl.d, rTupl.e, rTupl.f, rTupl.g, rTupl.h,
+ return (*this)(rTupl.a, rTupl.b, rTupl.c, rTupl.d, rTupl.e, rTupl.f, rTupl.g, rTupl.h,
rTupl.i, rTupl.j, rTupl.k, rTupl.l, rTupl.m, rTupl.n, rTupl.o, rTupl.p);
}
};
template <typename T, typename Y,
- typename A, typename B, typename C, typename D,
- typename E, typename F, typename G, typename H,
- typename I, typename J, typename K, typename L,
+ typename A, typename B, typename C, typename D,
+ typename E, typename F, typename G, typename H,
+ typename I, typename J, typename K, typename L,
typename M, typename N, typename O, typename P>
class DoWrapper : public Invocable<Y,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P> {
T &t;
public:
DoWrapper(T &t) : t(t) {}
virtual Y operator()(A a, B b, C c, D d, E e, F f, G g, H h, I i, J j, K k, L l, M m, N n, O o, P p)
{
return t(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p);
}
using Invocable<Y,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P>::operator();
};
template <typename T, typename Y,
- typename A, typename B, typename C, typename D,
- typename E, typename F, typename G, typename H,
- typename I, typename J, typename K, typename L,
+ typename A, typename B, typename C, typename D,
+ typename E, typename F, typename G, typename H,
+ typename I, typename J, typename K, typename L,
typename M, typename N, typename O>
class DoWrapper<T,Y,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,NullType> : public Invocable<Y,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O> {
T &t;
public:
DoWrapper(T &t) : t(t) {}
virtual Y operator()(A a, B b, C c, D d, E e, F f, G g, H h, I i, J j, K k, L l, M m, N n, O o, NullType)
{
return t(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o);
}
using Invocable<Y,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O>::operator();
};
template <typename T, typename Y,
- typename A, typename B, typename C, typename D,
- typename E, typename F, typename G, typename H,
- typename I, typename J, typename K, typename L,
+ typename A, typename B, typename C, typename D,
+ typename E, typename F, typename G, typename H,
+ typename I, typename J, typename K, typename L,
typename M, typename N>
class DoWrapper<T,Y,A,B,C,D,E,F,G,H,I,J,K,L,M,N,NullType,NullType> : public Invocable<Y,A,B,C,D,E,F,G,H,I,J,K,L,M,N> {
T &t;
public:
DoWrapper(T &t) : t(t) {}
virtual Y operator()(A a, B b, C c, D d, E e, F f, G g, H h, I i, J j, K k, L l, M m, N n, NullType, NullType)
{
return t(a,b,c,d,e,f,g,h,i,j,k,l,m,n);
}
using Invocable<Y,A,B,C,D,E,F,G,H,I,J,K,L,M,N>::operator();
};
template <typename T, typename Y,
- typename A, typename B, typename C, typename D,
- typename E, typename F, typename G, typename H,
- typename I, typename J, typename K, typename L,
+ typename A, typename B, typename C, typename D,
+ typename E, typename F, typename G, typename H,
+ typename I, typename J, typename K, typename L,
typename M>
class DoWrapper<T,Y,A,B,C,D,E,F,G,H,I,J,K,L,M,NullType,NullType,NullType> : public Invocable<Y,A,B,C,D,E,F,G,H,I,J,K,L,M> {
T &t;
public:
DoWrapper(T &t) : t(t) {}
virtual Y operator()(A a, B b, C c, D d, E e, F f, G g, H h, I i, J j, K k, L l, M m, NullType, NullType, NullType)
{
return t(a,b,c,d,e,f,g,h,i,j,k,l,m);
}
using Invocable<Y,A,B,C,D,E,F,G,H,I,J,K,L,M>::operator();
};
template <typename T, typename Y,
- typename A, typename B, typename C, typename D,
- typename E, typename F, typename G, typename H,
+ typename A, typename B, typename C, typename D,
+ typename E, typename F, typename G, typename H,
typename I, typename J, typename K, typename L>
class DoWrapper<T,Y,A,B,C,D,E,F,G,H,I,J,K,L,NullType,NullType,NullType,NullType> : public Invocable<Y,A,B,C,D,E,F,G,H,I,J,K,L> {
T &t;
public:
DoWrapper(T &t) : t(t) {}
virtual Y operator()(A a, B b, C c, D d, E e, F f, G g, H h, I i, J j, K k, L l, NullType, NullType, NullType, NullType)
{
return t(a,b,c,d,e,f,g,h,i,j,k,l);
}
using Invocable<Y,A,B,C,D,E,F,G,H,I,J,K,L>::operator();
};
template <typename T, typename Y,
- typename A, typename B, typename C, typename D,
- typename E, typename F, typename G, typename H,
+ typename A, typename B, typename C, typename D,
+ typename E, typename F, typename G, typename H,
typename I, typename J, typename K>
class DoWrapper<T,Y,A,B,C,D,E,F,G,H,I,J,K,NullType,NullType,NullType,NullType,NullType> : public Invocable<Y,A,B,C,D,E,F,G,H,I,J,K> {
T &t;
public:
DoWrapper(T &t) : t(t) {}
virtual Y operator()(A a, B b, C c, D d, E e, F f, G g, H h, I i, J j, K k, NullType, NullType, NullType, NullType, NullType)
{
return t(a,b,c,d,e,f,g,h,i,j,k);
}
using Invocable<Y,A,B,C,D,E,F,G,H,I,J,K>::operator();
};
template <typename T, typename Y,
- typename A, typename B, typename C, typename D,
- typename E, typename F, typename G, typename H,
+ typename A, typename B, typename C, typename D,
+ typename E, typename F, typename G, typename H,
typename I, typename J>
class DoWrapper<T,Y,A,B,C,D,E,F,G,H,I,J,NullType,NullType,NullType,NullType,NullType,NullType> : public Invocable<Y,A,B,C,D,E,F,G,H,I,J> {
T &t;
public:
DoWrapper(T &t) : t(t) {}
virtual Y operator()(A a, B b, C c, D d, E e, F f, G g, H h, I i, J j, NullType, NullType, NullType, NullType, NullType, NullType)
{
return t(a,b,c,d,e,f,g,h,i,j);
}
using Invocable<Y,A,B,C,D,E,F,G,H,I,J>::operator();
};
template <typename T, typename Y,
- typename A, typename B, typename C, typename D,
- typename E, typename F, typename G, typename H,
+ typename A, typename B, typename C, typename D,
+ typename E, typename F, typename G, typename H,
typename I>
class DoWrapper<T,Y,A,B,C,D,E,F,G,H,I,NullType,NullType,NullType,NullType,NullType,NullType,NullType> : public Invocable<Y,A,B,C,D,E,F,G,H,I>{
T &t;
public:
DoWrapper(T &t) : t(t) {}
virtual Y operator()(A a, B b, C c, D d, E e, F f, G g, H h, I i, NullType, NullType, NullType, NullType, NullType, NullType, NullType)
{
return t(a,b,c,d,e,f,g,h,i);
}
using Invocable<Y,A,B,C,D,E,F,G,H,I>::operator();
};
template <typename T, typename Y,
- typename A, typename B, typename C, typename D,
+ typename A, typename B, typename C, typename D,
typename E, typename F, typename G, typename H>
class DoWrapper<T,Y,A,B,C,D,E,F,G,H,NullType,NullType,NullType,NullType,NullType,NullType,NullType,NullType> : public Invocable<Y,A,B,C,D,E,F,G,H> {
T &t;
public:
DoWrapper(T &t) : t(t) {}
virtual Y operator()(A a, B b, C c, D d, E e, F f, G g, H h, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType)
{
return t(a,b,c,d,e,f,g,h);
}
using Invocable<Y,A,B,C,D,E,F,G,H>::operator();
};
template <typename T, typename Y,
- typename A, typename B, typename C, typename D,
+ typename A, typename B, typename C, typename D,
typename E, typename F, typename G>
class DoWrapper<T,Y,A,B,C,D,E,F,G,NullType,NullType,NullType,NullType,NullType,NullType,NullType,NullType,NullType> : public Invocable<Y,A,B,C,D,E,F,G> {
T &t;
public:
DoWrapper(T &t) : t(t) {}
virtual Y operator()(A a, B b, C c, D d, E e, F f, G g, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType)
{
return t(a,b,c,d,e,f,g);
}
using Invocable<Y,A,B,C,D,E,F,G>::operator();
};
template <typename T, typename Y,
- typename A, typename B, typename C, typename D,
+ typename A, typename B, typename C, typename D,
typename E, typename F>
class DoWrapper<T,Y,A,B,C,D,E,F,NullType,NullType,NullType,NullType,NullType,NullType,NullType,NullType,NullType,NullType> : public Invocable<Y,A,B,C,D,E,F> {
T &t;
public:
DoWrapper(T &t) : t(t) {}
virtual Y operator()(A a, B b, C c, D d, E e, F f, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType)
{
return t(a,b,c,d,e,f);
}
using Invocable<Y,A,B,C,D,E,F>::operator();
};
template <typename T, typename Y,
- typename A, typename B, typename C, typename D,
+ typename A, typename B, typename C, typename D,
typename E>
class DoWrapper<T,Y,A,B,C,D,E,NullType,NullType,NullType,NullType,NullType,NullType,NullType,NullType,NullType,NullType,NullType> : public Invocable<Y,A,B,C,D,E> {
T &t;
public:
DoWrapper(T &t) : t(t) {}
virtual Y operator()(A a, B b, C c, D d, E e, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType)
{
return t(a,b,c,d,e);
}
@@ -910,90 +911,90 @@ public:
VirtualDestructable *functor;
int funcIndex;
std::list<Call *> previousCalls;
RegistrationType expectation;
bool satisfied;
int lineno;
const char *funcName;
const char *fileName;
protected:
- Call(RegistrationType expectation, base_mock *mock, int funcIndex, int X, const char *funcName, const char *fileName)
- : retVal(0),
- eHolder(0),
- mock(mock),
+ Call(RegistrationType expectation, base_mock *mock, int funcIndex, int X, const char *funcName, const char *fileName)
+ : retVal(0),
+ eHolder(0),
+ mock(mock),
functor(0),
- funcIndex(funcIndex),
+ funcIndex(funcIndex),
expectation(expectation),
satisfied(false),
lineno(X),
funcName(funcName),
fileName(fileName)
{
}
public:
virtual const base_tuple *getArgs() const = 0;
- virtual ~Call()
+ virtual ~Call()
{
delete eHolder;
delete functor;
delete retVal;
}
};
std::ostream &operator<<(std::ostream &os, const Call &call);
-template <typename Y,
- typename A = NullType, typename B = NullType, typename C = NullType, typename D = NullType,
- typename E = NullType, typename F = NullType, typename G = NullType, typename H = NullType,
- typename I = NullType, typename J = NullType, typename K = NullType, typename L = NullType,
+template <typename Y,
+ typename A = NullType, typename B = NullType, typename C = NullType, typename D = NullType,
+ typename E = NullType, typename F = NullType, typename G = NullType, typename H = NullType,
+ typename I = NullType, typename J = NullType, typename K = NullType, typename L = NullType,
typename M = NullType, typename N = NullType, typename O = NullType, typename P = NullType>
class TCall : public Call {
private:
tuple<A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P> *args;
public:
const base_tuple *getArgs() const { return args; }
TCall(RegistrationType expectation, base_mock *mock, int funcIndex, int X, const char *funcName, const char *fileName) : Call(expectation, mock, funcIndex, X, funcName, fileName), args(0) {}
~TCall() { delete args; }
bool matchesArgs(const base_tuple &tupl) { return !args || *args == reinterpret_cast<const tuple<A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P> &>(tupl); }
- TCall<Y,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P> &With(A a = A(), B b = B(), C c = C(), D d = D(), E e = E(), F f = F(), G g = G(), H h = H(), I i = I(), J j = J(), K k = K(), L l = L(), M m = M(), N n = N(), O o = O(), P p = P()) {
- args = new tuple<A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P>(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p);
- return *this;
+ TCall<Y,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P> &With(A a = A(), B b = B(), C c = C(), D d = D(), E e = E(), F f = F(), G g = G(), H h = H(), I i = I(), J j = J(), K k = K(), L l = L(), M m = M(), N n = N(), O o = O(), P p = P()) {
+ args = new tuple<A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P>(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p);
+ return *this;
}
- TCall<Y,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P> &After(Call &call) {
+ TCall<Y,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P> &After(Call &call) {
previousCalls.push_back(&call);
- return *this;
+ return *this;
}
template <typename T>
Call &Do(T &function) { functor = new DoWrapper<T,Y,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P>(function); return *this; }
Call &Return(Y obj) { retVal = new ReturnValueWrapper<Y>(obj); return *this; }
template <typename Ex>
Call &Throw(Ex exception) { eHolder = new ExceptionWrapper<Ex>(exception); return *this; }
};
-template <typename A, typename B, typename C, typename D,
- typename E, typename F, typename G, typename H,
- typename I, typename J, typename K, typename L,
+template <typename A, typename B, typename C, typename D,
+ typename E, typename F, typename G, typename H,
+ typename I, typename J, typename K, typename L,
typename M, typename N, typename O, typename P>
class TCall<void,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P> : public Call {
private:
tuple<A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P> *args;
public:
const base_tuple *getArgs() const { return args; }
TCall(RegistrationType expectation, base_mock *mock, int funcIndex, int X, const char *funcName, const char *fileName) : Call(expectation, mock, funcIndex, X, funcName, fileName), args(0) {}
~TCall() { delete args; }
bool matchesArgs(const base_tuple &tupl) { return (!args) || (*args == reinterpret_cast<const tuple<A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P> &>(tupl)); }
- TCall<void,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P> &With(A a = A(), B b = B(), C c = C(), D d = D(), E e = E(), F f = F(), G g = G(), H h = H(), I i = I(), J j = J(), K k = K(), L l = L(), M m = M(), N n = N(), O o = O(), P p = P()) {
- args = new tuple<A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P>(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p);
- return *this;
+ TCall<void,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P> &With(A a = A(), B b = B(), C c = C(), D d = D(), E e = E(), F f = F(), G g = G(), H h = H(), I i = I(), J j = J(), K k = K(), L l = L(), M m = M(), N n = N(), O o = O(), P p = P()) {
+ args = new tuple<A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P>(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p);
+ return *this;
}
- TCall<void,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P> &After(Call &call) {
+ TCall<void,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P> &After(Call &call) {
previousCalls.push_back(&call);
- return *this;
+ return *this;
}
template <typename T>
Call &Do(T &function) { functor = new DoWrapper<T,void,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P>(function); return *this; }
template <typename Ex>
Call &Throw(Ex exception) { eHolder = new ExceptionWrapper<Ex>(exception); return *this; }
};
class MockRepository {
private:
@@ -1017,319 +1018,319 @@ public:
#define NeverCall(obj, func) RegisterExpect_<__LINE__, Never>(obj, &func, #func, __FILE__, __LINE__)
#define OnCallOverload(obj, func) RegisterExpect_<__LINE__, DontCare>(obj, func, #func, __FILE__, __LINE__)
#define ExpectCallOverload(obj, func) RegisterExpect_<__LINE__, Once>(obj, func, #func, __FILE__, __LINE__)
#define NeverCallOverload(obj, func) RegisterExpect_<__LINE__, Never>(obj, func, #func, __FILE__, __LINE__)
#endif
template <int X, RegistrationType expect, typename Z2, typename Y, typename Z>
TCall<Y> &RegisterExpect_(Z2 *mck, Y (Z::*func)(), const char *funcName, const char *fileName, unsigned long lineNo);
template <int X, RegistrationType expect, typename Z2, typename Y, typename Z, typename A>
TCall<Y,A> &RegisterExpect_(Z2 *mck, Y (Z::*func)(A), const char *funcName, const char *fileName, unsigned long lineNo);
- template <int X, RegistrationType expect, typename Z2, typename Y, typename Z,
+ template <int X, RegistrationType expect, typename Z2, typename Y, typename Z,
typename A, typename B>
TCall<Y,A,B> &RegisterExpect_(Z2 *mck, Y (Z::*func)(A,B), const char *funcName, const char *fileName, unsigned long lineNo);
- template <int X, RegistrationType expect, typename Z2, typename Y, typename Z,
+ template <int X, RegistrationType expect, typename Z2, typename Y, typename Z,
typename A, typename B, typename C>
TCall<Y,A,B,C> &RegisterExpect_(Z2 *mck, Y (Z::*func)(A,B,C), const char *funcName, const char *fileName, unsigned long lineNo);
- template <int X, RegistrationType expect, typename Z2, typename Y, typename Z,
+ template <int X, RegistrationType expect, typename Z2, typename Y, typename Z,
typename A, typename B, typename C, typename D>
TCall<Y,A,B,C,D> &RegisterExpect_(Z2 *mck, Y (Z::*func)(A,B,C,D), const char *funcName, const char *fileName, unsigned long lineNo);
- template <int X, RegistrationType expect, typename Z2, typename Y, typename Z,
- typename A, typename B, typename C, typename D,
+ template <int X, RegistrationType expect, typename Z2, typename Y, typename Z,
+ typename A, typename B, typename C, typename D,
typename E>
TCall<Y,A,B,C,D,E> &RegisterExpect_(Z2 *mck, Y (Z::*func)(A,B,C,D,E), const char *funcName, const char *fileName, unsigned long lineNo);
- template <int X, RegistrationType expect, typename Z2, typename Y, typename Z,
- typename A, typename B, typename C, typename D,
+ template <int X, RegistrationType expect, typename Z2, typename Y, typename Z,
+ typename A, typename B, typename C, typename D,
typename E, typename F>
TCall<Y,A,B,C,D,E,F> &RegisterExpect_(Z2 *mck, Y (Z::*func)(A,B,C,D,E,F), const char *funcName, const char *fileName, unsigned long lineNo);
- template <int X, RegistrationType expect, typename Z2, typename Y, typename Z,
- typename A, typename B, typename C, typename D,
+ template <int X, RegistrationType expect, typename Z2, typename Y, typename Z,
+ typename A, typename B, typename C, typename D,
typename E, typename F, typename G>
TCall<Y,A,B,C,D,E,F,G> &RegisterExpect_(Z2 *mck, Y (Z::*func)(A,B,C,D,E,F,G), const char *funcName, const char *fileName, unsigned long lineNo);
- template <int X, RegistrationType expect, typename Z2, typename Y, typename Z,
- typename A, typename B, typename C, typename D,
+ template <int X, RegistrationType expect, typename Z2, typename Y, typename Z,
+ typename A, typename B, typename C, typename D,
typename E, typename F, typename G, typename H>
TCall<Y,A,B,C,D,E,F,G,H> &RegisterExpect_(Z2 *mck, Y (Z::*func)(A,B,C,D,E,F,G,H), const char *funcName, const char *fileName, unsigned long lineNo);
- template <int X, RegistrationType expect, typename Z2, typename Y, typename Z,
- typename A, typename B, typename C, typename D,
+ template <int X, RegistrationType expect, typename Z2, typename Y, typename Z,
+ typename A, typename B, typename C, typename D,
typename E, typename F, typename G, typename H,
typename I>
TCall<Y,A,B,C,D,E,F,G,H,I> &RegisterExpect_(Z2 *mck, Y (Z::*func)(A,B,C,D,E,F,G,H,I), const char *funcName, const char *fileName, unsigned long lineNo);
- template <int X, RegistrationType expect, typename Z2, typename Y, typename Z,
- typename A, typename B, typename C, typename D,
+ template <int X, RegistrationType expect, typename Z2, typename Y, typename Z,
+ typename A, typename B, typename C, typename D,
typename E, typename F, typename G, typename H,
typename I, typename J>
TCall<Y,A,B,C,D,E,F,G,H,I,J> &RegisterExpect_(Z2 *mck, Y (Z::*func)(A,B,C,D,E,F,G,H,I,J), const char *funcName, const char *fileName, unsigned long lineNo);
- template <int X, RegistrationType expect, typename Z2, typename Y, typename Z,
- typename A, typename B, typename C, typename D,
+ template <int X, RegistrationType expect, typename Z2, typename Y, typename Z,
+ typename A, typename B, typename C, typename D,
typename E, typename F, typename G, typename H,
typename I, typename J, typename K>
TCall<Y,A,B,C,D,E,F,G,H,I,J,K> &RegisterExpect_(Z2 *mck, Y (Z::*func)(A,B,C,D,E,F,G,H,I,J,K), const char *funcName, const char *fileName, unsigned long lineNo);
- template <int X, RegistrationType expect, typename Z2, typename Y, typename Z,
- typename A, typename B, typename C, typename D,
+ template <int X, RegistrationType expect, typename Z2, typename Y, typename Z,
+ typename A, typename B, typename C, typename D,
typename E, typename F, typename G, typename H,
typename I, typename J, typename K, typename L>
TCall<Y,A,B,C,D,E,F,G,H,I,J,K,L> &RegisterExpect_(Z2 *mck, Y (Z::*func)(A,B,C,D,E,F,G,H,I,J,K,L), const char *funcName, const char *fileName, unsigned long lineNo);
- template <int X, RegistrationType expect, typename Z2, typename Y, typename Z,
- typename A, typename B, typename C, typename D,
+ template <int X, RegistrationType expect, typename Z2, typename Y, typename Z,
+ typename A, typename B, typename C, typename D,
typename E, typename F, typename G, typename H,
typename I, typename J, typename K, typename L,
typename M>
TCall<Y,A,B,C,D,E,F,G,H,I,J,K,L,M> &RegisterExpect_(Z2 *mck, Y (Z::*func)(A,B,C,D,E,F,G,H,I,J,K,L,M), const char *funcName, const char *fileName, unsigned long lineNo);
- template <int X, RegistrationType expect, typename Z2, typename Y, typename Z,
- typename A, typename B, typename C, typename D,
+ template <int X, RegistrationType expect, typename Z2, typename Y, typename Z,
+ typename A, typename B, typename C, typename D,
typename E, typename F, typename G, typename H,
typename I, typename J, typename K, typename L,
typename M, typename N>
TCall<Y,A,B,C,D,E,F,G,H,I,J,K,L,M,N> &RegisterExpect_(Z2 *mck, Y (Z::*func)(A,B,C,D,E,F,G,H,I,J,K,L,M,N), const char *funcName, const char *fileName, unsigned long lineNo);
- template <int X, RegistrationType expect, typename Z2, typename Y, typename Z,
- typename A, typename B, typename C, typename D,
+ template <int X, RegistrationType expect, typename Z2, typename Y, typename Z,
+ typename A, typename B, typename C, typename D,
typename E, typename F, typename G, typename H,
typename I, typename J, typename K, typename L,
typename M, typename N, typename O>
TCall<Y,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O> &RegisterExpect_(Z2 *mck, Y (Z::*func)(A,B,C,D,E,F,G,H,I,J,K,L,M,N,O), const char *funcName, const char *fileName, unsigned long lineNo);
- template <int X, RegistrationType expect, typename Z2, typename Y, typename Z,
- typename A, typename B, typename C, typename D,
+ template <int X, RegistrationType expect, typename Z2, typename Y, typename Z,
+ typename A, typename B, typename C, typename D,
typename E, typename F, typename G, typename H,
typename I, typename J, typename K, typename L,
typename M, typename N, typename O, typename P>
TCall<Y,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P> &RegisterExpect_(Z2 *mck, Y (Z::*func)(A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P), const char *funcName, const char *fileName, unsigned long lineNo);
//GCC 3.x doesn't seem to understand overloading on const or non-const member function. Volatile appears to work though.
#if !defined(__GNUC__) || __GNUC__ > 3
template <int X, RegistrationType expect, typename Z2, typename Y, typename Z>
TCall<Y> &RegisterExpect_(Z2 *mck, Y (Z::*func)() volatile, const char *funcName, const char *fileName, unsigned long lineNo) { return RegisterExpect_<X,expect>(mck, (Y(Z::*)())(func), funcName, fileName, lineNo); }
template <int X, RegistrationType expect, typename Z2, typename Y, typename Z, typename A>
TCall<Y,A> &RegisterExpect_(Z2 *mck, Y (Z::*func)(A) volatile, const char *funcName, const char *fileName, unsigned long lineNo) { return RegisterExpect_<X,expect>(mck, (Y(Z::*)(A))(func), funcName, fileName, lineNo); }
- template <int X, RegistrationType expect, typename Z2, typename Y, typename Z,
+ template <int X, RegistrationType expect, typename Z2, typename Y, typename Z,
typename A, typename B>
TCall<Y,A,B> &RegisterExpect_(Z2 *mck, Y (Z::*func)(A,B) volatile, const char *funcName, const char *fileName, unsigned long lineNo) { return RegisterExpect_<X,expect>(mck, (Y(Z::*)(A,B))(func), funcName, fileName, lineNo); }
- template <int X, RegistrationType expect, typename Z2, typename Y, typename Z,
+ template <int X, RegistrationType expect, typename Z2, typename Y, typename Z,
typename A, typename B, typename C>
TCall<Y,A,B,C> &RegisterExpect_(Z2 *mck, Y (Z::*func)(A,B,C) volatile, const char *funcName, const char *fileName, unsigned long lineNo) { return RegisterExpect_<X,expect>(mck, (Y(Z::*)(A,B,C))(func), funcName, fileName, lineNo); }
- template <int X, RegistrationType expect, typename Z2, typename Y, typename Z,
+ template <int X, RegistrationType expect, typename Z2, typename Y, typename Z,
typename A, typename B, typename C, typename D>
TCall<Y,A,B,C,D> &RegisterExpect_(Z2 *mck, Y (Z::*func)(A,B,C,D) volatile, const char *funcName, const char *fileName, unsigned long lineNo) { return RegisterExpect_<X,expect>(mck, (Y(Z::*)(A,B,C,D))(func), funcName, fileName, lineNo); }
- template <int X, RegistrationType expect, typename Z2, typename Y, typename Z,
- typename A, typename B, typename C, typename D,
+ template <int X, RegistrationType expect, typename Z2, typename Y, typename Z,
+ typename A, typename B, typename C, typename D,
typename E>
TCall<Y,A,B,C,D,E> &RegisterExpect_(Z2 *mck, Y (Z::*func)(A,B,C,D,E) volatile, const char *funcName, const char *fileName, unsigned long lineNo) { return RegisterExpect_<X,expect>(mck, (Y(Z::*)(A,B,C,D,E))(func), funcName, fileName, lineNo); }
- template <int X, RegistrationType expect, typename Z2, typename Y, typename Z,
- typename A, typename B, typename C, typename D,
+ template <int X, RegistrationType expect, typename Z2, typename Y, typename Z,
+ typename A, typename B, typename C, typename D,
typename E, typename F>
TCall<Y,A,B,C,D,E,F> &RegisterExpect_(Z2 *mck, Y (Z::*func)(A,B,C,D,E,F) volatile, const char *funcName, const char *fileName, unsigned long lineNo) { return RegisterExpect_<X,expect>(mck, (Y(Z::*)(A,B,C,D,E,F))(func), funcName, fileName, lineNo); }
- template <int X, RegistrationType expect, typename Z2, typename Y, typename Z,
- typename A, typename B, typename C, typename D,
+ template <int X, RegistrationType expect, typename Z2, typename Y, typename Z,
+ typename A, typename B, typename C, typename D,
typename E, typename F, typename G>
TCall<Y,A,B,C,D,E,F,G> &RegisterExpect_(Z2 *mck, Y (Z::*func)(A,B,C,D,E,F,G) volatile, const char *funcName, const char *fileName, unsigned long lineNo) { return RegisterExpect_<X,expect>(mck, (Y(Z::*)(A,B,C,D,E,F,G))(func), funcName, fileName, lineNo); }
- template <int X, RegistrationType expect, typename Z2, typename Y, typename Z,
- typename A, typename B, typename C, typename D,
+ template <int X, RegistrationType expect, typename Z2, typename Y, typename Z,
+ typename A, typename B, typename C, typename D,
typename E, typename F, typename G, typename H>
TCall<Y,A,B,C,D,E,F,G,H> &RegisterExpect_(Z2 *mck, Y (Z::*func)(A,B,C,D,E,F,G,H) volatile, const char *funcName, const char *fileName, unsigned long lineNo) { return RegisterExpect_<X,expect>(mck, (Y(Z::*)(A,B,C,D,E,F,G,H))(func), funcName, fileName, lineNo); }
- template <int X, RegistrationType expect, typename Z2, typename Y, typename Z,
- typename A, typename B, typename C, typename D,
+ template <int X, RegistrationType expect, typename Z2, typename Y, typename Z,
+ typename A, typename B, typename C, typename D,
typename E, typename F, typename G, typename H,
typename I>
TCall<Y,A,B,C,D,E,F,G,H,I> &RegisterExpect_(Z2 *mck, Y (Z::*func)(A,B,C,D,E,F,G,H,I) volatile, const char *funcName, const char *fileName, unsigned long lineNo) { return RegisterExpect_<X,expect>(mck, (Y(Z::*)(A,B,C,D,E,F,G,H,I))(func), funcName, fileName, lineNo); }
- template <int X, RegistrationType expect, typename Z2, typename Y, typename Z,
- typename A, typename B, typename C, typename D,
+ template <int X, RegistrationType expect, typename Z2, typename Y, typename Z,
+ typename A, typename B, typename C, typename D,
typename E, typename F, typename G, typename H,
typename I, typename J>
TCall<Y,A,B,C,D,E,F,G,H,I,J> &RegisterExpect_(Z2 *mck, Y (Z::*func)(A,B,C,D,E,F,G,H,I,J) volatile, const char *funcName, const char *fileName, unsigned long lineNo) { return RegisterExpect_<X,expect>(mck, (Y(Z::*)(A,B,C,D,E,F,G,H,I,J))(func), funcName, fileName, lineNo); }
- template <int X, RegistrationType expect, typename Z2, typename Y, typename Z,
- typename A, typename B, typename C, typename D,
+ template <int X, RegistrationType expect, typename Z2, typename Y, typename Z,
+ typename A, typename B, typename C, typename D,
typename E, typename F, typename G, typename H,
typename I, typename J, typename K>
TCall<Y,A,B,C,D,E,F,G,H,I,J,K> &RegisterExpect_(Z2 *mck, Y (Z::*func)(A,B,C,D,E,F,G,H,I,J,K) volatile, const char *funcName, const char *fileName, unsigned long lineNo) { return RegisterExpect_<X,expect>(mck, (Y(Z::*)(A,B,C,D,E,F,G,H,I,J,K))(func), funcName, fileName, lineNo); }
- template <int X, RegistrationType expect, typename Z2, typename Y, typename Z,
- typename A, typename B, typename C, typename D,
+ template <int X, RegistrationType expect, typename Z2, typename Y, typename Z,
+ typename A, typename B, typename C, typename D,
typename E, typename F, typename G, typename H,
typename I, typename J, typename K, typename L>
TCall<Y,A,B,C,D,E,F,G,H,I,J,K,L> &RegisterExpect_(Z2 *mck, Y (Z::*func)(A,B,C,D,E,F,G,H,I,J,K,L) volatile, const char *funcName, const char *fileName, unsigned long lineNo) { return RegisterExpect_<X,expect>(mck, (Y(Z::*)(A,B,C,D,E,F,G,H,I,J,K,L))(func), funcName, fileName, lineNo); }
- template <int X, RegistrationType expect, typename Z2, typename Y, typename Z,
- typename A, typename B, typename C, typename D,
+ template <int X, RegistrationType expect, typename Z2, typename Y, typename Z,
+ typename A, typename B, typename C, typename D,
typename E, typename F, typename G, typename H,
typename I, typename J, typename K, typename L,
typename M>
TCall<Y,A,B,C,D,E,F,G,H,I,J,K,L,M> &RegisterExpect_(Z2 *mck, Y (Z::*func)(A,B,C,D,E,F,G,H,I,J,K,L,M) volatile, const char *funcName, const char *fileName, unsigned long lineNo) { return RegisterExpect_<X,expect>(mck, (Y(Z::*)(A,B,C,D,E,F,G,H,I,J,K,L,M))(func), funcName, fileName, lineNo); }
- template <int X, RegistrationType expect, typename Z2, typename Y, typename Z,
- typename A, typename B, typename C, typename D,
+ template <int X, RegistrationType expect, typename Z2, typename Y, typename Z,
+ typename A, typename B, typename C, typename D,
typename E, typename F, typename G, typename H,
typename I, typename J, typename K, typename L,
typename M, typename N>
TCall<Y,A,B,C,D,E,F,G,H,I,J,K,L,M,N> &RegisterExpect_(Z2 *mck, Y (Z::*func)(A,B,C,D,E,F,G,H,I,J,K,L,M,N) volatile, const char *funcName, const char *fileName, unsigned long lineNo) { return RegisterExpect_<X,expect>(mck, (Y(Z::*)(A,B,C,D,E,F,G,H,I,J,K,L,M,N))(func), funcName, fileName, lineNo); }
- template <int X, RegistrationType expect, typename Z2, typename Y, typename Z,
- typename A, typename B, typename C, typename D,
+ template <int X, RegistrationType expect, typename Z2, typename Y, typename Z,
+ typename A, typename B, typename C, typename D,
typename E, typename F, typename G, typename H,
typename I, typename J, typename K, typename L,
typename M, typename N, typename O>
TCall<Y,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O> &RegisterExpect_(Z2 *mck, Y (Z::*func)(A,B,C,D,E,F,G,H,I,J,K,L,M,N,O) volatile, const char *funcName, const char *fileName, unsigned long lineNo) { return RegisterExpect_<X,expect>(mck, (Y(Z::*)(A,B,C,D,E,F,G,H,I,J,K,L,M,N,O))(func), funcName, fileName, lineNo); }
- template <int X, RegistrationType expect, typename Z2, typename Y, typename Z,
- typename A, typename B, typename C, typename D,
+ template <int X, RegistrationType expect, typename Z2, typename Y, typename Z,
+ typename A, typename B, typename C, typename D,
typename E, typename F, typename G, typename H,
typename I, typename J, typename K, typename L,
typename M, typename N, typename O, typename P>
TCall<Y,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P> &RegisterExpect_(Z2 *mck, Y (Z::*func)(A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P) volatile, const char *funcName, const char *fileName, unsigned long lineNo) { return RegisterExpect_<X,expect>(mck, (Y(Z::*)(A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P))(func), funcName, fileName, lineNo); }
template <int X, RegistrationType expect, typename Z2, typename Y, typename Z>
TCall<Y> &RegisterExpect_(Z2 *mck, Y (Z::*func)() const volatile, const char *funcName, const char *fileName, unsigned long lineNo) { return RegisterExpect_<X,expect>(mck, (Y(Z::*)())(func), funcName, fileName, lineNo); }
template <int X, RegistrationType expect, typename Z2, typename Y, typename Z, typename A>
TCall<Y,A> &RegisterExpect_(Z2 *mck, Y (Z::*func)(A) const volatile, const char *funcName, const char *fileName, unsigned long lineNo) { return RegisterExpect_<X,expect>(mck, (Y(Z::*)(A))(func), funcName, fileName, lineNo); }
- template <int X, RegistrationType expect, typename Z2, typename Y, typename Z,
+ template <int X, RegistrationType expect, typename Z2, typename Y, typename Z,
typename A, typename B>
TCall<Y,A,B> &RegisterExpect_(Z2 *mck, Y (Z::*func)(A,B) const volatile, const char *funcName, const char *fileName, unsigned long lineNo) { return RegisterExpect_<X,expect>(mck, (Y(Z::*)(A,B))(func), funcName, fileName, lineNo); }
- template <int X, RegistrationType expect, typename Z2, typename Y, typename Z,
+ template <int X, RegistrationType expect, typename Z2, typename Y, typename Z,
typename A, typename B, typename C>
TCall<Y,A,B,C> &RegisterExpect_(Z2 *mck, Y (Z::*func)(A,B,C) const volatile, const char *funcName, const char *fileName, unsigned long lineNo) { return RegisterExpect_<X,expect>(mck, (Y(Z::*)(A,B,C))(func), funcName, fileName, lineNo); }
- template <int X, RegistrationType expect, typename Z2, typename Y, typename Z,
+ template <int X, RegistrationType expect, typename Z2, typename Y, typename Z,
typename A, typename B, typename C, typename D>
TCall<Y,A,B,C,D> &RegisterExpect_(Z2 *mck, Y (Z::*func)(A,B,C,D) const volatile, const char *funcName, const char *fileName, unsigned long lineNo) { return RegisterExpect_<X,expect>(mck, (Y(Z::*)(A,B,C,D))(func), funcName, fileName, lineNo); }
- template <int X, RegistrationType expect, typename Z2, typename Y, typename Z,
- typename A, typename B, typename C, typename D,
+ template <int X, RegistrationType expect, typename Z2, typename Y, typename Z,
+ typename A, typename B, typename C, typename D,
typename E>
TCall<Y,A,B,C,D,E> &RegisterExpect_(Z2 *mck, Y (Z::*func)(A,B,C,D,E) const volatile, const char *funcName, const char *fileName, unsigned long lineNo) { return RegisterExpect_<X,expect>(mck, (Y(Z::*)(A,B,C,D,E))(func), funcName, fileName, lineNo); }
- template <int X, RegistrationType expect, typename Z2, typename Y, typename Z,
- typename A, typename B, typename C, typename D,
+ template <int X, RegistrationType expect, typename Z2, typename Y, typename Z,
+ typename A, typename B, typename C, typename D,
typename E, typename F>
TCall<Y,A,B,C,D,E,F> &RegisterExpect_(Z2 *mck, Y (Z::*func)(A,B,C,D,E,F) const volatile, const char *funcName, const char *fileName, unsigned long lineNo) { return RegisterExpect_<X,expect>(mck, (Y(Z::*)(A,B,C,D,E,F))(func), funcName, fileName, lineNo); }
- template <int X, RegistrationType expect, typename Z2, typename Y, typename Z,
- typename A, typename B, typename C, typename D,
+ template <int X, RegistrationType expect, typename Z2, typename Y, typename Z,
+ typename A, typename B, typename C, typename D,
typename E, typename F, typename G>
TCall<Y,A,B,C,D,E,F,G> &RegisterExpect_(Z2 *mck, Y (Z::*func)(A,B,C,D,E,F,G) const volatile, const char *funcName, const char *fileName, unsigned long lineNo) { return RegisterExpect_<X,expect>(mck, (Y(Z::*)(A,B,C,D,E,F,G))(func), funcName, fileName, lineNo); }
- template <int X, RegistrationType expect, typename Z2, typename Y, typename Z,
- typename A, typename B, typename C, typename D,
+ template <int X, RegistrationType expect, typename Z2, typename Y, typename Z,
+ typename A, typename B, typename C, typename D,
typename E, typename F, typename G, typename H>
TCall<Y,A,B,C,D,E,F,G,H> &RegisterExpect_(Z2 *mck, Y (Z::*func)(A,B,C,D,E,F,G,H) const volatile, const char *funcName, const char *fileName, unsigned long lineNo) { return RegisterExpect_<X,expect>(mck, (Y(Z::*)(A,B,C,D,E,F,G,H))(func), funcName, fileName, lineNo); }
- template <int X, RegistrationType expect, typename Z2, typename Y, typename Z,
- typename A, typename B, typename C, typename D,
+ template <int X, RegistrationType expect, typename Z2, typename Y, typename Z,
+ typename A, typename B, typename C, typename D,
typename E, typename F, typename G, typename H,
typename I>
TCall<Y,A,B,C,D,E,F,G,H,I> &RegisterExpect_(Z2 *mck, Y (Z::*func)(A,B,C,D,E,F,G,H,I) const volatile, const char *funcName, const char *fileName, unsigned long lineNo) { return RegisterExpect_<X,expect>(mck, (Y(Z::*)(A,B,C,D,E,F,G,H,I))(func), funcName, fileName, lineNo); }
- template <int X, RegistrationType expect, typename Z2, typename Y, typename Z,
- typename A, typename B, typename C, typename D,
+ template <int X, RegistrationType expect, typename Z2, typename Y, typename Z,
+ typename A, typename B, typename C, typename D,
typename E, typename F, typename G, typename H,
typename I, typename J>
TCall<Y,A,B,C,D,E,F,G,H,I,J> &RegisterExpect_(Z2 *mck, Y (Z::*func)(A,B,C,D,E,F,G,H,I,J) const volatile, const char *funcName, const char *fileName, unsigned long lineNo) { return RegisterExpect_<X,expect>(mck, (Y(Z::*)(A,B,C,D,E,F,G,H,I,J))(func), funcName, fileName, lineNo); }
- template <int X, RegistrationType expect, typename Z2, typename Y, typename Z,
- typename A, typename B, typename C, typename D,
+ template <int X, RegistrationType expect, typename Z2, typename Y, typename Z,
+ typename A, typename B, typename C, typename D,
typename E, typename F, typename G, typename H,
typename I, typename J, typename K>
TCall<Y,A,B,C,D,E,F,G,H,I,J,K> &RegisterExpect_(Z2 *mck, Y (Z::*func)(A,B,C,D,E,F,G,H,I,J,K) const volatile, const char *funcName, const char *fileName, unsigned long lineNo) { return RegisterExpect_<X,expect>(mck, (Y(Z::*)(A,B,C,D,E,F,G,H,I,J,K))(func), funcName, fileName, lineNo); }
- template <int X, RegistrationType expect, typename Z2, typename Y, typename Z,
- typename A, typename B, typename C, typename D,
+ template <int X, RegistrationType expect, typename Z2, typename Y, typename Z,
+ typename A, typename B, typename C, typename D,
typename E, typename F, typename G, typename H,
typename I, typename J, typename K, typename L>
TCall<Y,A,B,C,D,E,F,G,H,I,J,K,L> &RegisterExpect_(Z2 *mck, Y (Z::*func)(A,B,C,D,E,F,G,H,I,J,K,L) const volatile, const char *funcName, const char *fileName, unsigned long lineNo) { return RegisterExpect_<X,expect>(mck, (Y(Z::*)(A,B,C,D,E,F,G,H,I,J,K,L))(func), funcName, fileName, lineNo); }
- template <int X, RegistrationType expect, typename Z2, typename Y, typename Z,
- typename A, typename B, typename C, typename D,
+ template <int X, RegistrationType expect, typename Z2, typename Y, typename Z,
+ typename A, typename B, typename C, typename D,
typename E, typename F, typename G, typename H,
typename I, typename J, typename K, typename L,
typename M>
TCall<Y,A,B,C,D,E,F,G,H,I,J,K,L,M> &RegisterExpect_(Z2 *mck, Y (Z::*func)(A,B,C,D,E,F,G,H,I,J,K,L,M) const volatile, const char *funcName, const char *fileName, unsigned long lineNo) { return RegisterExpect_<X,expect>(mck, (Y(Z::*)(A,B,C,D,E,F,G,H,I,J,K,L,M))(func), funcName, fileName, lineNo); }
- template <int X, RegistrationType expect, typename Z2, typename Y, typename Z,
- typename A, typename B, typename C, typename D,
+ template <int X, RegistrationType expect, typename Z2, typename Y, typename Z,
+ typename A, typename B, typename C, typename D,
typename E, typename F, typename G, typename H,
typename I, typename J, typename K, typename L,
typename M, typename N>
TCall<Y,A,B,C,D,E,F,G,H,I,J,K,L,M,N> &RegisterExpect_(Z2 *mck, Y (Z::*func)(A,B,C,D,E,F,G,H,I,J,K,L,M,N) const volatile, const char *funcName, const char *fileName, unsigned long lineNo) { return RegisterExpect_<X,expect>(mck, (Y(Z::*)(A,B,C,D,E,F,G,H,I,J,K,L,M,N))(func), funcName, fileName, lineNo); }
- template <int X, RegistrationType expect, typename Z2, typename Y, typename Z,
- typename A, typename B, typename C, typename D,
+ template <int X, RegistrationType expect, typename Z2, typename Y, typename Z,
+ typename A, typename B, typename C, typename D,
typename E, typename F, typename G, typename H,
typename I, typename J, typename K, typename L,
typename M, typename N, typename O>
TCall<Y,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O> &RegisterExpect_(Z2 *mck, Y (Z::*func)(A,B,C,D,E,F,G,H,I,J,K,L,M,N,O) const volatile, const char *funcName, const char *fileName, unsigned long lineNo) { return RegisterExpect_<X,expect>(mck, (Y(Z::*)(A,B,C,D,E,F,G,H,I,J,K,L,M,N,O))(func), funcName, fileName, lineNo); }
- template <int X, RegistrationType expect, typename Z2, typename Y, typename Z,
- typename A, typename B, typename C, typename D,
+ template <int X, RegistrationType expect, typename Z2, typename Y, typename Z,
+ typename A, typename B, typename C, typename D,
typename E, typename F, typename G, typename H,
typename I, typename J, typename K, typename L,
typename M, typename N, typename O, typename P>
TCall<Y,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P> &RegisterExpect_(Z2 *mck, Y (Z::*func)(A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P) const volatile, const char *funcName, const char *fileName, unsigned long lineNo) { return RegisterExpect_<X,expect>(mck, (Y(Z::*)(A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P))(func), funcName, fileName, lineNo); }
template <int X, RegistrationType expect, typename Z2, typename Y, typename Z>
TCall<Y> &RegisterExpect_(Z2 *mck, Y (Z::*func)() const, const char *funcName, const char *fileName, unsigned long lineNo) { return RegisterExpect_<X,expect>(mck, (Y(Z::*)())(func), funcName, fileName, lineNo); }
template <int X, RegistrationType expect, typename Z2, typename Y, typename Z, typename A>
TCall<Y,A> &RegisterExpect_(Z2 *mck, Y (Z::*func)(A) const, const char *funcName, const char *fileName, unsigned long lineNo) { return RegisterExpect_<X,expect>(mck, (Y(Z::*)(A))(func), funcName, fileName, lineNo); }
- template <int X, RegistrationType expect, typename Z2, typename Y, typename Z,
+ template <int X, RegistrationType expect, typename Z2, typename Y, typename Z,
typename A, typename B>
TCall<Y,A,B> &RegisterExpect_(Z2 *mck, Y (Z::*func)(A,B) const, const char *funcName, const char *fileName, unsigned long lineNo) { return RegisterExpect_<X,expect>(mck, (Y(Z::*)(A,B))(func), funcName, fileName, lineNo); }
- template <int X, RegistrationType expect, typename Z2, typename Y, typename Z,
+ template <int X, RegistrationType expect, typename Z2, typename Y, typename Z,
typename A, typename B, typename C>
TCall<Y,A,B,C> &RegisterExpect_(Z2 *mck, Y (Z::*func)(A,B,C) const, const char *funcName, const char *fileName, unsigned long lineNo) { return RegisterExpect_<X,expect>(mck, (Y(Z::*)(A,B,C))(func), funcName, fileName, lineNo); }
- template <int X, RegistrationType expect, typename Z2, typename Y, typename Z,
+ template <int X, RegistrationType expect, typename Z2, typename Y, typename Z,
typename A, typename B, typename C, typename D>
TCall<Y,A,B,C,D> &RegisterExpect_(Z2 *mck, Y (Z::*func)(A,B,C,D) const, const char *funcName, const char *fileName, unsigned long lineNo) { return RegisterExpect_<X,expect>(mck, (Y(Z::*)(A,B,C,D))(func), funcName, fileName, lineNo); }
- template <int X, RegistrationType expect, typename Z2, typename Y, typename Z,
- typename A, typename B, typename C, typename D,
+ template <int X, RegistrationType expect, typename Z2, typename Y, typename Z,
+ typename A, typename B, typename C, typename D,
typename E>
TCall<Y,A,B,C,D,E> &RegisterExpect_(Z2 *mck, Y (Z::*func)(A,B,C,D,E) const, const char *funcName, const char *fileName, unsigned long lineNo) { return RegisterExpect_<X,expect>(mck, (Y(Z::*)(A,B,C,D,E))(func), funcName, fileName, lineNo); }
- template <int X, RegistrationType expect, typename Z2, typename Y, typename Z,
- typename A, typename B, typename C, typename D,
+ template <int X, RegistrationType expect, typename Z2, typename Y, typename Z,
+ typename A, typename B, typename C, typename D,
typename E, typename F>
TCall<Y,A,B,C,D,E,F> &RegisterExpect_(Z2 *mck, Y (Z::*func)(A,B,C,D,E,F) const, const char *funcName, const char *fileName, unsigned long lineNo) { return RegisterExpect_<X,expect>(mck, (Y(Z::*)(A,B,C,D,E,F))(func), funcName, fileName, lineNo); }
- template <int X, RegistrationType expect, typename Z2, typename Y, typename Z,
- typename A, typename B, typename C, typename D,
+ template <int X, RegistrationType expect, typename Z2, typename Y, typename Z,
+ typename A, typename B, typename C, typename D,
typename E, typename F, typename G>
TCall<Y,A,B,C,D,E,F,G> &RegisterExpect_(Z2 *mck, Y (Z::*func)(A,B,C,D,E,F,G) const, const char *funcName, const char *fileName, unsigned long lineNo) { return RegisterExpect_<X,expect>(mck, (Y(Z::*)(A,B,C,D,E,F,G))(func), funcName, fileName, lineNo); }
- template <int X, RegistrationType expect, typename Z2, typename Y, typename Z,
- typename A, typename B, typename C, typename D,
+ template <int X, RegistrationType expect, typename Z2, typename Y, typename Z,
+ typename A, typename B, typename C, typename D,
typename E, typename F, typename G, typename H>
TCall<Y,A,B,C,D,E,F,G,H> &RegisterExpect_(Z2 *mck, Y (Z::*func)(A,B,C,D,E,F,G,H) const, const char *funcName, const char *fileName, unsigned long lineNo) { return RegisterExpect_<X,expect>(mck, (Y(Z::*)(A,B,C,D,E,F,G,H))(func), funcName, fileName, lineNo); }
- template <int X, RegistrationType expect, typename Z2, typename Y, typename Z,
- typename A, typename B, typename C, typename D,
+ template <int X, RegistrationType expect, typename Z2, typename Y, typename Z,
+ typename A, typename B, typename C, typename D,
typename E, typename F, typename G, typename H,
typename I>
TCall<Y,A,B,C,D,E,F,G,H,I> &RegisterExpect_(Z2 *mck, Y (Z::*func)(A,B,C,D,E,F,G,H,I) const, const char *funcName, const char *fileName, unsigned long lineNo) { return RegisterExpect_<X,expect>(mck, (Y(Z::*)(A,B,C,D,E,F,G,H,I))(func), funcName, fileName, lineNo); }
- template <int X, RegistrationType expect, typename Z2, typename Y, typename Z,
- typename A, typename B, typename C, typename D,
+ template <int X, RegistrationType expect, typename Z2, typename Y, typename Z,
+ typename A, typename B, typename C, typename D,
typename E, typename F, typename G, typename H,
typename I, typename J>
TCall<Y,A,B,C,D,E,F,G,H,I,J> &RegisterExpect_(Z2 *mck, Y (Z::*func)(A,B,C,D,E,F,G,H,I,J) const, const char *funcName, const char *fileName, unsigned long lineNo) { return RegisterExpect_<X,expect>(mck, (Y(Z::*)(A,B,C,D,E,F,G,H,I,J))(func), funcName, fileName, lineNo); }
- template <int X, RegistrationType expect, typename Z2, typename Y, typename Z,
- typename A, typename B, typename C, typename D,
+ template <int X, RegistrationType expect, typename Z2, typename Y, typename Z,
+ typename A, typename B, typename C, typename D,
typename E, typename F, typename G, typename H,
typename I, typename J, typename K>
TCall<Y,A,B,C,D,E,F,G,H,I,J,K> &RegisterExpect_(Z2 *mck, Y (Z::*func)(A,B,C,D,E,F,G,H,I,J,K) const, const char *funcName, const char *fileName, unsigned long lineNo) { return RegisterExpect_<X,expect>(mck, (Y(Z::*)(A,B,C,D,E,F,G,H,I,J,K))(func), funcName, fileName, lineNo); }
- template <int X, RegistrationType expect, typename Z2, typename Y, typename Z,
- typename A, typename B, typename C, typename D,
+ template <int X, RegistrationType expect, typename Z2, typename Y, typename Z,
+ typename A, typename B, typename C, typename D,
typename E, typename F, typename G, typename H,
typename I, typename J, typename K, typename L>
TCall<Y,A,B,C,D,E,F,G,H,I,J,K,L> &RegisterExpect_(Z2 *mck, Y (Z::*func)(A,B,C,D,E,F,G,H,I,J,K,L) const, const char *funcName, const char *fileName, unsigned long lineNo) { return RegisterExpect_<X,expect>(mck, (Y(Z::*)(A,B,C,D,E,F,G,H,I,J,K,L))(func), funcName, fileName, lineNo); }
- template <int X, RegistrationType expect, typename Z2, typename Y, typename Z,
- typename A, typename B, typename C, typename D,
+ template <int X, RegistrationType expect, typename Z2, typename Y, typename Z,
+ typename A, typename B, typename C, typename D,
typename E, typename F, typename G, typename H,
typename I, typename J, typename K, typename L,
typename M>
TCall<Y,A,B,C,D,E,F,G,H,I,J,K,L,M> &RegisterExpect_(Z2 *mck, Y (Z::*func)(A,B,C,D,E,F,G,H,I,J,K,L,M) const, const char *funcName, const char *fileName, unsigned long lineNo) { return RegisterExpect_<X,expect>(mck, (Y(Z::*)(A,B,C,D,E,F,G,H,I,J,K,L,M))(func), funcName, fileName, lineNo); }
- template <int X, RegistrationType expect, typename Z2, typename Y, typename Z,
- typename A, typename B, typename C, typename D,
+ template <int X, RegistrationType expect, typename Z2, typename Y, typename Z,
+ typename A, typename B, typename C, typename D,
typename E, typename F, typename G, typename H,
typename I, typename J, typename K, typename L,
typename M, typename N>
TCall<Y,A,B,C,D,E,F,G,H,I,J,K,L,M,N> &RegisterExpect_(Z2 *mck, Y (Z::*func)(A,B,C,D,E,F,G,H,I,J,K,L,M,N) const, const char *funcName, const char *fileName, unsigned long lineNo) { return RegisterExpect_<X,expect>(mck, (Y(Z::*)(A,B,C,D,E,F,G,H,I,J,K,L,M,N))(func), funcName, fileName, lineNo); }
- template <int X, RegistrationType expect, typename Z2, typename Y, typename Z,
- typename A, typename B, typename C, typename D,
+ template <int X, RegistrationType expect, typename Z2, typename Y, typename Z,
+ typename A, typename B, typename C, typename D,
typename E, typename F, typename G, typename H,
typename I, typename J, typename K, typename L,
typename M, typename N, typename O>
TCall<Y,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O> &RegisterExpect_(Z2 *mck, Y (Z::*func)(A,B,C,D,E,F,G,H,I,J,K,L,M,N,O) const, const char *funcName, const char *fileName, unsigned long lineNo) { return RegisterExpect_<X,expect>(mck, (Y(Z::*)(A,B,C,D,E,F,G,H,I,J,K,L,M,N,O))(func), funcName, fileName, lineNo); }
- template <int X, RegistrationType expect, typename Z2, typename Y, typename Z,
- typename A, typename B, typename C, typename D,
+ template <int X, RegistrationType expect, typename Z2, typename Y, typename Z,
+ typename A, typename B, typename C, typename D,
typename E, typename F, typename G, typename H,
typename I, typename J, typename K, typename L,
typename M, typename N, typename O, typename P>
TCall<Y,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P> &RegisterExpect_(Z2 *mck, Y (Z::*func)(A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P) const, const char *funcName, const char *fileName, unsigned long lineNo) { return RegisterExpect_<X,expect>(mck, (Y(Z::*)(A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P))(func), funcName, fileName, lineNo); }
#endif
template <typename Z>
void BasicRegisterExpect(mock<Z> *zMock, int funcIndex, void (base_mock::*func)(), int X);
template <typename Z>
Z DoExpectation(base_mock *mock, int funcno, const base_tuple &tuple);
- void DoVoidExpectation(base_mock *mock, int funcno, const base_tuple &tuple)
+ void DoVoidExpectation(base_mock *mock, int funcno, const base_tuple &tuple)
{
- for (std::list<Call *>::iterator i = expectations.begin(); i != expectations.end(); ++i)
+ for (std::list<Call *>::iterator i = expectations.begin(); i != expectations.end(); ++i)
{
Call *call = *i;
if (call->mock == mock &&
call->funcIndex == funcno &&
call->matchesArgs(tuple) &&
!call->satisfied)
{
bool allSatisfy = true;
for (std::list<Call *>::iterator callsBefore = call->previousCalls.begin();
@@ -1337,29 +1338,29 @@ public:
{
if (!(*callsBefore)->satisfied)
{
allSatisfy = false;
}
}
if (!allSatisfy) continue;
call->satisfied = true;
-
+
if (call->eHolder)
call->eHolder->rethrow();
if (call->functor != NULL)
(*(TupleInvocable<void> *)(call->functor))(tuple);
return;
}
}
- for (std::list<Call *>::iterator i = neverCalls.begin(); i != neverCalls.end(); ++i)
+ for (std::list<Call *>::iterator i = neverCalls.begin(); i != neverCalls.end(); ++i)
{
Call *call = *i;
if (call->mock == mock &&
call->funcIndex == funcno &&
call->matchesArgs(tuple))
{
bool allSatisfy = true;
for (std::list<Call *>::iterator callsBefore = call->previousCalls.begin();
callsBefore != call->previousCalls.end(); ++callsBefore)
@@ -1370,19 +1371,19 @@ public:
}
}
if (!allSatisfy) continue;
call->satisfied = true;
throw ExpectationException(this, call->getArgs(), call->funcName);
}
}
- for (std::list<Call *>::iterator i = optionals.begin(); i != optionals.end(); ++i)
+ for (std::list<Call *>::iterator i = optionals.begin(); i != optionals.end(); ++i)
{
Call *call = *i;
if (call->mock == mock &&
call->funcIndex == funcno &&
call->matchesArgs(tuple))
{
bool allSatisfy = true;
for (std::list<Call *>::iterator callsBefore = call->previousCalls.begin();
callsBefore != call->previousCalls.end(); ++callsBefore)
@@ -1400,92 +1401,92 @@ public:
call->eHolder->rethrow();
if (call->functor != NULL)
(*(TupleInvocable<void> *)(call->functor))(tuple);
return;
}
}
const char *funcName = NULL;
- for (std::list<Call *>::iterator i = expectations.begin(); i != expectations.end() && !funcName; ++i)
+ for (std::list<Call *>::iterator i = expectations.begin(); i != expectations.end() && !funcName; ++i)
{
Call *call = *i;
if (call->mock == mock &&
call->funcIndex == funcno)
funcName = call->funcName;
}
- for (std::list<Call *>::iterator i = optionals.begin(); i != optionals.end() && !funcName; ++i)
+ for (std::list<Call *>::iterator i = optionals.begin(); i != optionals.end() && !funcName; ++i)
{
Call *call = *i;
if (call->mock == mock &&
call->funcIndex == funcno)
funcName = call->funcName;
}
- for (std::list<Call *>::iterator i = neverCalls.begin(); i != neverCalls.end() && !funcName; ++i)
+ for (std::list<Call *>::iterator i = neverCalls.begin(); i != neverCalls.end() && !funcName; ++i)
{
Call *call = *i;
if (call->mock == mock &&
call->funcIndex == funcno)
funcName = call->funcName;
}
throw ExpectationException(this, &tuple, funcName);
}
- MockRepository()
+ MockRepository()
: autoExpect(true)
{
}
- ~MockRepository()
+ ~MockRepository()
{
if (!std::uncaught_exception())
VerifyAll();
reset();
- for (std::list<base_mock *>::iterator i = mocks.begin(); i != mocks.end(); i++)
+ for (std::list<base_mock *>::iterator i = mocks.begin(); i != mocks.end(); i++)
{
(*i)->destroy();
}
mocks.clear();
}
- void reset()
+ void reset()
{
- for (std::list<Call *>::iterator i = expectations.begin(); i != expectations.end(); i++)
+ for (std::list<Call *>::iterator i = expectations.begin(); i != expectations.end(); i++)
{
delete *i;
}
expectations.clear();
- for (std::list<Call *>::iterator i = neverCalls.begin(); i != neverCalls.end(); i++)
+ for (std::list<Call *>::iterator i = neverCalls.begin(); i != neverCalls.end(); i++)
{
delete *i;
}
neverCalls.clear();
- for (std::list<Call *>::iterator i = optionals.begin(); i != optionals.end(); i++)
+ for (std::list<Call *>::iterator i = optionals.begin(); i != optionals.end(); i++)
{
delete *i;
}
optionals.clear();
}
- void VerifyAll()
+ void VerifyAll()
{
- for (std::list<Call *>::iterator i = expectations.begin(); i != expectations.end(); i++)
+ for (std::list<Call *>::iterator i = expectations.begin(); i != expectations.end(); i++)
{
if (!(*i)->satisfied)
throw CallMissingException(this);
}
}
template <typename base>
base *InterfaceMock();
template <typename base>
base *ClassMock();
};
// mock function providers
template <typename Z, typename Y>
class mockFuncs : public mock<Z> {
-private:
+private:
mockFuncs();
public:
template <int X>
Y expectation0()
{
MockRepository *repo = mock<Z>::repo;
return repo->template DoExpectation<Y>(this, mock<Z>::translateX(X), tuple<>());
}
template <int X, typename A>
@@ -1582,19 +1583,19 @@ public:
Y expectation16(A a, B b, C c, D d, E e, F f, G g, H h, I i, J j, K k, L l, M m, N n, O o, P p)
{
MockRepository *repo = mock<Z>::repo;
return repo->template DoExpectation<Y>(this, mock<Z>::translateX(X), tuple<A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P>(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p));
}
};
template <typename Z>
class mockFuncs<Z, void> : public mock<Z> {
-private:
+private:
mockFuncs();
public:
template <int X>
void expectation0()
{
MockRepository *repo = mock<Z>::repo;
repo->DoVoidExpectation(this, mock<Z>::translateX(X), tuple<>());
}
template <int X, typename A>
@@ -1701,470 +1702,470 @@ void MockRepository::BasicRegisterExpect(mock<Z> *zMock, int funcIndex, void (ba
if (zMock->funcMap[funcIndex] == -1)
{
zMock->funcs[funcIndex] = getNonvirtualMemberFunctionAddress<void (*)()>(func);
zMock->funcMap[funcIndex] = X;
}
}
// Mock repository implementation
template <int X, RegistrationType expect, typename Z2, typename Y, typename Z>
-TCall<Y> &MockRepository::RegisterExpect_(Z2 *mck, Y (Z::*func)(), const char *funcName, const char *fileName, unsigned long lineNo)
+TCall<Y> &MockRepository::RegisterExpect_(Z2 *mck, Y (Z::*func)(), const char *funcName, const char *fileName, unsigned long lineNo)
{
int funcIndex = getFunctionIndex(func);
Y (mockFuncs<Z2, Y>::*mfp)();
mfp = &mockFuncs<Z2, Y>::template expectation0<X>;
- BasicRegisterExpect(reinterpret_cast<mock<Z2> *>(mck),
- funcIndex,
+ BasicRegisterExpect(reinterpret_cast<mock<Z2> *>(mck),
+ funcIndex,
reinterpret_cast<void (base_mock::*)()>(mfp),X);
TCall<Y> *call = new TCall<Y>(expect, reinterpret_cast<base_mock *>(mck), funcIndex, lineNo, funcName, fileName);
switch(expect)
{
case Never: neverCalls.push_back(call); break;
case DontCare: optionals.push_back(call); break;
case Once:
- if (autoExpect && expectations.size() > 0)
+ if (autoExpect && expectations.size() > 0)
{
call->previousCalls.push_back(expectations.back());
}
expectations.push_back(call);
break;
}
return *call;
}
template <int X, RegistrationType expect, typename Z2, typename Y, typename Z, typename A>
-TCall<Y,A> &MockRepository::RegisterExpect_(Z2 *mck, Y (Z::*func)(A), const char *funcName, const char *fileName, unsigned long lineNo)
+TCall<Y,A> &MockRepository::RegisterExpect_(Z2 *mck, Y (Z::*func)(A), const char *funcName, const char *fileName, unsigned long lineNo)
{
int funcIndex = getFunctionIndex(func);
Y (mockFuncs<Z2, Y>::*mfp)(A);
mfp = &mockFuncs<Z2, Y>::template expectation1<X,A>;
- BasicRegisterExpect(reinterpret_cast<mock<Z2> *>(mck),
+ BasicRegisterExpect(reinterpret_cast<mock<Z2> *>(mck),
funcIndex,
reinterpret_cast<void (base_mock::*)()>(mfp),X);
TCall<Y,A> *call = new TCall<Y,A>(expect, reinterpret_cast<base_mock *>(mck), funcIndex, lineNo, funcName, fileName);
switch(expect)
{
case Never: neverCalls.push_back(call); break;
case DontCare: optionals.push_back(call); break;
case Once:
- if (autoExpect && expectations.size() > 0)
+ if (autoExpect && expectations.size() > 0)
{
call->previousCalls.push_back(expectations.back());
}
expectations.push_back(call);
break;
}
return *call;
}
-template <int X, RegistrationType expect, typename Z2, typename Y, typename Z,
+template <int X, RegistrationType expect, typename Z2, typename Y, typename Z,
typename A, typename B>
-TCall<Y,A,B> &MockRepository::RegisterExpect_(Z2 *mck, Y (Z::*func)(A,B), const char *funcName, const char *fileName, unsigned long lineNo)
+TCall<Y,A,B> &MockRepository::RegisterExpect_(Z2 *mck, Y (Z::*func)(A,B), const char *funcName, const char *fileName, unsigned long lineNo)
{
int funcIndex = getFunctionIndex(func);
Y (mockFuncs<Z2, Y>::*mfp)(A,B);
mfp = &mockFuncs<Z2, Y>::template expectation2<X,A,B>;
- BasicRegisterExpect(reinterpret_cast<mock<Z2> *>(mck),
+ BasicRegisterExpect(reinterpret_cast<mock<Z2> *>(mck),
funcIndex,
reinterpret_cast<void (base_mock::*)()>(mfp),X);
TCall<Y,A,B> *call = new TCall<Y,A,B>(expect, reinterpret_cast<base_mock *>(mck), funcIndex, lineNo, funcName, fileName);
switch(expect)
{
case Never: neverCalls.push_back(call); break;
case DontCare: optionals.push_back(call); break;
case Once:
- if (autoExpect && expectations.size() > 0)
+ if (autoExpect && expectations.size() > 0)
{
call->previousCalls.push_back(expectations.back());
}
expectations.push_back(call);
break;
}
return *call;
}
-template <int X, RegistrationType expect, typename Z2, typename Y, typename Z,
+template <int X, RegistrationType expect, typename Z2, typename Y, typename Z,
typename A, typename B, typename C>
-TCall<Y,A,B,C> &MockRepository::RegisterExpect_(Z2 *mck, Y (Z::*func)(A,B,C), const char *funcName, const char *fileName, unsigned long lineNo)
+TCall<Y,A,B,C> &MockRepository::RegisterExpect_(Z2 *mck, Y (Z::*func)(A,B,C), const char *funcName, const char *fileName, unsigned long lineNo)
{
int funcIndex = getFunctionIndex(func);
Y (mockFuncs<Z2, Y>::*mfp)(A,B,C);
mfp = &mockFuncs<Z2, Y>::template expectation3<X,A,B,C>;
- BasicRegisterExpect(reinterpret_cast<mock<Z2> *>(mck),
+ BasicRegisterExpect(reinterpret_cast<mock<Z2> *>(mck),
funcIndex,
reinterpret_cast<void (base_mock::*)()>(mfp),X);
TCall<Y,A,B,C> *call = new TCall<Y,A,B,C>(expect, reinterpret_cast<base_mock *>(mck), funcIndex, lineNo, funcName, fileName);
switch(expect)
{
case Never: neverCalls.push_back(call); break;
case DontCare: optionals.push_back(call); break;
case Once:
- if (autoExpect && expectations.size() > 0)
+ if (autoExpect && expectations.size() > 0)
{
call->previousCalls.push_back(expectations.back());
}
expectations.push_back(call);
break;
}
return *call;
}
-template <int X, RegistrationType expect, typename Z2, typename Y, typename Z,
+template <int X, RegistrationType expect, typename Z2, typename Y, typename Z,
typename A, typename B, typename C, typename D>
-TCall<Y,A,B,C,D> &MockRepository::RegisterExpect_(Z2 *mck, Y (Z::*func)(A,B,C,D), const char *funcName, const char *fileName, unsigned long lineNo)
+TCall<Y,A,B,C,D> &MockRepository::RegisterExpect_(Z2 *mck, Y (Z::*func)(A,B,C,D), const char *funcName, const char *fileName, unsigned long lineNo)
{
int funcIndex = getFunctionIndex(func);
Y (mockFuncs<Z2, Y>::*mfp)(A,B,C,D);
mfp = &mockFuncs<Z2, Y>::template expectation4<X,A,B,C,D>;
- BasicRegisterExpect(reinterpret_cast<mock<Z2> *>(mck),
+ BasicRegisterExpect(reinterpret_cast<mock<Z2> *>(mck),
funcIndex,
reinterpret_cast<void (base_mock::*)()>(mfp),X);
TCall<Y,A,B,C,D> *call = new TCall<Y,A,B,C,D>(expect, reinterpret_cast<base_mock *>(mck), funcIndex, lineNo, funcName, fileName);
switch(expect)
{
case Never: neverCalls.push_back(call); break;
case DontCare: optionals.push_back(call); break;
case Once:
- if (autoExpect && expectations.size() > 0)
+ if (autoExpect && expectations.size() > 0)
{
call->previousCalls.push_back(expectations.back());
}
expectations.push_back(call);
break;
}
return *call;
}
-template <int X, RegistrationType expect, typename Z2, typename Y, typename Z,
- typename A, typename B, typename C, typename D,
+template <int X, RegistrationType expect, typename Z2, typename Y, typename Z,
+ typename A, typename B, typename C, typename D,
typename E>
-TCall<Y,A,B,C,D,E> &MockRepository::RegisterExpect_(Z2 *mck, Y (Z::*func)(A,B,C,D,E), const char *funcName, const char *fileName, unsigned long lineNo)
+TCall<Y,A,B,C,D,E> &MockRepository::RegisterExpect_(Z2 *mck, Y (Z::*func)(A,B,C,D,E), const char *funcName, const char *fileName, unsigned long lineNo)
{
int funcIndex = getFunctionIndex(func);
Y (mockFuncs<Z2, Y>::*mfp)(A,B,C,D,E);
mfp = &mockFuncs<Z2, Y>::template expectation5<X,A,B,C,D,E>;
- BasicRegisterExpect(reinterpret_cast<mock<Z2> *>(mck),
+ BasicRegisterExpect(reinterpret_cast<mock<Z2> *>(mck),
funcIndex,
reinterpret_cast<void (base_mock::*)()>(mfp),X);
TCall<Y,A,B,C,D,E> *call = new TCall<Y,A,B,C,D,E>(expect, reinterpret_cast<base_mock *>(mck), funcIndex, lineNo, funcName, fileName);
switch(expect)
{
case Never: neverCalls.push_back(call); break;
case DontCare: optionals.push_back(call); break;
case Once:
- if (autoExpect && expectations.size() > 0)
+ if (autoExpect && expectations.size() > 0)
{
call->previousCalls.push_back(expectations.back());
}
expectations.push_back(call);
break;
}
return *call;
}
-template <int X, RegistrationType expect, typename Z2, typename Y, typename Z,
- typename A, typename B, typename C, typename D,
+template <int X, RegistrationType expect, typename Z2, typename Y, typename Z,
+ typename A, typename B, typename C, typename D,
typename E, typename F>
-TCall<Y,A,B,C,D,E,F> &MockRepository::RegisterExpect_(Z2 *mck, Y (Z::*func)(A,B,C,D,E,F), const char *funcName, const char *fileName, unsigned long lineNo)
+TCall<Y,A,B,C,D,E,F> &MockRepository::RegisterExpect_(Z2 *mck, Y (Z::*func)(A,B,C,D,E,F), const char *funcName, const char *fileName, unsigned long lineNo)
{
int funcIndex = getFunctionIndex(func);
Y (mockFuncs<Z2, Y>::*mfp)(A,B,C,D,E,F);
mfp = &mockFuncs<Z2, Y>::template expectation6<X,A,B,C,D,E,F>;
- BasicRegisterExpect(reinterpret_cast<mock<Z2> *>(mck),
+ BasicRegisterExpect(reinterpret_cast<mock<Z2> *>(mck),
funcIndex,
reinterpret_cast<void (base_mock::*)()>(mfp),X);
TCall<Y,A,B,C,D,E,F> *call = new TCall<Y,A,B,C,D,E,F>(expect, reinterpret_cast<base_mock *>(mck), funcIndex, lineNo, funcName, fileName);
switch(expect)
{
case Never: neverCalls.push_back(call); break;
case DontCare: optionals.push_back(call); break;
case Once:
- if (autoExpect && expectations.size() > 0)
+ if (autoExpect && expectations.size() > 0)
{
call->previousCalls.push_back(expectations.back());
}
expectations.push_back(call);
break;
}
return *call;
}
-template <int X, RegistrationType expect, typename Z2, typename Y, typename Z,
- typename A, typename B, typename C, typename D,
+template <int X, RegistrationType expect, typename Z2, typename Y, typename Z,
+ typename A, typename B, typename C, typename D,
typename E, typename F, typename G>
-TCall<Y,A,B,C,D,E,F,G> &MockRepository::RegisterExpect_(Z2 *mck, Y (Z::*func)(A,B,C,D,E,F,G), const char *funcName, const char *fileName, unsigned long lineNo)
+TCall<Y,A,B,C,D,E,F,G> &MockRepository::RegisterExpect_(Z2 *mck, Y (Z::*func)(A,B,C,D,E,F,G), const char *funcName, const char *fileName, unsigned long lineNo)
{
int funcIndex = getFunctionIndex(func);
Y (mockFuncs<Z2, Y>::*mfp)(A,B,C,D,E,F,G);
mfp = &mockFuncs<Z2, Y>::template expectation7<X,A,B,C,D,E,F,G>;
- BasicRegisterExpect(reinterpret_cast<mock<Z2> *>(mck),
+ BasicRegisterExpect(reinterpret_cast<mock<Z2> *>(mck),
funcIndex,
reinterpret_cast<void (base_mock::*)()>(mfp),X);
TCall<Y,A,B,C,D,E,F,G> *call = new TCall<Y,A,B,C,D,E,F,G>(expect, reinterpret_cast<base_mock *>(mck), funcIndex, lineNo, funcName, fileName);
switch(expect)
{
case Never: neverCalls.push_back(call); break;
case DontCare: optionals.push_back(call); break;
case Once:
- if (autoExpect && expectations.size() > 0)
+ if (autoExpect && expectations.size() > 0)
{
call->previousCalls.push_back(expectations.back());
}
expectations.push_back(call);
break;
}
return *call;
}
-template <int X, RegistrationType expect, typename Z2, typename Y, typename Z,
- typename A, typename B, typename C, typename D,
+template <int X, RegistrationType expect, typename Z2, typename Y, typename Z,
+ typename A, typename B, typename C, typename D,
typename E, typename F, typename G, typename H>
-TCall<Y,A,B,C,D,E,F,G,H> &MockRepository::RegisterExpect_(Z2 *mck, Y (Z::*func)(A,B,C,D,E,F,G,H), const char *funcName, const char *fileName, unsigned long lineNo)
+TCall<Y,A,B,C,D,E,F,G,H> &MockRepository::RegisterExpect_(Z2 *mck, Y (Z::*func)(A,B,C,D,E,F,G,H), const char *funcName, const char *fileName, unsigned long lineNo)
{
int funcIndex = getFunctionIndex(func);
Y (mockFuncs<Z2, Y>::*mfp)(A,B,C,D,E,F,G,H);
mfp = &mockFuncs<Z2, Y>::template expectation8<X,A,B,C,D,E,F,G,H>;
- BasicRegisterExpect(reinterpret_cast<mock<Z2> *>(mck),
+ BasicRegisterExpect(reinterpret_cast<mock<Z2> *>(mck),
funcIndex,
reinterpret_cast<void (base_mock::*)()>(mfp),X);
TCall<Y,A,B,C,D,E,F,G,H> *call = new TCall<Y,A,B,C,D,E,F,G,H>(expect, reinterpret_cast<base_mock *>(mck), funcIndex, lineNo, funcName, fileName);
switch(expect)
{
case Never: neverCalls.push_back(call); break;
case DontCare: optionals.push_back(call); break;
case Once:
- if (autoExpect && expectations.size() > 0)
+ if (autoExpect && expectations.size() > 0)
{
call->previousCalls.push_back(expectations.back());
}
expectations.push_back(call);
break;
}
return *call;
}
-template <int X, RegistrationType expect, typename Z2, typename Y, typename Z,
- typename A, typename B, typename C, typename D,
+template <int X, RegistrationType expect, typename Z2, typename Y, typename Z,
+ typename A, typename B, typename C, typename D,
typename E, typename F, typename G, typename H,
typename I>
-TCall<Y,A,B,C,D,E,F,G,H,I> &MockRepository::RegisterExpect_(Z2 *mck, Y (Z::*func)(A,B,C,D,E,F,G,H,I), const char *funcName, const char *fileName, unsigned long lineNo)
+TCall<Y,A,B,C,D,E,F,G,H,I> &MockRepository::RegisterExpect_(Z2 *mck, Y (Z::*func)(A,B,C,D,E,F,G,H,I), const char *funcName, const char *fileName, unsigned long lineNo)
{
int funcIndex = getFunctionIndex(func);
Y (mockFuncs<Z2, Y>::*mfp)(A,B,C,D,E,F,G,H,I);
mfp = &mockFuncs<Z2, Y>::template expectation9<X,A,B,C,D,E,F,G,H,I>;
- BasicRegisterExpect(reinterpret_cast<mock<Z2> *>(mck),
+ BasicRegisterExpect(reinterpret_cast<mock<Z2> *>(mck),
funcIndex,
reinterpret_cast<void (base_mock::*)()>(mfp),X);
TCall<Y,A,B,C,D,E,F,G,H,I> *call = new TCall<Y,A,B,C,D,E,F,G,H,I>(expect, reinterpret_cast<base_mock *>(mck), funcIndex, lineNo, funcName, fileName);
switch(expect)
{
case Never: neverCalls.push_back(call); break;
case DontCare: optionals.push_back(call); break;
case Once:
- if (autoExpect && expectations.size() > 0)
+ if (autoExpect && expectations.size() > 0)
{
call->previousCalls.push_back(expectations.back());
}
expectations.push_back(call);
break;
}
return *call;
}
-template <int X, RegistrationType expect, typename Z2, typename Y, typename Z,
- typename A, typename B, typename C, typename D,
+template <int X, RegistrationType expect, typename Z2, typename Y, typename Z,
+ typename A, typename B, typename C, typename D,
typename E, typename F, typename G, typename H,
typename I, typename J>
-TCall<Y,A,B,C,D,E,F,G,H,I,J> &MockRepository::RegisterExpect_(Z2 *mck, Y (Z::*func)(A,B,C,D,E,F,G,H,I,J), const char *funcName, const char *fileName, unsigned long lineNo)
+TCall<Y,A,B,C,D,E,F,G,H,I,J> &MockRepository::RegisterExpect_(Z2 *mck, Y (Z::*func)(A,B,C,D,E,F,G,H,I,J), const char *funcName, const char *fileName, unsigned long lineNo)
{
int funcIndex = getFunctionIndex(func);
Y (mockFuncs<Z2, Y>::*mfp)(A,B,C,D,E,F,G,H,I,J);
mfp = &mockFuncs<Z2, Y>::template expectation10<X,A,B,C,D,E,F,G,H,I,J>;
- BasicRegisterExpect(reinterpret_cast<mock<Z2> *>(mck),
+ BasicRegisterExpect(reinterpret_cast<mock<Z2> *>(mck),
funcIndex,
reinterpret_cast<void (base_mock::*)()>(mfp),X);
TCall<Y,A,B,C,D,E,F,G,H,I,J> *call = new TCall<Y,A,B,C,D,E,F,G,H,I,J>(expect, reinterpret_cast<base_mock *>(mck), funcIndex, lineNo, funcName, fileName);
switch(expect)
{
case Never: neverCalls.push_back(call); break;
case DontCare: optionals.push_back(call); break;
case Once:
- if (autoExpect && expectations.size() > 0)
+ if (autoExpect && expectations.size() > 0)
{
call->previousCalls.push_back(expectations.back());
}
expectations.push_back(call);
break;
}
return *call;
}
-template <int X, RegistrationType expect, typename Z2, typename Y, typename Z,
- typename A, typename B, typename C, typename D,
+template <int X, RegistrationType expect, typename Z2, typename Y, typename Z,
+ typename A, typename B, typename C, typename D,
typename E, typename F, typename G, typename H,
typename I, typename J, typename K>
-TCall<Y,A,B,C,D,E,F,G,H,I,J,K> &MockRepository::RegisterExpect_(Z2 *mck, Y (Z::*func)(A,B,C,D,E,F,G,H,I,J,K), const char *funcName, const char *fileName, unsigned long lineNo)
+TCall<Y,A,B,C,D,E,F,G,H,I,J,K> &MockRepository::RegisterExpect_(Z2 *mck, Y (Z::*func)(A,B,C,D,E,F,G,H,I,J,K), const char *funcName, const char *fileName, unsigned long lineNo)
{
int funcIndex = getFunctionIndex(func);
Y (mockFuncs<Z2, Y>::*mfp)(A,B,C,D,E,F,G,H,I,J,K);
mfp = &mockFuncs<Z2, Y>::template expectation11<X,A,B,C,D,E,F,G,H,I,J,K>;
- BasicRegisterExpect(reinterpret_cast<mock<Z2> *>(mck),
+ BasicRegisterExpect(reinterpret_cast<mock<Z2> *>(mck),
funcIndex,
reinterpret_cast<void (base_mock::*)()>(mfp),X);
TCall<Y,A,B,C,D,E,F,G,H,I,J,K> *call = new TCall<Y,A,B,C,D,E,F,G,H,I,J,K>(expect, reinterpret_cast<base_mock *>(mck), funcIndex, lineNo, funcName, fileName);
switch(expect)
{
case Never: neverCalls.push_back(call); break;
case DontCare: optionals.push_back(call); break;
case Once:
- if (autoExpect && expectations.size() > 0)
+ if (autoExpect && expectations.size() > 0)
{
call->previousCalls.push_back(expectations.back());
}
expectations.push_back(call);
break;
}
return *call;
}
-template <int X, RegistrationType expect, typename Z2, typename Y, typename Z,
- typename A, typename B, typename C, typename D,
+template <int X, RegistrationType expect, typename Z2, typename Y, typename Z,
+ typename A, typename B, typename C, typename D,
typename E, typename F, typename G, typename H,
typename I, typename J, typename K, typename L>
-TCall<Y,A,B,C,D,E,F,G,H,I,J,K,L> &MockRepository::RegisterExpect_(Z2 *mck, Y (Z::*func)(A,B,C,D,E,F,G,H,I,J,K,L), const char *funcName, const char *fileName, unsigned long lineNo)
+TCall<Y,A,B,C,D,E,F,G,H,I,J,K,L> &MockRepository::RegisterExpect_(Z2 *mck, Y (Z::*func)(A,B,C,D,E,F,G,H,I,J,K,L), const char *funcName, const char *fileName, unsigned long lineNo)
{
int funcIndex = getFunctionIndex(func);
Y (mockFuncs<Z2, Y>::*mfp)(A,B,C,D,E,F,G,H,I,J,K,L);
mfp = &mockFuncs<Z2, Y>::template expectation12<X,A,B,C,D,E,F,G,H,I,J,K,L>;
- BasicRegisterExpect(reinterpret_cast<mock<Z2> *>(mck),
+ BasicRegisterExpect(reinterpret_cast<mock<Z2> *>(mck),
funcIndex,
reinterpret_cast<void (base_mock::*)()>(mfp),X);
TCall<Y,A,B,C,D,E,F,G,H,I,J,K,L> *call = new TCall<Y,A,B,C,D,E,F,G,H,I,J,K,L>(expect, reinterpret_cast<base_mock *>(mck), funcIndex, lineNo, funcName, fileName);
switch(expect)
{
case Never: neverCalls.push_back(call); break;
case DontCare: optionals.push_back(call); break;
case Once:
- if (autoExpect && expectations.size() > 0)
+ if (autoExpect && expectations.size() > 0)
{
call->previousCalls.push_back(expectations.back());
}
expectations.push_back(call);
break;
}
return *call;
}
-template <int X, RegistrationType expect, typename Z2, typename Y, typename Z,
- typename A, typename B, typename C, typename D,
+template <int X, RegistrationType expect, typename Z2, typename Y, typename Z,
+ typename A, typename B, typename C, typename D,
typename E, typename F, typename G, typename H,
typename I, typename J, typename K, typename L,
typename M>
-TCall<Y,A,B,C,D,E,F,G,H,I,J,K,L,M> &MockRepository::RegisterExpect_(Z2 *mck, Y (Z::*func)(A,B,C,D,E,F,G,H,I,J,K,L,M), const char *funcName, const char *fileName, unsigned long lineNo)
+TCall<Y,A,B,C,D,E,F,G,H,I,J,K,L,M> &MockRepository::RegisterExpect_(Z2 *mck, Y (Z::*func)(A,B,C,D,E,F,G,H,I,J,K,L,M), const char *funcName, const char *fileName, unsigned long lineNo)
{
int funcIndex = getFunctionIndex(func);
Y (mockFuncs<Z2, Y>::*mfp)(A,B,C,D,E,F,G,H,I,J,K,L,M);
mfp = &mockFuncs<Z2, Y>::template expectation13<X,A,B,C,D,E,F,G,H,I,J,K,L,M>;
- BasicRegisterExpect(reinterpret_cast<mock<Z2> *>(mck),
+ BasicRegisterExpect(reinterpret_cast<mock<Z2> *>(mck),
funcIndex,
reinterpret_cast<void (base_mock::*)()>(mfp),X);
TCall<Y,A,B,C,D,E,F,G,H,I,J,K,L,M> *call = new TCall<Y,A,B,C,D,E,F,G,H,I,J,K,L,M>(expect, reinterpret_cast<base_mock *>(mck), funcIndex, lineNo, funcName, fileName);
switch(expect)
{
case Never: neverCalls.push_back(call); break;
case DontCare: optionals.push_back(call); break;
case Once:
- if (autoExpect && expectations.size() > 0)
+ if (autoExpect && expectations.size() > 0)
{
call->previousCalls.push_back(expectations.back());
}
expectations.push_back(call);
break;
}
return *call;
}
-template <int X, RegistrationType expect, typename Z2, typename Y, typename Z,
- typename A, typename B, typename C, typename D,
+template <int X, RegistrationType expect, typename Z2, typename Y, typename Z,
+ typename A, typename B, typename C, typename D,
typename E, typename F, typename G, typename H,
typename I, typename J, typename K, typename L,
typename M, typename N>
-TCall<Y,A,B,C,D,E,F,G,H,I,J,K,L,M,N> &MockRepository::RegisterExpect_(Z2 *mck, Y (Z::*func)(A,B,C,D,E,F,G,H,I,J,K,L,M,N), const char *funcName, const char *fileName, unsigned long lineNo)
+TCall<Y,A,B,C,D,E,F,G,H,I,J,K,L,M,N> &MockRepository::RegisterExpect_(Z2 *mck, Y (Z::*func)(A,B,C,D,E,F,G,H,I,J,K,L,M,N), const char *funcName, const char *fileName, unsigned long lineNo)
{
int funcIndex = getFunctionIndex(func);
Y (mockFuncs<Z2, Y>::*mfp)(A,B,C,D,E,F,G,H,I,J,K,L,M,N);
mfp = &mockFuncs<Z2, Y>::template expectation14<X,A,B,C,D,E,F,G,H,I,J,K,L,M,N>;
- BasicRegisterExpect(reinterpret_cast<mock<Z2> *>(mck),
- funcIndex,
+ BasicRegisterExpect(reinterpret_cast<mock<Z2> *>(mck),
+ funcIndex,
reinterpret_cast<void (base_mock::*)()>(mfp),X);
TCall<Y,A,B,C,D,E,F,G,H,I,J,K,L,M,N> *call = new TCall<Y,A,B,C,D,E,F,G,H,I,J,K,L,M,N>(expect, reinterpret_cast<base_mock *>(mck), funcIndex, lineNo, funcName, fileName);
switch(expect)
{
case Never: neverCalls.push_back(call); break;
case DontCare: optionals.push_back(call); break;
case Once:
- if (autoExpect && expectations.size() > 0)
+ if (autoExpect && expectations.size() > 0)
{
call->previousCalls.push_back(expectations.back());
}
expectations.push_back(call);
break;
}
return *call;
}
-template <int X, RegistrationType expect, typename Z2, typename Y, typename Z,
- typename A, typename B, typename C, typename D,
+template <int X, RegistrationType expect, typename Z2, typename Y, typename Z,
+ typename A, typename B, typename C, typename D,
typename E, typename F, typename G, typename H,
typename I, typename J, typename K, typename L,
typename M, typename N, typename O>
-TCall<Y,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O> &MockRepository::RegisterExpect_(Z2 *mck, Y (Z::*func)(A,B,C,D,E,F,G,H,I,J,K,L,M,N,O), const char *funcName, const char *fileName, unsigned long lineNo)
+TCall<Y,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O> &MockRepository::RegisterExpect_(Z2 *mck, Y (Z::*func)(A,B,C,D,E,F,G,H,I,J,K,L,M,N,O), const char *funcName, const char *fileName, unsigned long lineNo)
{
int funcIndex = getFunctionIndex(func);
Y (mockFuncs<Z2, Y>::*mfp)(A,B,C,D,E,F,G,H,I,J,K,L,M,N,O);
mfp = &mockFuncs<Z2, Y>::template expectation15<X,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O>;
- BasicRegisterExpect(reinterpret_cast<mock<Z2> *>(mck),
- funcIndex,
+ BasicRegisterExpect(reinterpret_cast<mock<Z2> *>(mck),
+ funcIndex,
reinterpret_cast<void (base_mock::*)()>(mfp),X);
TCall<Y,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O> *call = new TCall<Y,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O>(expect, reinterpret_cast<base_mock *>(mck), funcIndex, lineNo, funcName, fileName);
switch(expect)
{
case Never: neverCalls.push_back(call); break;
case DontCare: optionals.push_back(call); break;
case Once:
- if (autoExpect && expectations.size() > 0)
+ if (autoExpect && expectations.size() > 0)
{
call->previousCalls.push_back(expectations.back());
}
expectations.push_back(call);
break;
}
return *call;
}
-template <int X, RegistrationType expect, typename Z2, typename Y, typename Z,
- typename A, typename B, typename C, typename D,
+template <int X, RegistrationType expect, typename Z2, typename Y, typename Z,
+ typename A, typename B, typename C, typename D,
typename E, typename F, typename G, typename H,
typename I, typename J, typename K, typename L,
typename M, typename N, typename O, typename P>
-TCall<Y,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P> &MockRepository::RegisterExpect_(Z2 *mck, Y (Z::*func)(A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P), const char *funcName, const char *fileName, unsigned long lineNo)
+TCall<Y,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P> &MockRepository::RegisterExpect_(Z2 *mck, Y (Z::*func)(A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P), const char *funcName, const char *fileName, unsigned long lineNo)
{
int funcIndex = getFunctionIndex(func);
Y (mockFuncs<Z2, Y>::*mfp)(A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P);
mfp = &mockFuncs<Z2, Y>::template expectation16<X,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P>;
- BasicRegisterExpect(reinterpret_cast<mock<Z2> *>(mck),
+ BasicRegisterExpect(reinterpret_cast<mock<Z2> *>(mck),
funcIndex,
reinterpret_cast<void (base_mock::*)()>(mfp),X);
TCall<Y,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P> *call = new TCall<Y,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P>(expect, reinterpret_cast<base_mock *>(mck), funcIndex, lineNo, funcName, fileName);
switch(expect)
{
case Never: neverCalls.push_back(call); break;
case DontCare: optionals.push_back(call); break;
case Once:
- if (autoExpect && expectations.size() > 0)
+ if (autoExpect && expectations.size() > 0)
{
call->previousCalls.push_back(expectations.back());
}
expectations.push_back(call);
break;
}
return *call;
}
template <typename Z>
-Z MockRepository::DoExpectation(base_mock *mock, int funcno, const base_tuple &tuple)
+Z MockRepository::DoExpectation(base_mock *mock, int funcno, const base_tuple &tuple)
{
- for (std::list<Call *>::iterator i = expectations.begin(); i != expectations.end(); ++i)
+ for (std::list<Call *>::iterator i = expectations.begin(); i != expectations.end(); ++i)
{
Call *call = *i;
if (call->mock == mock &&
call->funcIndex == funcno &&
call->matchesArgs(tuple) &&
!call->satisfied)
{
bool allSatisfy = true;
for (std::list<Call *>::iterator callsBefore = call->previousCalls.begin();
@@ -2185,19 +2186,19 @@ Z MockRepository::DoExpectation(base_mock *mock, int funcno, const base_tuple &t
if (call->retVal)
return ((ReturnValueWrapper<Z> *)call->retVal)->rv;
if (call->functor != NULL)
return (*(TupleInvocable<Z> *)(call->functor))(tuple);
throw NoResultSetUpException(call->getArgs(), call->funcName);
}
}
- for (std::list<Call *>::iterator i = neverCalls.begin(); i != neverCalls.end(); ++i)
+ for (std::list<Call *>::iterator i = neverCalls.begin(); i != neverCalls.end(); ++i)
{
Call *call = *i;
if (call->mock == mock &&
call->funcIndex == funcno &&
call->matchesArgs(tuple))
{
bool allSatisfy = true;
for (std::list<Call *>::iterator callsBefore = call->previousCalls.begin();
callsBefore != call->previousCalls.end(); ++callsBefore)
@@ -2208,66 +2209,66 @@ Z MockRepository::DoExpectation(base_mock *mock, int funcno, const base_tuple &t
}
}
if (!allSatisfy) continue;
call->satisfied = true;
throw ExpectationException(this, call->getArgs(), call->funcName);
}
}
- for (std::list<Call *>::iterator i = optionals.begin(); i != optionals.end(); ++i)
+ for (std::list<Call *>::iterator i = optionals.begin(); i != optionals.end(); ++i)
{
Call *call = *i;
if (call->mock == mock &&
call->funcIndex == funcno &&
call->matchesArgs(tuple))
{
bool allSatisfy = true;
for (std::list<Call *>::iterator callsBefore = call->previousCalls.begin();
callsBefore != call->previousCalls.end(); ++callsBefore)
{
if (!(*callsBefore)->satisfied)
{
allSatisfy = false;
}
}
if (!allSatisfy) continue;
call->satisfied = true;
-
+
if (call->eHolder)
call->eHolder->rethrow();
if (call->retVal)
return ((ReturnValueWrapper<Z> *)call->retVal)->rv;
-
+
if (call->functor != NULL)
return (*(TupleInvocable<Z> *)(call->functor))(tuple);
-
+
throw NoResultSetUpException(call->getArgs(), call->funcName);
}
}
const char *funcName = NULL;
- for (std::list<Call *>::iterator i = expectations.begin(); i != expectations.end() && !funcName; ++i)
+ for (std::list<Call *>::iterator i = expectations.begin(); i != expectations.end() && !funcName; ++i)
{
Call *call = *i;
if (call->mock == mock &&
call->funcIndex == funcno)
funcName = call->funcName;
}
- for (std::list<Call *>::iterator i = neverCalls.begin(); i != neverCalls.end() && !funcName; ++i)
+ for (std::list<Call *>::iterator i = neverCalls.begin(); i != neverCalls.end() && !funcName; ++i)
{
Call *call = *i;
if (call->mock == mock &&
call->funcIndex == funcno)
funcName = call->funcName;
}
- for (std::list<Call *>::iterator i = optionals.begin(); i != optionals.end() && !funcName; ++i)
+ for (std::list<Call *>::iterator i = optionals.begin(); i != optionals.end() && !funcName; ++i)
{
Call *call = *i;
if (call->mock == mock &&
call->funcIndex == funcno)
funcName = call->funcName;
}
throw ExpectationException(this, &tuple, funcName);
}
template <typename base>
@@ -2334,25 +2335,24 @@ inline std::ostream &operator<<(std::ostream &os, const MockRepository &repo)
os << "Optional results set up:" << std::endl;
for (std::list<Call *>::const_iterator exp = repo.optionals.begin(); exp != repo.optionals.end(); ++exp)
os << **exp;
os << std::endl;
}
return os;
}
-inline void BaseException::setException(const char *description, MockRepository *repo)
+inline void BaseException::setException(const char *description, MockRepository *repo)
{
std::stringstream text;
text << description;
text << *repo;
std::string result = text.str();
strncpy(buffer, result.c_str(), sizeof(buffer)-1);
buffer[sizeof(buffer)-1] = '\0';
}
#ifdef _MSC_VER
#pragma warning(pop)
#endif
#endif
-
diff --git a/3rdParty/SCons/scons-local-2.0.0.final.0/SCons/Tool/MSCommon/vc.py b/3rdParty/SCons/scons-local-2.0.0.final.0/SCons/Tool/MSCommon/vc.py
index bbdac1d..56af18a 100644
--- a/3rdParty/SCons/scons-local-2.0.0.final.0/SCons/Tool/MSCommon/vc.py
+++ b/3rdParty/SCons/scons-local-2.0.0.final.0/SCons/Tool/MSCommon/vc.py
@@ -98,63 +98,67 @@ def get_host_target(env):
host_platform = env.get('HOST_ARCH')
if not host_platform:
host_platform = platform.machine()
# TODO(2.5): the native Python platform.machine() function returns
# '' on all Python versions before 2.6, after which it also uses
# PROCESSOR_ARCHITECTURE.
if not host_platform:
host_platform = os.environ.get('PROCESSOR_ARCHITECTURE', '')
-
+
# Retain user requested TARGET_ARCH
req_target_platform = env.get('TARGET_ARCH')
debug('vc.py:get_host_target() req_target_platform:%s'%req_target_platform)
if req_target_platform:
# If user requested a specific platform then only try that one.
target_platform = req_target_platform
else:
target_platform = host_platform
-
+
try:
host = _ARCH_TO_CANONICAL[host_platform.lower()]
except KeyError, e:
msg = "Unrecognized host architecture %s"
raise ValueError(msg % repr(host_platform))
try:
target = _ARCH_TO_CANONICAL[target_platform.lower()]
except KeyError, e:
raise ValueError("Unrecognized target architecture %s" % target_platform)
return (host, target,req_target_platform)
-_VCVER = ["10.0", "9.0", "9.0Exp","8.0", "8.0Exp","7.1", "7.0", "6.0"]
+_VCVER = ["12.0", "11.0", "10.0", "9.0", "9.0Exp","8.0", "8.0Exp","7.1", "7.0", "6.0"]
_VCVER_TO_PRODUCT_DIR = {
+ '12.0': [
+ r'Microsoft\VisualStudio\12.0\Setup\VC\ProductDir'],
+ '11.0': [
+ r'Microsoft\VisualStudio\11.0\Setup\VC\ProductDir'],
'10.0': [
r'Microsoft\VisualStudio\10.0\Setup\VC\ProductDir'],
'9.0': [
r'Microsoft\VisualStudio\9.0\Setup\VC\ProductDir'],
'9.0Exp' : [
r'Microsoft\VCExpress\9.0\Setup\VC\ProductDir'],
'8.0': [
r'Microsoft\VisualStudio\8.0\Setup\VC\ProductDir'],
'8.0Exp': [
r'Microsoft\VCExpress\8.0\Setup\VC\ProductDir'],
'7.1': [
r'Microsoft\VisualStudio\7.1\Setup\VC\ProductDir'],
'7.0': [
r'Microsoft\VisualStudio\7.0\Setup\VC\ProductDir'],
'6.0': [
r'Microsoft\VisualStudio\6.0\Setup\Microsoft Visual C++\ProductDir']
}
-
+
def msvc_version_to_maj_min(msvc_version):
msvc_version_numeric = ''.join([x for x in msvc_version if x in string_digits + '.'])
t = msvc_version_numeric.split(".")
if not len(t) == 2:
raise ValueError("Unrecognized version %s (%s)" % (msvc_version,msvc_version_numeric))
try:
maj = int(t[0])
min = int(t[1])
@@ -222,37 +226,37 @@ def find_vc_pdir(msvc_version):
def find_batch_file(env,msvc_version,host_arch,target_arch):
"""
Find the location of the batch script which should set up the compiler
for any TARGET_ARCH whose compilers were installed by Visual Studio/VCExpress
"""
pdir = find_vc_pdir(msvc_version)
if pdir is None:
raise NoVersionFound("No version of Visual Studio found")
-
+
debug('vc.py: find_batch_file() pdir:%s'%pdir)
# filter out e.g. "Exp" from the version name
msvc_ver_numeric = ''.join([x for x in msvc_version if x in string_digits + "."])
vernum = float(msvc_ver_numeric)
if 7 <= vernum < 8:
pdir = os.path.join(pdir, os.pardir, "Common7", "Tools")
batfilename = os.path.join(pdir, "vsvars32.bat")
elif vernum < 7:
pdir = os.path.join(pdir, "Bin")
batfilename = os.path.join(pdir, "vcvars32.bat")
else: # >= 8
batfilename = os.path.join(pdir, "vcvarsall.bat")
if not os.path.exists(batfilename):
debug("Not found: %s" % batfilename)
batfilename = None
-
+
installed_sdks=get_installed_sdks()
for _sdk in installed_sdks:
sdk_bat_file=_sdk.get_sdk_vc_script(host_arch,target_arch)
sdk_bat_file_path=os.path.join(pdir,sdk_bat_file)
debug('vc.py:find_batch_file() sdk_bat_file_path:%s'%sdk_bat_file_path)
if os.path.exists(sdk_bat_file_path):
return (batfilename,sdk_bat_file_path)
else:
debug("vc.py:find_batch_file() not found:%s"%sdk_bat_file_path)
@@ -297,19 +301,19 @@ def script_env(script, args=None):
raise BatchFileExecutionError("\n".join(olines[:2]))
return common.parse_output(stdout)
def get_default_version(env):
debug('get_default_version()')
msvc_version = env.get('MSVC_VERSION')
msvs_version = env.get('MSVS_VERSION')
-
+
debug('get_default_version(): msvc_version:%s msvs_version:%s'%(msvc_version,msvs_version))
if msvs_version and not msvc_version:
SCons.Warnings.warn(
SCons.Warnings.DeprecatedWarning,
"MSVS_VERSION is deprecated: please use MSVC_VERSION instead ")
return msvs_version
elif msvc_version and msvs_version:
if not msvc_version == msvs_version:
@@ -354,91 +358,91 @@ def msvc_find_valid_batch_script(env,version):
# 64 bit tools installed
try_target_archs = [target_platform]
if target_platform=='amd64':
try_target_archs.append('x86')
d = None
for tp in try_target_archs:
# Set to current arch.
env['TARGET_ARCH']=tp
-
+
debug("vc.py:msvc_find_valid_batch_script() trying target_platform:%s"%tp)
host_target = (host_platform, tp)
if not is_host_target_supported(host_target, version):
warn_msg = "host, target = %s not supported for MSVC version %s" % \
(host_target, version)
SCons.Warnings.warn(SCons.Warnings.VisualCMissingWarning, warn_msg)
arg = _HOST_TARGET_ARCH_TO_BAT_ARCH[host_target]
-
+
# Try to locate a batch file for this host/target platform combo
try:
(vc_script,sdk_script) = find_batch_file(env,version,host_platform,tp)
debug('vc.py:msvc_find_valid_batch_script() vc_script:%s sdk_script:%s'%(vc_script,sdk_script))
except VisualCException, e:
msg = str(e)
debug('Caught exception while looking for batch file (%s)' % msg)
warn_msg = "VC version %s not installed. " + \
"C/C++ compilers are most likely not set correctly.\n" + \
" Installed versions are: %s"
warn_msg = warn_msg % (version, cached_get_installed_vcs())
SCons.Warnings.warn(SCons.Warnings.VisualCMissingWarning, warn_msg)
continue
-
+
# Try to use the located batch file for this host/target platform combo
debug('vc.py:msvc_find_valid_batch_script() use_script 2 %s, args:%s\n' % (repr(vc_script), arg))
if vc_script:
try:
d = script_env(vc_script, args=arg)
except BatchFileExecutionError, e:
debug('vc.py:msvc_find_valid_batch_script() use_script 3: failed running VC script %s: %s: Error:%s'%(repr(vc_script),arg,e))
vc_script=None
if not vc_script and sdk_script:
debug('vc.py:msvc_find_valid_batch_script() use_script 4: trying sdk script: %s'%(sdk_script))
try:
d = script_env(sdk_script,args=[])
except BatchFileExecutionError,e:
debug('vc.py:msvc_find_valid_batch_script() use_script 5: failed running SDK script %s: Error:%s'%(repr(sdk_script),e))
continue
elif not vc_script and not sdk_script:
debug('vc.py:msvc_find_valid_batch_script() use_script 6: Neither VC script nor SDK script found')
continue
-
+
# If we cannot find a viable installed compiler, reset the TARGET_ARCH
# To it's initial value
if not d:
env['TARGET_ARCH']=req_target_platform
-
+
return d
-
+
def msvc_setup_env(env):
debug('msvc_setup_env()')
version = get_default_version(env)
if version is None:
warn_msg = "No version of Visual Studio compiler found - C/C++ " \
"compilers most likely not set correctly"
SCons.Warnings.warn(SCons.Warnings.VisualCMissingWarning, warn_msg)
return None
debug('msvc_setup_env: using specified MSVC version %s\n' % repr(version))
# XXX: we set-up both MSVS version for backward
# compatibility with the msvs tool
env['MSVC_VERSION'] = version
env['MSVS_VERSION'] = version
env['MSVS'] = {}
-
+
use_script = env.get('MSVC_USE_SCRIPT', True)
if SCons.Util.is_String(use_script):
debug('vc.py:msvc_setup_env() use_script 1 %s\n' % repr(use_script))
d = script_env(use_script)
- elif use_script:
+ elif use_script:
d = msvc_find_valid_batch_script(env,version)
debug('vc.py:msvc_setup_env() use_script 2 %s\n' % d)
if not d:
return d
else:
debug('MSVC_USE_SCRIPT set to False')
warn_msg = "MSVC_USE_SCRIPT set to False, assuming environment " \
"set correctly."
SCons.Warnings.warn(SCons.Warnings.VisualCMissingWarning, warn_msg)
@@ -447,10 +451,9 @@ def msvc_setup_env(env):
for k, v in d.items():
debug('vc.py:msvc_setup_env() env:%s -> %s'%(k,v))
env.PrependENVPath(k, v, delete_existing=True)
def msvc_exists(version=None):
vcs = cached_get_installed_vcs()
if version is None:
return len(vcs) > 0
return version in vcs
-
diff --git a/BuildTools/SCons/SConscript.boot b/BuildTools/SCons/SConscript.boot
index 767c326..51be9ab 100644
--- a/BuildTools/SCons/SConscript.boot
+++ b/BuildTools/SCons/SConscript.boot
@@ -6,18 +6,21 @@ sys.path.append(Dir("#/BuildTools/SCons").abspath)
################################################################################
vars = Variables(os.path.join(Dir("#").abspath, "config.py"))
vars.Add('cc', "C compiler")
vars.Add('cxx', "C++ compiler")
vars.Add('ccflags', "Extra C/C++/ObjC compiler flags")
vars.Add('cxxflags', "Extra C++ compiler flags")
vars.Add('link', "Linker")
vars.Add('linkflags', "Extra linker flags")
+vars.Add('ar', "Archiver (ar or lib)")
+if os.name == "nt":
+ vars.Add('mt', "manifest tool")
vars.Add(BoolVariable("ccache", "Use CCache", "no"))
vars.Add(EnumVariable("test", "Compile and run tests", "none", ["none", "all", "unit", "system"]))
vars.Add(BoolVariable("optimize", "Compile with optimizations turned on", "no"))
vars.Add(BoolVariable("debug", "Compile with debug information", "yes"))
vars.Add(BoolVariable("allow_warnings", "Allow compilation warnings during compilation", "yes"))
vars.Add(BoolVariable("assertions", "Compile with assertions", "yes"))
vars.Add(BoolVariable("max_jobs", "Build with maximum number of parallel jobs", "no"))
vars.Add(EnumVariable("target", "Choose a target platform for compilation", "native", ["native", "iphone-simulator", "iphone-device", "xcode", "android"]))
vars.Add('android_toolchain', "Path to Android toolchain")
@@ -33,75 +36,91 @@ if os.name == "mac" or (os.name == "posix" and os.uname()[0] == "Darwin"):
vars.Add(BoolVariable("mac105", "Link against the 10.5 frameworks", "no"))
vars.Add(BoolVariable("mac106", "Link against the 10.6 frameworks", "no"))
if os.name == "nt" :
vars.Add(PathVariable("vcredist", "MSVC redistributable dir", None, PathVariable.PathAccept))
if os.name == "nt" :
vars.Add(PathVariable("wix_bindir", "Path to WiX binaries", "", PathVariable.PathAccept))
if os.name == "nt" :
vars.Add(PackageVariable("bonjour", "Bonjour SDK location", "yes"))
vars.Add(PackageVariable("openssl", "OpenSSL location", "yes"))
+vars.Add("openssl_libnames", "Comma-separated openssl library names to override defaults", None)
vars.Add(BoolVariable("openssl_force_bundled", "Force use of the bundled OpenSSL", "no"))
+vars.Add("openssl_include", "Location of OpenSSL include files (if not under (openssl)/include)", None)
+vars.Add("openssl_libdir", "Location of OpenSSL library files (if not under (openssl)/lib)", None)
vars.Add(PackageVariable("hunspell", "Hunspell location", False))
vars.Add(PathVariable("boost_includedir", "Boost headers location", None, PathVariable.PathAccept))
vars.Add(PathVariable("boost_libdir", "Boost library location", None, PathVariable.PathAccept))
+vars.Add(BoolVariable("boost_bundled_enable", "Allow use of bundled Boost as last resort", "true"))
+vars.Add(PathVariable("zlib_includedir", "Zlib headers location", None, PathVariable.PathAccept))
+vars.Add(PathVariable("zlib_libdir", "Zlib library location", None, PathVariable.PathAccept))
+vars.Add(PathVariable("zlib_libfile", "Zlib library file (full path to file)", None, PathVariable.PathAccept))
+vars.Add(BoolVariable("zlib_bundled_enable", "Allow use of bundled Zlib as last resort", "true"))
+vars.Add(BoolVariable("try_gconf", "Try configuring for GConf?", "true"))
+vars.Add(BoolVariable("try_libxml", "Try configuring for libXML?", "true"))
+vars.Add(BoolVariable("try_expat", "Try configuring for expat?", "true"))
vars.Add(PathVariable("expat_includedir", "Expat headers location", None, PathVariable.PathAccept))
vars.Add(PathVariable("expat_libdir", "Expat library location", None, PathVariable.PathAccept))
-vars.Add("expat_libname", "Expat library name", "libexpat" if os.name == "nt" else "expat")
+vars.Add("expat_libname", "Expat library name", os.name == "nt" and "libexpat" or "expat")
vars.Add(PackageVariable("icu", "ICU library location", "no"))
+vars.Add(BoolVariable("libidn_bundled_enable", "Allow use of bunded Expat", "true"))
+vars.Add(BoolVariable("try_libidn", "Try configuring for LibIDN?", "true"))
vars.Add(PathVariable("libidn_includedir", "LibIDN headers location", None, PathVariable.PathAccept))
vars.Add(PathVariable("libidn_libdir", "LibIDN library location", None, PathVariable.PathAccept))
-vars.Add("libidn_libname", "LibIDN library name", "libidn" if os.name == "nt" else "idn")
+vars.Add("libidn_libname", "LibIDN library name", os.name == "nt" and "libidn" or "idn")
vars.Add(PathVariable("libminiupnpc_includedir", "LibMiniUPNPC headers location", None, PathVariable.PathAccept))
vars.Add(PathVariable("libminiupnpc_libdir", "LibMiniUPNPC library location", None, PathVariable.PathAccept))
vars.Add("libminiupnpc_libname", "LibMiniUPNPC library name", "libminiupnpc" if os.name == "nt" else "miniupnpc")
vars.Add(PathVariable("libnatpmp_includedir", "LibNATPMP headers location", None, PathVariable.PathAccept))
vars.Add(PathVariable("libnatpmp_libdir", "LibNATPMP library location", None, PathVariable.PathAccept))
vars.Add("libnatpmp_libname", "LibNATPMP library name", "libnatpmp" if os.name == "nt" else "natpmp")
vars.Add(PathVariable("sqlite_includedir", "SQLite headers location", None, PathVariable.PathAccept))
vars.Add(PathVariable("sqlite_libdir", "SQLite library location", None, PathVariable.PathAccept))
-vars.Add("sqlite_libname", "SQLite library name", "libsqlite3" if os.name == "nt" else "sqlite3")
+vars.Add("sqlite_libname", "SQLite library name", os.name == "nt" and "libsqlite3" or "sqlite3")
vars.Add("sqlite_force_bundled", "Force use of the bundled SQLite", None)
vars.Add(PathVariable("lua_includedir", "Lua headers location", None, PathVariable.PathAccept))
vars.Add(PathVariable("lua_libdir", "Lua library location", None, PathVariable.PathAccept))
vars.Add("lua_libname", "Lua library name", "liblua" if os.name == "nt" else "lua")
vars.Add("lua_force_bundled", "Force use of the bundled Lua", None)
vars.Add(PathVariable("editline_includedir", "Readline headers location", None, PathVariable.PathAccept))
vars.Add(PathVariable("editline_libdir", "Readline library location", None, PathVariable.PathAccept))
vars.Add("editline_libname", "Readline library name", "libedit" if os.name == "nt" else "edit")
+vars.Add(BoolVariable("try_avahi", "Try configuring for avahi?", "true"))
vars.Add(PathVariable("avahi_includedir", "Avahi headers location", None, PathVariable.PathAccept))
vars.Add(PathVariable("avahi_libdir", "Avahi library location", None, PathVariable.PathAccept))
vars.Add(PathVariable("qt", "Qt location", "", PathVariable.PathAccept))
vars.Add(BoolVariable("qt5", "Compile in Qt5 mode", "no")) # TODO: auto-detect this
vars.Add(PathVariable("docbook_xml", "DocBook XML", None, PathVariable.PathAccept))
vars.Add(PathVariable("docbook_xsl", "DocBook XSL", None, PathVariable.PathAccept))
vars.Add(BoolVariable("build_examples", "Build example programs", "yes"))
vars.Add(BoolVariable("enable_variants", "Build in a separate dir under build/, depending on compile flags", "no"))
vars.Add(BoolVariable("experimental_ft", "Build experimental file transfer", "yes"))
vars.Add(BoolVariable("experimental", "Build experimental features", "no"))
vars.Add(BoolVariable("set_iterator_debug_level", "Set _ITERATOR_DEBUG_LEVEL=0", "yes"))
vars.Add(BoolVariable("unbound", "Build bundled ldns and unbound. Use them for DNS lookup.", "no"))
+vars.Add(BoolVariable("install_git_hooks", "Install git hooks", "true"))
+
################################################################################
# Set up default build & configure environment
################################################################################
-
env_ENV = {
- 'PATH' : os.environ['PATH'],
+ 'PATH' : os.environ['PATH'],
'LD_LIBRARY_PATH' : os.environ.get("LD_LIBRARY_PATH", ""),
'TERM' : os.environ.get("TERM", ""),
}
+
if "MSVC_VERSION" in ARGUMENTS :
- env = Environment(ENV = env_ENV, variables = vars, MSVC_VERSION = ARGUMENTS["MSVC_VERSION"])
+ env = Environment(ENV = env_ENV, variables = vars, MSVC_VERSION = ARGUMENTS["MSVC_VERSION"], platform = ARGUMENTS.get("PLATFORM", None))
else :
- env = Environment(ENV = env_ENV, variables = vars)
+ env = Environment(ENV = env_ENV, variables = vars, platform = ARGUMENTS.get("PLATFORM", None))
Help(vars.GenerateHelpText(env))
# Workaround for missing Visual Studio 2012 support in SCons
# Requires scons to be run from a VS2012 console
if env.get("MSVC_VERSION", "").startswith("11.0") :
env["ENV"]["LIB"] = os.environ["LIB"]
env["ENV"]["INCLUDE"] = os.environ["INCLUDE"]
@@ -118,19 +137,19 @@ env.Tool("WriteVal", toolpath = ["#/BuildTools/SCons/Tools"])
env.Tool("BuildVersion", toolpath = ["#/BuildTools/SCons/Tools"])
env.Tool("Flags", toolpath = ["#/BuildTools/SCons/Tools"])
if env["PLATFORM"] == "darwin" :
env.Tool("Nib", toolpath = ["#/BuildTools/SCons/Tools"])
env.Tool("AppBundle", toolpath = ["#/BuildTools/SCons/Tools"])
if env["PLATFORM"] == "win32" :
env.Tool("WindowsBundle", toolpath = ["#/BuildTools/SCons/Tools"])
#So we don't need to escalate with UAC
if "TMP" in os.environ.keys() :
- env['ENV']['TMP'] = os.environ['TMP']
+ env['ENV']['TMP'] = os.environ['TMP']
env.Tool("SLOCCount", toolpath = ["#/BuildTools/SCons/Tools"])
# Max out the number of jobs
if env["max_jobs"] :
try :
import multiprocessing
SetOption("num_jobs", multiprocessing.cpu_count())
except NotImplementedError :
pass
@@ -165,18 +184,21 @@ if "CCC_ANALYZER_HTML" in os.environ :
env["ENV"][key] = value
env["CC"] = os.environ["CC"]
env["CXX"] = os.environ["CXX"]
# Override the compiler with custom variables set at config time
if "cc" in env :
env["CC"] = env["cc"]
if "cxx" in env :
env["CXX"] = env["cxx"]
+if "ar" in env :
+ env["AR"] = env["ar"]
+
if "link" in env :
env["SHLINK"] = env["link"]
env["LINK"] = env["link"]
for flags_type in ["ccflags", "cxxflags", "linkflags"] :
if flags_type in env :
if isinstance(env[flags_type], str) :
# FIXME: Make the splitting more robust
env[flags_type.upper()] = env[flags_type].split(" ")
else :
@@ -207,47 +229,47 @@ if env["debug"] :
env.Append(CCFLAGS = ["/MDd"])
else :
env.Append(CCFLAGS = ["-g"])
elif env["PLATFORM"] == "win32" :
env.Append(CCFLAGS = ["/MD"])
if env.get("universal", 0) :
assert(env["PLATFORM"] == "darwin")
env.Append(CCFLAGS = [
- "-isysroot", "/Developer/SDKs/MacOSX10.4u.sdk",
- "-arch", "i386",
+ "-isysroot", "/Developer/SDKs/MacOSX10.4u.sdk",
+ "-arch", "i386",
"-arch", "ppc"])
env.Append(LINKFLAGS = [
- "-mmacosx-version-min=10.4",
- "-isysroot", "/Developer/SDKs/MacOSX10.4u.sdk",
- "-arch", "i386",
+ "-mmacosx-version-min=10.4",
+ "-isysroot", "/Developer/SDKs/MacOSX10.4u.sdk",
+ "-arch", "i386",
"-arch", "ppc"])
# Link against other versions of the OS X SDKs.
# FIXME: This method does not work anymore, we need to set deployment targets.
if env.get("mac105", 0) :
assert(env["PLATFORM"] == "darwin")
env.Append(CCFLAGS = [
- "-isysroot", "/Developer/SDKs/MacOSX10.5.sdk",
+ "-isysroot", "/Developer/SDKs/MacOSX10.5.sdk",
"-arch", "i386"])
env.Append(LINKFLAGS = [
- "-mmacosx-version-min=10.5",
- "-isysroot", "/Developer/SDKs/MacOSX10.5.sdk",
+ "-mmacosx-version-min=10.5",
+ "-isysroot", "/Developer/SDKs/MacOSX10.5.sdk",
"-arch", "i386"])
if env.get("mac106", 0) :
assert(env["PLATFORM"] == "darwin")
env.Append(CCFLAGS = [
- "-isysroot", "/Developer/SDKs/MacOSX10.6.sdk",
+ "-isysroot", "/Developer/SDKs/MacOSX10.6.sdk",
"-arch", "i386"])
env.Append(LINKFLAGS = [
- "-mmacosx-version-min=10.6",
- "-isysroot", "/Developer/SDKs/MacOSX10.6.sdk",
+ "-mmacosx-version-min=10.6",
+ "-isysroot", "/Developer/SDKs/MacOSX10.6.sdk",
"-arch", "i386"])
if not env["assertions"] :
env.Append(CPPDEFINES = ["NDEBUG"])
if env["experimental_ft"] :
env.Append(CPPDEFINES = ["SWIFT_EXPERIMENTAL_FT"])
if env["experimental"] :
@@ -255,18 +277,25 @@ if env["experimental"] :
# If we build shared libs on AMD64, we need -fPIC.
# This should have no performance impact om AMD64
if env["PLATFORM"] == "posix" and platform.machine() == "x86_64" :
env.Append(CCFLAGS = ["-fPIC"])
# Warnings
if env["PLATFORM"] == "win32" :
env.Append(CXXFLAGS = ["/wd4068"])
+elif env["PLATFORM"] == "hpux" :
+ # HP-UX gives a flood of minor warnings if this is enabled
+ #env.Append(CXXFLAGS = ["+w"])
+ pass
+elif env["PLATFORM"] == "sunos" :
+ #env.Append(CXXFLAGS = ["-z verbose"])
+ pass
else :
if "clang" in env["CXX"] :
env.Append(CXXFLAGS = [
"-Weverything",
"-Wno-unknown-warning-option", # To stay compatible between CLang versions
"-Wno-unknown-pragmas", # To stay compatible between CLang versions
"-Wno-weak-vtables", # Virtually none of our elements have outlined methods. This also seems to affect classes in .cpp files, which in turn affects all our tests, which may need fixing in CLang
"-Wno-shadow", # Also warns for shadowing on constructor arguments, which we do a lot
"-Wno-documentation", # We don't care about documentation warnings
@@ -292,24 +321,34 @@ if env.get("coverage", 0) :
assert(env["PLATFORM"] != "win32")
env.Append(CCFLAGS = ["-fprofile-arcs", "-ftest-coverage"])
env.Append(LINKFLAGS = ["-fprofile-arcs", "-ftest-coverage"])
if env["PLATFORM"] == "win32" :
env.Append(LIBS = ["user32", "crypt32", "dnsapi", "iphlpapi", "ws2_32", "wsock32", "Advapi32"])
env.Append(CCFLAGS = ["/EHsc", "/nologo", "/Zm256"])
env.Append(LINKFLAGS = ["/INCREMENTAL:no", "/NOLOGO"])
if int(env["MSVS_VERSION"].split(".")[0]) < 10 :
- env["LINKCOM"] = [env["LINKCOM"], 'mt.exe -nologo -manifest ${TARGET}.manifest -outputresource:$TARGET;1']
- env["SHLINKCOM"] = [env["SHLINKCOM"], 'mt.exe -nologo -manifest ${TARGET}.manifest -outputresource:$TARGET;2']
+ mt = env.get('mt')
+ if not mt:
+ mt = 'mt.exe'
+ env["LINKCOM"] = [env["LINKCOM"], '%s -nologo -manifest ${TARGET}.manifest -outputresource:$TARGET;1' % mt]
+ env["SHLINKCOM"] = [env["SHLINKCOM"], '%s -nologo -manifest ${TARGET}.manifest -outputresource:$TARGET;2' % mt]
if env["PLATFORM"] == "darwin" and not env["target"] in ["iphone-device", "iphone-simulator", "xcode", "android"] :
env["PLATFORM_FLAGS"]["FRAMEWORKS"] += ["IOKit", "AppKit", "SystemConfiguration", "Security", "SecurityInterface"]
+# Required by boost headers on HP-UX
+if env["PLATFORM"] == "hpux" :
+ env.Append(CXXFLAGS = ["+hpxstd98", "-mt", "-AA"])
+ # FIXME: Need -AA for linking C++ but not C
+ #env.Append(LINKFLAGS = ["-AA"])
+
+
# Testing
env["TEST_TYPE"] = env["test"]
if "check" in ARGUMENTS :
env["TEST_TYPE"] = "unit"
env["checker_report"] = ARGUMENTS.get("checker_report", False)
env["TEST"] = (env["TEST_TYPE"] != "none") or env.GetOption("clean")
if env.get("valgrind", 0) :
env["TEST_RUNNER"] = "valgrind --suppressions=QA/valgrind.supp -q --leak-check=full --track-origins=yes "
env["TEST_IGNORE_RESULT"] = "ignore_test_result" in ARGUMENTS
@@ -361,19 +400,19 @@ if target in ["iphone-device", "iphone-simulator", "xcode"] :
env.Append(CCFLAGS = env["XCODE_ARCH_FLAGS"] + ["-fvisibility=hidden", "-miphoneos-version-min=" + env["IPHONEOS_DEPLOYMENT_TARGET"]])
env.Append(LINKFLAGS = "-miphoneos-version-min=" + env["IPHONEOS_DEPLOYMENT_TARGET"])
if os.environ.get("GCC_THUMB_SUPPORT", False) :
env.Append(CCFLAGS = ["-mthumb"])
env.Append(LINKFLAGS = env["XCODE_ARCH_FLAGS"])
env.Append(CPPFLAGS = ["-isysroot", "$XCODE_SDKROOT"])
env.Append(FRAMEWORKS = ["CoreFoundation", "Foundation", "UIKit", "CoreGraphics"])
env.Append(LINKFLAGS = env["XCODE_ARCH_FLAGS"] + ["-isysroot", "$XCODE_SDKROOT", "-L\"$XCODE_SDKROOT/usr/lib\"", "-F\"$XCODE_SDKROOT/System/Library/Frameworks\"", "-F\"$XCODE_SDKROOT/System/Library/PrivateFrameworks\""])
# Bit of a hack, because BOOST doesn't know the endianness for ARM
- env.Append(CPPDEFINES = ["_LITTLE_ENDIAN"])
+ env.Append(CPPDEFINES = ["_LITTLE_ENDIAN"])
################################################################################
# Android
################################################################################
if target in ["android"] :
env["ENV"]["PATH"] = env["android_toolchain"] + "/bin:" + env["ENV"]["PATH"]
env["CC"] = "arm-linux-androideabi-gcc"
env["CXX"] = "arm-linux-androideabi-g++"
env["RANLIB"] = "arm-linux-androideabi-ranlib"
diff --git a/BuildTools/SCons/SConstruct b/BuildTools/SCons/SConstruct
index 25a1ad3..7bda9c1 100644
--- a/BuildTools/SCons/SConstruct
+++ b/BuildTools/SCons/SConstruct
@@ -5,19 +5,19 @@ Import("env", "conf_env")
root = Dir("../..").abspath
# Override SConscript to handle tests
oldSConscript = SConscript
def SConscript(*arguments, **keywords) :
if not keywords.get("test_only", False) or env["TEST"] :
return apply(oldSConscript, arguments, keywords)
env.SConscript = SConscript
-
+
################################################################################
# Extend the default build environment (not affecting the configure env)
#
# Keeping both environments separated mostly because of SCons Issue 2391,
# although it doesn't hurt to separate them (e.g. not have pretty printed
# strings in config.log)
################################################################################
#if env["PLATFORM"] == "win32" :
@@ -105,20 +105,39 @@ int main(int argc, char* argv[]) {
conf = Configure(conf_env)
if not conf.CheckCXX() or not conf.CheckCC() :
print "Error: You need a working compiler"
Exit(1)
env["HAVE_ZLIB"] = True
-if conf.CheckLib("z") :
- env["ZLIB_FLAGS"] = {"LIBS": ["z"]}
+zlib_flags = {}
+zlib_okay = False
+if env.get("zlib_libdir", None) :
+ zlib_flags["LIBPATH"] = [env["zlib_libdir"]]
+ zlib_okay = True
+if env.get("zlib_includedir", None) :
+ zlib_flags["CPPPATH"] = [env["zlib_includedir"]]
+ zlib_okay = True
+if env.get("zlib_libfile", None) :
+ zlib_flags["LIBS"] = [File(env["zlib_libfile"])]
+ zlib_okay = True
+elif zlib_okay :
+ zlib_flags["LIBS"] = ["z"]
+if (not zlib_okay) and conf.CheckLib("z") :
+ zlib_flags["LIBS"] = ["z"]
+ zlib_okay = True
+if zlib_okay :
+ env["ZLIB_FLAGS"] = zlib_flags
+elif not env.get("zlib_bundled_enable", True) :
+ print "Error: Zlib not found and zlib_bundled_enable is false"
+ Exit(1)
else :
env["ZLIB_BUNDLED"] = True
if conf.CheckLib("resolv") :
env["PLATFORM_FLAGS"]["LIBS"] = env["PLATFORM_FLAGS"].get("LIBS", []) + ["resolv"]
if env["PLATFORM"] != "win32" :
if conf.CheckLib("pthread") :
env["PLATFORM_FLAGS"]["LIBS"] = env["PLATFORM_FLAGS"].get("LIBS", []) + ["pthread"]
@@ -126,64 +145,68 @@ if env["PLATFORM"] != "win32" :
if conf.CheckLib("dl") :
env["PLATFORM_FLAGS"]["LIBS"] = env["PLATFORM_FLAGS"].get("LIBS", []) + ["dl"]
if conf.CheckLib("m") :
env["PLATFORM_FLAGS"]["LIBS"] = env["PLATFORM_FLAGS"].get("LIBS", []) + ["m"]
if conf.CheckLib("c") :
env["PLATFORM_FLAGS"]["LIBS"] = env["PLATFORM_FLAGS"].get("LIBS", []) + ["c"]
-if conf.CheckLib("stdc++") :
- env["PLATFORM_FLAGS"]["LIBS"] = env["PLATFORM_FLAGS"].get("LIBS", []) + ["stdc++"]
-
+# Even if you find stdc++ on HP-UX, it is the wrong one for aCC
+if env["PLATFORM"] != "hpux" :
+ if conf.CheckLib("stdc++", language='CXX') :
+ env["PLATFORM_FLAGS"]["LIBS"] = env["PLATFORM_FLAGS"].get("LIBS", []) + ["stdc++"]
conf.Finish()
# Boost
boost_conf_env = conf_env.Clone()
boost_flags = {}
if env.get("boost_libdir", None) :
boost_flags["LIBPATH"] = [env["boost_libdir"]]
if env.get("boost_includedir", None) :
- if env["PLATFORM"] == "win32" :
+ if env["PLATFORM"] == "win32" or env["PLATFORM"] == "hpux" or env["PLATFORM"] == "sunos" :
boost_flags["CPPPATH"] = [env["boost_includedir"]]
else :
# Using isystem to avoid getting warnings from a system boost
# Unfortunately, this also disables dependency tracking
boost_flags["CPPFLAGS"] = [("-isystem", env["boost_includedir"])]
boost_conf_env.MergeFlags(boost_flags)
conf = Configure(boost_conf_env)
-boostLibs = [("signals", None), ("thread", None), ("regex", None), ("program_options", None), ("filesystem", None), ("serialization", "archive/text_oarchive.hpp"), ("system", "system/system_error.hpp"), ("date_time", "date_time/date.hpp")]
+boostLibs = [("signals", None), ("system", "system/system_error.hpp"), ("thread", None), ("regex", None), ("program_options", None), ("filesystem", None), ("serialization", "archive/text_oarchive.hpp"), ("date_time", "date_time/date.hpp")]
allLibsPresent = True
libNames = []
for (lib, header) in boostLibs :
if header :
header = "boost/" + header
else :
header = "boost/" + lib + ".hpp"
if not conf.CheckCXXHeader(header) :
allLibsPresent = False
break
if env["PLATFORM"] != "win32" :
libName = "boost_" + lib
- if not conf.CheckLib(libName) :
+ if not conf.CheckLib(libName, language='CXX') :
libName += "-mt"
- if not conf.CheckLib(libName) :
+ if not conf.CheckLib(libName, language='CXX') :
allLibsPresent = False
break
libNames.append(libName)
if allLibsPresent :
env["BOOST_FLAGS"] = boost_flags
if env["PLATFORM"] != "win32" :
env["BOOST_FLAGS"].update({"LIBS": libNames})
if not conf.CheckCXXHeader("boost/uuid/uuid.hpp") :
# FIXME: Remove this workaround when UUID is available in most distros
env["BOOST_BUNDLED_UUID_ONLY"] = True
- env["BOOST_FLAGS"]["CPPDEFINES"] = ["BOOST_SIGNALS_NO_DEPRECATION_WARNING"]
+ env["BOOST_FLAGS"]["CPPDEFINES"] = ["BOOST_SIGNALS_NO_DEPRECATION_WARNING"]
+elif not env.get("boost_bundled_enable", True) :
+ print "Error: Boost not found and boost_bundled_enable is false"
+ Exit(1)
else :
env["BOOST_BUNDLED"] = True
conf.Finish()
# Xss
env["HAVE_XSS"] = 0
if env["PLATFORM"] != "win32" and env["PLATFORM"] != "darwin" :
xss_flags = {
@@ -194,19 +217,19 @@ if env["PLATFORM"] != "win32" and env["PLATFORM"] != "darwin" :
xss_env.MergeFlags(xss_flags)
conf = Configure(xss_env)
if conf.CheckFunc("XScreenSaverQueryExtension") :
env["HAVE_XSS"] = 1
env["XSS_FLAGS"] = xss_flags
conf.Finish()
# GConf
env["HAVE_GCONF"] = 0
-if env["PLATFORM"] != "win32" and env["PLATFORM"] != "darwin" :
+if env.get("try_gconf", True) and env["PLATFORM"] != "win32" and env["PLATFORM"] != "darwin" :
gconf_env = conf_env.Clone()
conf = Configure(gconf_env, custom_tests = {"CheckPKG": CheckPKG})
if conf.CheckPKG("gconf-2.0") :
gconf_bare_env = Environment()
gconf_bare_env.ParseConfig('pkg-config --cflags gconf-2.0 gobject-2.0 --libs gconf-2.0 gobject-2.0')
gconf_flags = {
"LIBS": gconf_bare_env["LIBS"],
"CCFLAGS": gconf_bare_env["CCFLAGS"],
"CPPPATH": gconf_bare_env["CPPPATH"],
@@ -255,36 +278,36 @@ if env["PLATFORM"] == "darwin" :
env["GROWL_FRAMEWORK"] = "/Library/Frameworks/Growl.framework"
conf.Finish()
# Snarl
if env["PLATFORM"] == "win32" :
env["HAVE_SNARL"] = True
# LibXML
conf = Configure(conf_env, custom_tests = {"CheckVersion": CheckVersion})
-if conf.CheckCHeader("libxml/parser.h") and conf.CheckLib("xml2") :
+if env.get("try_libxml", True) and conf.CheckCHeader("libxml/parser.h") and conf.CheckLib("xml2") :
#and conf.CheckVersion("LibXML", "2.6.23", "LIBXML_VERSION", "libxml/xmlversion.h", 20623) :
env["HAVE_LIBXML"] = 1
env["LIBXML_FLAGS"] = { "LIBS": ["xml2"] }
conf.Finish()
-if not env.get("HAVE_LIBXML", 0) :
+if env.get("try_libxml", True) and not env.get("HAVE_LIBXML", 0) :
libxml_env = conf_env.Clone()
libxml_env.Append(CPPPATH = ["/usr/include/libxml2"])
conf = Configure(libxml_env, custom_tests = {"CheckVersion": CheckVersion})
if conf.CheckCHeader("libxml/parser.h") and conf.CheckLib("xml2") :
# and conf.CheckVersion("LibXML", "2.6.23", "LIBXML_VERSION", "libxml/xmlversion.h", 20623):
env["HAVE_LIBXML"] = 1
env["LIBXML_FLAGS"] = { "CPPPATH": ["/usr/include/libxml2"], "LIBS": ["xml2"] }
conf.Finish()
# Expat
-if not env.get("HAVE_LIBXML",0) :
+if env.get("try_expat", True) and not env.get("HAVE_LIBXML",0) :
expat_conf_env = conf_env.Clone()
expat_flags = {}
if env.get("expat_libdir", None) :
expat_flags["LIBPATH"] = [env["expat_libdir"]]
if env.get("expat_includedir", None) :
expat_flags["CPPPATH"] = [env["expat_includedir"]]
expat_conf_env.MergeFlags(expat_flags)
conf = Configure(expat_conf_env)
if conf.CheckCHeader("expat.h") and conf.CheckLib(env["expat_libname"]) :
@@ -302,19 +325,21 @@ if not env.get("HAVE_EXPAT", 0) and not env.get("HAVE_LIBXML", 0) :
env["EXPAT_BUNDLED"] = True
################################################################################
# IDN library
################################################################################
# ICU
icu_env = conf_env.Clone()
use_icu = bool(env["icu"])
-icu_prefix = env["icu"] if isinstance(env["icu"], str) else ""
+icu_prefix = ""
+if isinstance(env["icu"], str) :
+ icu_prefix = env["icu"]
icu_flags = {}
if icu_prefix :
icu_flags = { "CPPPATH": [os.path.join(icu_prefix, "include")] }
icu_flags["LIBPATH"] = [os.path.join(icu_prefix, "lib")]
icu_env.MergeFlags(icu_flags)
icu_conf = Configure(icu_env)
if use_icu and icu_conf.CheckCHeader("unicode/usprep.h") :
env["HAVE_ICU"] = 1
@@ -325,28 +350,32 @@ icu_conf.Finish()
# LibIDN
libidn_conf_env = conf_env.Clone()
libidn_flags = {}
if env.get("libidn_libdir", None) :
libidn_flags["LIBPATH"] = [env["libidn_libdir"]]
if env.get("libidn_includedir", None) :
libidn_flags["CPPPATH"] = [env["libidn_includedir"]]
libidn_conf_env.MergeFlags(libidn_flags)
conf = Configure(libidn_conf_env)
-if not env.get("HAVE_ICU") and conf.CheckCHeader("idna.h") and conf.CheckLib(env["libidn_libname"]) :
+if env.get("try_libidn", True) and not env.get("HAVE_ICU") and conf.CheckCHeader("idna.h") and conf.CheckLib(env["libidn_libname"]) :
env["HAVE_LIBIDN"] = 1
env["LIBIDN_FLAGS"] = { "LIBS": [env["libidn_libname"]] }
env["LIBIDN_FLAGS"].update(libidn_flags)
conf.Finish()
# Fallback to bundled LibIDN
if not env.get("HAVE_ICU", False) and not env.get("HAVE_LIBIDN", False) :
- env["HAVE_LIBIDN"] = 1
- env["LIBIDN_BUNDLED"] = 1
+ if env.get("libidn_bundled_enable", True) :
+ env["HAVE_LIBIDN"] = 1
+ env["LIBIDN_BUNDLED"] = 1
+ else :
+ print "Error: ICU and LIBIDN not found, and libidn_bundled_enable is false"
+ Exit(1)
# Unbound
if env["unbound"] :
env["LDNS_BUNDLED"] = 1
env["UNBOUND_BUNDLED"] = 1
else :
env["LDNS_FLAGS"] = {}
env["UNBOUND_FLAGS"] = {}
@@ -453,60 +482,73 @@ conf.Finish()
# Avahi
avahi_conf_env = conf_env.Clone()
avahi_flags = {}
if env.get("avahi_libdir", None) :
avahi_flags["LIBPATH"] = [env["avahi_libdir"]]
if env.get("avahi_includedir", None) :
avahi_flags["CPPPATH"] = [env["avahi_includedir"]]
avahi_conf_env.MergeFlags(avahi_flags)
conf = Configure(avahi_conf_env)
-if conf.CheckCHeader("avahi-client/client.h") and conf.CheckLib("avahi-client") and conf.CheckLib("avahi-common") :
+if env.get("try_avahi", True) and conf.CheckCHeader("avahi-client/client.h") and conf.CheckLib("avahi-client") and conf.CheckLib("avahi-common") :
env["HAVE_AVAHI"] = True
env["AVAHI_FLAGS"] = { "LIBS": ["avahi-client", "avahi-common"] }
env["AVAHI_FLAGS"].update(avahi_flags)
conf.Finish()
# Qt
if env["qt"] :
env["QTDIR"] = env["qt"]
# OpenSSL
openssl_env = conf_env.Clone()
if env.get("openssl_force_bundled", False) or env["target"] in ("iphone-device", "iphone-simulator", "xcode", "android") :
env["OPENSSL_BUNDLED"] = True
env["HAVE_OPENSSL"] = True
else :
use_openssl = bool(env["openssl"])
- openssl_prefix = env["openssl"] if isinstance(env["openssl"], str) else ""
+ openssl_prefix = ""
+ if isinstance(env["openssl"], str) :
+ openssl_prefix = env["openssl"]
openssl_flags = {}
if openssl_prefix :
- openssl_flags = { "CPPPATH": [os.path.join(openssl_prefix, "include")] }
- if env["PLATFORM"] == "win32" :
+ openssl_include = env.get("openssl_include", None)
+ openssl_libdir = env.get("openssl_libdir", None)
+ if openssl_include:
+ openssl_flags = {"CPPPATH":[openssl_include]}
+ else:
+ openssl_flags = { "CPPPATH": [os.path.join(openssl_prefix, "include")] }
+ if openssl_libdir:
+ openssl_flags["LIBPATH"] = [openssl_libdir]
+ env["OPENSSL_DIR"] = openssl_prefix
+ elif env["PLATFORM"] == "win32" :
openssl_flags["LIBPATH"] = [os.path.join(openssl_prefix, "lib", "VC")]
env["OPENSSL_DIR"] = openssl_prefix
else :
openssl_flags["LIBPATH"] = [os.path.join(openssl_prefix, "lib")]
openssl_env.MergeFlags(openssl_flags)
openssl_conf = Configure(openssl_env)
if use_openssl and openssl_conf.CheckCHeader("openssl/ssl.h") :
env["HAVE_OPENSSL"] = 1
env["OPENSSL_FLAGS"] = openssl_flags
- if env["PLATFORM"] == "win32" :
+ openssl_libnames = env.get("openssl_libnames", None)
+ if openssl_libnames:
+ env["OPENSSL_FLAGS"]["LIBS"] = openssl_libnames.split(',')
+ elif env["PLATFORM"] == "win32" :
env["OPENSSL_FLAGS"]["LIBS"] = ["libeay32MD", "ssleay32MD"]
else:
env["OPENSSL_FLAGS"]["LIBS"] = ["ssl", "crypto"]
if env["PLATFORM"] == "darwin" :
if platform.mac_ver()[0].startswith("10.5") :
env["OPENSSL_FLAGS"]["FRAMEWORKS"] = ["Security"]
else :
env["OPENSSL_FLAGS"] = {}
- if env["PLATFORM"] == "win32" :
+ if env["PLATFORM"] == "win32" :
env["HAVE_SCHANNEL"] = True
# If we're compiling for Windows and OpenSSL isn't being used, use Schannel
env.Append(LIBS = ["secur32"])
openssl_conf.Finish()
#Hunspell
hunspell_env = conf_env.Clone()
hunspell_prefix = env["hunspell"] if isinstance(env.get("hunspell", False), str) else ""
@@ -524,19 +566,19 @@ if hunspell_conf.CheckCXXHeader("hunspell/hunspell.hxx") and hunspell_conf.Check
hunspell_conf.Finish()
# Bonjour
if env["PLATFORM"] == "darwin" and env["target"] == "native" :
env["HAVE_BONJOUR"] = 1
elif env.get("bonjour", False) :
bonjour_env = conf_env.Clone()
bonjour_conf = Configure(bonjour_env)
bonjour_flags = {}
- if env.get("bonjour") != True :
+ if env.get("bonjour") != True :
bonjour_prefix = env["bonjour"]
bonjour_flags["CPPPATH"] = [os.path.join(bonjour_prefix, "include")]
bonjour_flags["LIBPATH"] = [os.path.join(bonjour_prefix, "lib", "win32")]
bonjour_env.MergeFlags(bonjour_flags)
if bonjour_conf.CheckCHeader("dns_sd.h") and bonjour_conf.CheckLib("dnssd") :
env["HAVE_BONJOUR"] = 1
env["BONJOUR_FLAGS"] = bonjour_flags
env["BONJOUR_FLAGS"]["LIBS"] = ["dnssd"]
bonjour_conf.Finish()
@@ -566,19 +608,19 @@ if env.get("docbook_xsl") :
env["DOCBOOK_XSL_DIR"] = env["docbook_xsl"]
################################################################################
# Set up git hooks
################################################################################
try:
if env.Dir("#/.git").exists() :
- if not env.GetOption("clean") :
+ if not env.GetOption("clean") and env.get("install_git_hooks", True) :
env.Install("#/.git/hooks", Glob("#/BuildTools/Git/Hooks/*"))
except TypeError:
print "You seem to be using Swift in a Git submodule. Not installing hooks."
################################################################################
# Replace #pragma once with proper guards on platforms that require it
################################################################################
@@ -660,12 +702,12 @@ if env.get("HAVE_LIBXML", 0):
parsers.append("LibXML")
if env.get("HAVE_EXPAT", 0):
parsers.append("Expat")
if env.get("EXPAT_BUNDLED", False) :
parsers.append("(Bundled)")
print " Projects: " + ' '.join(env["PROJECTS"])
print ""
print " XML Parsers: " + ' '.join(parsers)
-print " TLS Support: " + ("OpenSSL" if env.get("HAVE_OPENSSL",0) else ("Schannel" if env.get("HAVE_SCHANNEL", 0) else "Disabled"))
-print " DNSSD Support: " + ("Bonjour" if env.get("HAVE_BONJOUR") else ("Avahi" if env.get("HAVE_AVAHI") else "Disabled"))
+print " TLS Support: " + (env.get("HAVE_OPENSSL",0) and "OpenSSL" or env.get("HAVE_SCHANNEL", 0) and "Schannel" or "Disabled")
+print " DNSSD Support: " + (env.get("HAVE_BONJOUR") and "Bonjour" or (env.get("HAVE_AVAHI") and "Avahi" or "Disabled"))
print
diff --git a/BuildTools/SCons/Tools/Test.py b/BuildTools/SCons/Tools/Test.py
index 95fcce9..7e4609d 100644
--- a/BuildTools/SCons/Tools/Test.py
+++ b/BuildTools/SCons/Tools/Test.py
@@ -1,21 +1,24 @@
import SCons.Util, os
def generate(env) :
def registerTest(env, target, type = "unit", is_checker = False) :
if env["TEST_TYPE"] == "all" or env["TEST_TYPE"] == type :
- cmd = target[0].abspath if SCons.Util.is_List(target) else target.abspath
+ if SCons.Util.is_List(target) :
+ cmd = target[0].abspath
+ else :
+ cmd = target.abspath
params = ""
# Special support for unittest checker
if is_checker and env.get("checker_report", False) :
params = " --xml > " + os.path.join(target[0].dir.path, "checker-report.xml")
-
+
ignore_prefix = ""
if env.get("TEST_IGNORE_RESULT", False) :
ignore_prefix = "-"
# Set environment variables for running the test
test_env = env.Clone()
for i in ["HOME", "USERPROFILE", "APPDATA"]:
if os.environ.get(i, "") :
test_env["ENV"][i] = os.environ[i]
@@ -27,22 +30,22 @@ def generate(env) :
elif test_env["PLATFORM"] == "win32" :
test_env["ENV"]["PATH"] = ";".join(map(lambda x : str(x), test_env.get("LIBRUNPATH", []))) + ";" + test_env["ENV"]["PATH"]
# Run the test
if env["target"] == "android":
exec_name = os.path.basename(cmd)
test_env.Command("**dummy**", target, SCons.Action.Action(
["adb shell mount -o rw,remount /system",
- "adb push " + cmd + " /system/bin/" + exec_name,
+ "adb push " + cmd + " /system/bin/" + exec_name,
"adb shell SWIFT_CLIENTTEST_JID=\"" + os.getenv("SWIFT_CLIENTTEST_JID") + "\" SWIFT_CLIENTTEST_PASS=\"" + os.getenv("SWIFT_CLIENTTEST_PASS") + "\" " + env.get("TEST_RUNNER", "") + "/system/bin/" + exec_name], cmdstr = "$TESTCOMSTR"))
else :
- test_env.Command("**dummy**", target,
+ test_env.Command("**dummy**", target,
SCons.Action.Action(ignore_prefix + env.get("TEST_RUNNER", "") + cmd + " " + params, cmdstr = "$TESTCOMSTR"))
def registerScriptTests(env, scripts, name, type) :
if env["TEST_TYPE"] == "all" or env["TEST_TYPE"] == type :
pass
env.AddMethod(registerTest, "Test")
env.AddMethod(registerScriptTests, "ScriptTests")
diff --git a/BuildTools/SCons/Version.py b/BuildTools/SCons/Version.py
index f98a8b9..2f3b5a5 100644
--- a/BuildTools/SCons/Version.py
+++ b/BuildTools/SCons/Version.py
@@ -4,38 +4,40 @@ def getGitBuildVersion(root, project) :
tag = git("describe --tags --exact --match \"" + project + "-*\"", root)
if tag :
return tag.rstrip()[len(project)+1:]
tag = git("describe --tags --match \"" + project + "-*\"", root)
if tag :
m = re.match(project + "-(.*)-(.*)-(.*)", tag)
if m :
return m.group(1) + "-dev" + m.group(2)
return None
-
+
def git(cmd, root) :
full_cmd = "git " + cmd
p = subprocess.Popen(full_cmd, cwd=root, shell=True, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE, close_fds=(os.name != "nt"))
gitVersion = p.stdout.read()
# error = p.stderr.read()
# if error:
# print "Git error: " + error
p.stdin.close()
- return gitVersion if p.wait() == 0 else None
+ if p.wait() == 0 :
+ return gitVersion
+ return None
def getBuildVersion(root, project) :
versionFilename = os.path.join(root, "VERSION." + project)
if os.path.isfile(versionFilename) :
f = open(versionFilename)
version = f.read().strip()
f.close()
return version
- gitVersion = getGitBuildVersion(root, project)
+ gitVersion = getGitBuildVersion(root, project)
if gitVersion :
return gitVersion
return datetime.date.today().strftime("%Y%m%d")
def convertToWindowsVersion(version) :
version_match = re.match("(\d+)\.(\d+)(.*)", version)
major = int(version_match.group(1)) if version_match else 0
minor = int(version_match.group(2)) if version_match else 0
@@ -53,15 +55,14 @@ def convertToWindowsVersion(version) :
patch = 10000*int(rc_match.group(1))
build_string = rc_match.group(2)
else :
patch = 0
alpha_match = re.match("^alpha(.*)", version_match.group(3))
if alpha_match :
build_string = alpha_match.group(1)
if len(build_string) > 0 :
- build_match = re.match("^-dev(\d+)", build_string)
+ build_match = re.match("^-dev(\d+)", build_string)
if build_match :
patch += int(build_match.group(1))
return (major, minor, patch)
-
diff --git a/COPYING.thirdparty b/COPYING.thirdparty
index a4b505c..c2c01f7 100644
--- a/COPYING.thirdparty
+++ b/COPYING.thirdparty
@@ -122,18 +122,51 @@ All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WA RRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
--- END OF SIMPLIFIED BSD LICENSE
+Solaris builds compile Swiften/Network/SolarisNetworkEnvironment.cpp
+which incorporates getifaddrs() code under the following license:
+
+--- START OF SOLARIS getifaddrs() LICENSE
+
+Copyright (c) 2006 WIDE Project. All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions
+are met:
+1. Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+3. Neither the name of the project nor the names of its contributors
+ may be used to endorse or promote products derived from this software
+ without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
+FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+SUCH DAMAGE.
+
+--- END OF SOLARIS getifaddrs() LICENSE
+
===============
Google Breakpad
===============
Copyright (c) 2006, Google Inc.
All rights reserved.
Redistribution and use in source and binary forms, with or without
@@ -397,19 +430,19 @@ interface definition files, plus the scripts used to control compilation
and installation of the library.
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running a program using the Library is not restricted, and output from
such a program is covered only if its contents constitute a work based
on the Library (independent of the use of the Library in a tool for
writing it). Whether that is true depends on what the Library does
and what the program that uses the Library does.
-
+
1. You may copy and distribute verbatim copies of the Library's
complete source code as you receive it, in any medium, provided that
you conspicuously and appropriately publish on each copy an
appropriate copyright notice and disclaimer of warranty; keep intact
all the notices that refer to this License and to the absence of any
warranty; and distribute a copy of this License along with the
Library.
You may charge a fee for the physical act of transferring a copy,
diff --git a/Documentation/SwiftenDevelopersGuide/Examples/EchoBot/SConscript b/Documentation/SwiftenDevelopersGuide/Examples/EchoBot/SConscript
index 24ebd60..5d27b70 100644
--- a/Documentation/SwiftenDevelopersGuide/Examples/EchoBot/SConscript
+++ b/Documentation/SwiftenDevelopersGuide/Examples/EchoBot/SConscript
@@ -15,18 +15,22 @@ for i in range(1,7) :
example_env.Program("EchoBot" + str(i), ["EchoBot" + str(i) + ".cpp"])
example_env.Program("EchoComponent", "EchoComponent.cpp")
# C++0x
cpp0x = False
cpp0x_env = example_env.Clone()
if env["PLATFORM"] == "win32" :
if int(env["MSVS_VERSION"].split(".")[0]) >= 10 :
cpp0x = True
+elif env["PLATFORM"] == "hpux" :
+ pass
+elif env["PLATFORM"] == "sunos" :
+ pass
else :
if env["CCVERSION"].split(".") >= ["4", "5", "0"] :
# Temporarily disabling c++0x mode because of problems with boost::thread
# on some platforms
#cpp0x = True
cpp0x_env.Replace(CXXFLAGS = [flag for flag in env["CXXFLAGS"] if flag != "-Werror"])
cpp0x_env.Append(CXXFLAGS = ["-std=c++0x"])
if cpp0x :
cpp0x_env.Program("EchoBot0x", "EchoBot0x.cpp")
diff --git a/Documentation/SwiftenDevelopersGuide/SConscript b/Documentation/SwiftenDevelopersGuide/SConscript
index c50641f..ba0eb0b 100644
--- a/Documentation/SwiftenDevelopersGuide/SConscript
+++ b/Documentation/SwiftenDevelopersGuide/SConscript
@@ -28,21 +28,23 @@ def generateDocBookCode(env, target, source) :
# FIXME: Takes the largest match
m = re.match(".*\/* \(\*\) (.*) \*/.*", line)
if m :
cobID = "cob-" + calloutPrefix + "-" + str(nextID)
coID = "co-" + calloutPrefix + "-" + str(nextID)
nextID += 1
line = re.sub("/\*.*\*/", "]]><co id=\"%(cobID)s\" linkends=\"%(coID)s\"/><![CDATA[" % {"cobID" : cobID, "coID" : coID}, line)
calloutLines.append("<callout arearefs=\"%(cobID)s\" id=\"%(coID)s\"><para>%(text)s</para></callout>" % {"cobID": cobID, "coID": coID, "text": m.group(1)})
newProgramLines.append(line)
- callouts = "<calloutlist>" + "\n".join(calloutLines) + "</calloutlist>" if len(calloutLines) > 0 else ""
+ callouts = ""
+ if len(calloutLines) > 0 :
+ callouts = "<calloutlist>" + "\n".join(calloutLines) + "</calloutlist>"
return ("\n".join(newProgramLines), callouts)
-
+
# Parse program
filename = source[0].abspath
filenameBase = os.path.basename(filename).replace(".cpp", "")
inputfile = open(filename)
program = ""
programs = {}
programName = ""
inEllipsis = False
for line in inputfile.readlines() :
diff --git a/QA/Checker/SConscript b/QA/Checker/SConscript
index d180af2..b0863da 100644
--- a/QA/Checker/SConscript
+++ b/QA/Checker/SConscript
@@ -1,17 +1,17 @@
Import("env")
if env["TEST"] :
if env["SCONS_STAGE"] == "flags" :
- env["CHECKER_FLAGS"] = {
+ env["CHECKER_FLAGS"] = {
"CPPPATH" : ["#/3rdParty/HippoMocks"],
"LIBS": ["Checker"],
"LIBPATH": [Dir(".")],
- "LINKFLAGS": ["/SUBSYSTEM:CONSOLE"] if env["PLATFORM"] == "win32" else []
+ "LINKFLAGS": env["PLATFORM"] == "win32" and ["/SUBSYSTEM:CONSOLE"] or []
}
if env["SCONS_STAGE"] == "build" :
checker_env = env.Clone()
checker_env.UseFlags(env["SWIFTEN_FLAGS"])
checker_env.UseFlags(env["BOOST_FLAGS"])
checker_env.UseFlags(env["CPPUNIT_FLAGS"])
checker_env.Library("Checker", ["checker.cpp", "IO.cpp"])
diff --git a/Slimber/SConscript b/Slimber/SConscript
index 2298b0a..ff4f57d 100644
--- a/Slimber/SConscript
+++ b/Slimber/SConscript
@@ -1,24 +1,28 @@
-import datetime
+import datetime
Import("env")
env["BUILD_SLIMBER"] = True
if env["PLATFORM"] == "win32" :
if not env.get("HAVE_BONJOUR") and "Slimber" in env["PROJECTS"] :
env["PROJECTS"].remove("Slimber")
elif env["PLATFORM"] != "darwin" :
if not env.get("HAVE_AVAHI", False) and "Slimber" in env["PROJECTS"] :
env["PROJECTS"].remove("Slimber")
if not "Slimber" in env["PROJECTS"] and env["SCONS_STAGE"] == "flags" :
print "Bonjour missing. Not building Slimber."
+if not env.get("HAVE_QT", False) and "Slimber" in env["PROJECTS"] :
+ print "Qt missing. Not building Slimber."
+ env["PROJECTS"].remove("Slimber")
+
if "Slimber" in env["PROJECTS"] :
################################################################################
# Flags
################################################################################
if env["SCONS_STAGE"] == "flags" :
env["SLIMBER_FLAGS"] = {
"LIBPATH": [Dir(".")],
@@ -39,19 +43,19 @@ if "Slimber" in env["PROJECTS"] :
"LinkLocalPresenceManager.cpp",
"FileVCardCollection.cpp",
"VCardCollection.cpp",
"Server.cpp",
"MainController.cpp",
"MenuletController.cpp",
"Menulet.cpp"
])
-
+
env["SLIMBER_VERSION"] = "0.9.9." + datetime.date.today().strftime("%Y%m%d")
env.Append(UNITTEST_SOURCES = [
File("UnitTest/LinkLocalPresenceManagerTest.cpp"),
File("UnitTest/MenuletControllerTest.cpp")
])
SConscript("CLI/SConscript")
if env["PLATFORM"] == "darwin" :
diff --git a/SwifTools/Application/UnixApplicationPathProvider.cpp b/SwifTools/Application/UnixApplicationPathProvider.cpp
index 784256f..6af9b24 100644
--- a/SwifTools/Application/UnixApplicationPathProvider.cpp
+++ b/SwifTools/Application/UnixApplicationPathProvider.cpp
@@ -1,17 +1,18 @@
/*
* Copyright (c) 2010 Remko Tronçon
* Licensed under the GNU General Public License v3.
* See Documentation/Licenses/GPLv3.txt for more information.
*/
#include <SwifTools/Application/UnixApplicationPathProvider.h>
+#include <stdlib.h>
#include <unistd.h>
#include <boost/algorithm/string.hpp>
#include <iostream>
#include <Swiften/Base/String.h>
#include <Swiften/Base/foreach.h>
namespace Swift {
@@ -38,20 +39,20 @@ boost::filesystem::path UnixApplicationPathProvider::getHomeDir() const {
}
boost::filesystem::path UnixApplicationPathProvider::getDataDir() const {
char* xdgDataHome = getenv("XDG_DATA_HOME");
std::string dataDir;
if (xdgDataHome) {
dataDir = std::string(xdgDataHome);
}
- boost::filesystem::path dataPath = (dataDir.empty() ?
- getHomeDir() / ".local" / "share"
+ boost::filesystem::path dataPath = (dataDir.empty() ?
+ getHomeDir() / ".local" / "share"
: boost::filesystem::path(dataDir)) / boost::to_lower_copy(getApplicationName());
try {
boost::filesystem::create_directories(dataPath);
}
catch (const boost::filesystem::filesystem_error& e) {
std::cerr << "ERROR: " << e.what() << std::endl;
}
return dataPath;
diff --git a/Swiften/Client/XMLBeautifier.h b/Swiften/Client/XMLBeautifier.h
index 44dfd20..25ecd18 100644
--- a/Swiften/Client/XMLBeautifier.h
+++ b/Swiften/Client/XMLBeautifier.h
@@ -1,17 +1,24 @@
/*
* Copyright (c) 2011 Tobias Markmann
* Licensed under the simplified BSD license.
* See Documentation/Licenses/BSD-simplified.txt for more information.
*/
+/*
+* Copyright (c) 2014 Remko Tronçon and Kevin Smith
+* Licensed under the GNU General Public License v3.
+* See Documentation/Licenses/GPLv3.txt for more information.
+*/
+
#pragma once
+#include <sstream>
#include <string>
#include <stack>
#include <Swiften/Base/boost_bsignals.h>
#include <Swiften/Parser/XMLParserFactory.h>
#include <Swiften/Parser/XMLParserClient.h>
#include <Swiften/Parser/XMLParser.h>
namespace Swift {
diff --git a/Swiften/EventLoop/EventLoop.h b/Swiften/EventLoop/EventLoop.h
index 587ba22..79ade49 100644
--- a/Swiften/EventLoop/EventLoop.h
+++ b/Swiften/EventLoop/EventLoop.h
@@ -1,43 +1,43 @@
/*
* Copyright (c) 2010 Remko Tronçon
* Licensed under the GNU General Public License v3.
* See Documentation/Licenses/GPLv3.txt for more information.
*/
#pragma once
#include <boost/function.hpp>
-#include <boost/thread/mutex.hpp>
+#include <boost/thread.hpp>
#include <list>
#include <deque>
#include <Swiften/Base/API.h>
#include <Swiften/EventLoop/Event.h>
namespace Swift {
class EventOwner;
class SWIFTEN_API EventLoop {
public:
EventLoop();
virtual ~EventLoop();
-
+
void postEvent(boost::function<void ()> event, boost::shared_ptr<EventOwner> owner = boost::shared_ptr<EventOwner>());
void removeEventsFromOwner(boost::shared_ptr<EventOwner> owner);
protected:
/**
* Reimplement this to call handleEvent(event) from the thread in which
* the event loop is residing.
*/
virtual void post(const Event& event) = 0;
-
+
void handleEvent(const Event& event);
private:
boost::mutex eventsMutex_;
unsigned int nextEventID_;
std::list<Event> events_;
bool handlingEvents_;
std::deque<Event> eventsToHandle_;
};
diff --git a/Swiften/LinkLocal/DNSSD/Bonjour/BonjourRegisterQuery.h b/Swiften/LinkLocal/DNSSD/Bonjour/BonjourRegisterQuery.h
index 1bec5f7..45628e2 100644
--- a/Swiften/LinkLocal/DNSSD/Bonjour/BonjourRegisterQuery.h
+++ b/Swiften/LinkLocal/DNSSD/Bonjour/BonjourRegisterQuery.h
@@ -1,32 +1,34 @@
/*
- * Copyright (c) 2010 Remko Tronçon
+ * Copyright (c) 2010-2014 Remko Tronçon
* Licensed under the GNU General Public License v3.
* See Documentation/Licenses/GPLv3.txt for more information.
*/
#pragma once
-#include <Swiften/LinkLocal/DNSSD/Bonjour/BonjourQuery.h>
-#include <Swiften/LinkLocal/DNSSD/DNSSDRegisterQuery.h>
+#include <boost/numeric/conversion/cast.hpp>
+#include <boost/thread.hpp>
+
#include <Swiften/Base/ByteArray.h>
#include <Swiften/EventLoop/EventLoop.h>
-#include <boost/numeric/conversion/cast.hpp>
+#include <Swiften/LinkLocal/DNSSD/Bonjour/BonjourQuery.h>
+#include <Swiften/LinkLocal/DNSSD/DNSSDRegisterQuery.h>
namespace Swift {
class BonjourQuerier;
class BonjourRegisterQuery : public DNSSDRegisterQuery, public BonjourQuery {
- public:
+ public:
BonjourRegisterQuery(const std::string& name, int port, const ByteArray& txtRecord, boost::shared_ptr<BonjourQuerier> querier, EventLoop* eventLoop) : BonjourQuery(querier, eventLoop) {
DNSServiceErrorType result = DNSServiceRegister(
- &sdRef, 0, 0, name.c_str(), "_presence._tcp", NULL, NULL, boost::numeric_cast<unsigned short>(port),
- boost::numeric_cast<unsigned short>(txtRecord.size()), vecptr(txtRecord),
+ &sdRef, 0, 0, name.c_str(), "_presence._tcp", NULL, NULL, boost::numeric_cast<unsigned short>(port),
+ boost::numeric_cast<unsigned short>(txtRecord.size()), vecptr(txtRecord),
&BonjourRegisterQuery::handleServiceRegisteredStatic, this);
if (result != kDNSServiceErr_NoError) {
sdRef = NULL;
}
}
void registerService() {
if (sdRef) {
run();
diff --git a/Swiften/Network/PlatformNetworkEnvironment.h b/Swiften/Network/PlatformNetworkEnvironment.h
index c6b945e..2092bfd 100644
--- a/Swiften/Network/PlatformNetworkEnvironment.h
+++ b/Swiften/Network/PlatformNetworkEnvironment.h
@@ -12,15 +12,21 @@
#include <Swiften/Network/UnixNetworkEnvironment.h>
namespace Swift {
typedef UnixNetworkEnvironment PlatformNetworkEnvironment;
}
#elif defined(SWIFTEN_PLATFORM_WIN32)
#include <Swiften/Network/WindowsNetworkEnvironment.h>
namespace Swift {
typedef WindowsNetworkEnvironment PlatformNetworkEnvironment;
}
+#elif defined(SWIFTEN_PLATFORM_SOLARIS)
+#include <Swiften/Network/SolarisNetworkEnvironment.h>
+namespace Swift {
+ typedef SolarisNetworkEnvironment PlatformNetworkEnvironment;
+}
+
#else
#include <Swiften/Network/UnixNetworkEnvironment.h>
namespace Swift {
typedef UnixNetworkEnvironment PlatformNetworkEnvironment;
}
#endif
diff --git a/Swiften/Network/SConscript b/Swiften/Network/SConscript
index fcc66b4..284c1f4 100644
--- a/Swiften/Network/SConscript
+++ b/Swiften/Network/SConscript
@@ -64,33 +64,37 @@ else :
sourceList.append("PlatformDomainNameAddressQuery.cpp")
if myenv["PLATFORM"] == "darwin" and myenv["target"] != "android":
myenv.Append(FRAMEWORKS = ["CoreServices", "SystemConfiguration"])
sourceList += [ "MacOSXProxyProvider.cpp" ]
sourceList += [ "UnixNetworkEnvironment.cpp" ]
elif myenv["PLATFORM"] == "win32" :
sourceList += [ "WindowsProxyProvider.cpp" ]
sourceList += [ "WindowsNetworkEnvironment.cpp" ]
+elif myenv["PLATFORM"] == "sunos" :
+ sourceList += [ "UnixProxyProvider.cpp" ]
+ sourceList += [ "SolarisNetworkEnvironment.cpp" ]
+ sourceList += [ "EnvironmentProxyProvider.cpp" ]
else :
sourceList += [ "UnixNetworkEnvironment.cpp" ]
sourceList += [ "UnixProxyProvider.cpp" ]
sourceList += [ "EnvironmentProxyProvider.cpp" ]
if myenv.get("HAVE_GCONF", 0) :
myenv.Append(CPPDEFINES = "HAVE_GCONF")
myenv.MergeFlags(myenv["GCONF_FLAGS"])
sourceList += [ "GConfProxyProvider.cpp" ]
objects = myenv.SwiftenObject(sourceList)
-if myenv["experimental_ft"] :
+if myenv["experimental_ft"] :
# LibNATPMP classes
if myenv.get("HAVE_LIBNATPMP", False) :
- natpmp_env = myenv.Clone()
+ natpmp_env = myenv.Clone()
natpmp_env.Append(CPPDEFINES = natpmp_env["LIBNATPMP_FLAGS"].get("INTERNAL_CPPDEFINES", []))
myenv.Append(CPPDEFINES = ["HAVE_LIBNATPMP"])
objects += natpmp_env.SwiftenObject([
"NATPMPInterface.cpp",
])
# LibMINIUPnP classes
if myenv.get("HAVE_LIBMINIUPNPC", False) :
upnp_env = myenv.Clone()
diff --git a/Swiften/Network/SolarisNetworkEnvironment.cpp b/Swiften/Network/SolarisNetworkEnvironment.cpp
new file mode 100644
index 0000000..93eec32
--- /dev/null
+++ b/Swiften/Network/SolarisNetworkEnvironment.cpp
@@ -0,0 +1,292 @@
+/*
+ * Copyright (c) 2011 Tobias Markmann
+ * Licensed under the simplified BSD license.
+ * See Documentation/Licenses/BSD-simplified.txt for more information.
+ */
+
+/*
+* Copyright (c) 2013-2014 Remko Tronçon and Kevin Smith
+* Licensed under the GNU General Public License v3.
+* See Documentation/Licenses/GPLv3.txt for more information.
+*/
+
+#include <Swiften/Network/SolarisNetworkEnvironment.h>
+
+#include <string>
+#include <vector>
+#include <map>
+#include <boost/optional.hpp>
+
+#include <unistd.h>
+#include <stdlib.h>
+#include <errno.h>
+#include <string.h>
+#include <sys/sockio.h>
+#include <sys/socket.h>
+#include <sys/types.h>
+#include <net/if.h>
+
+#include <Swiften/Base/boost_bsignals.h>
+#include <Swiften/Network/HostAddress.h>
+#include <Swiften/Network/NetworkInterface.h>
+
+/*
+ * Copyright (c) 2006 WIDE Project. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the project nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#undef ifa_broadaddr
+#undef ifa_dstaddr
+struct ifaddrs {
+ struct ifaddrs *ifa_next; /* Pointer to next struct */
+ char *ifa_name; /* Interface name */
+ uint64_t ifa_flags; /* Interface flags */
+ struct sockaddr *ifa_addr; /* Interface address */
+ struct sockaddr *ifa_netmask; /* Interface netmask */
+ struct sockaddr *ifa_dstaddr; /* P2P interface destination */
+};
+#define ifa_broadaddr ifa_dstaddr
+
+static int
+get_lifreq(int fd, struct lifreq **ifr_ret)
+{
+ struct lifnum lifn;
+ struct lifconf lifc;
+ struct lifreq *lifrp;
+
+ lifn.lifn_family = AF_UNSPEC;
+ lifn.lifn_flags = 0;
+ if (ioctl(fd, SIOCGLIFNUM, &lifn) == -1)
+ lifn.lifn_count = 16;
+ else
+ lifn.lifn_count += 16;
+
+ for (;;) {
+ lifc.lifc_len = lifn.lifn_count * sizeof (*lifrp);
+ lifrp = (struct lifreq *) malloc(lifc.lifc_len);
+ if (lifrp == NULL)
+ return (-1);
+
+ lifc.lifc_family = AF_UNSPEC;
+ lifc.lifc_flags = 0;
+ lifc.lifc_buf = (char *)lifrp;
+ if (ioctl(fd, SIOCGLIFCONF, &lifc) == -1) {
+ free(lifrp);
+ if (errno == EINVAL) {
+ lifn.lifn_count <<= 1;
+ continue;
+ }
+ (void) close(fd);
+ return (-1);
+ }
+ if (lifc.lifc_len < (lifn.lifn_count - 1) * sizeof (*lifrp))
+ break;
+ free(lifrp);
+ lifn.lifn_count <<= 1;
+ }
+ (void) close(fd);
+
+ *ifr_ret = lifrp;
+
+ return (lifc.lifc_len / sizeof (*lifrp));
+}
+
+static size_t
+nbytes(const struct lifreq *lifrp, int nlif, size_t socklen)
+{
+ size_t len = 0;
+ size_t slen;
+
+ while (nlif > 0) {
+ slen = strlen(lifrp->lifr_name) + 1;
+ len += sizeof (struct ifaddrs) + ((slen + 3) & ~3);
+ len += 3 * socklen;
+ lifrp++;
+ nlif--;
+ }
+ return (len);
+}
+
+static struct sockaddr *
+addrcpy(struct sockaddr_storage *addr, char **bufp)
+{
+ char *buf = *bufp;
+ size_t len;
+
+ len = addr->ss_family == AF_INET ? sizeof (struct sockaddr_in) :
+ sizeof (struct sockaddr_in6);
+ (void) memcpy(buf, addr, len);
+ *bufp = buf + len;
+ return ((struct sockaddr *)buf);
+}
+
+static int
+populate(struct ifaddrs *ifa, int fd, struct lifreq *lifrp, int nlif, int af,
+ char **bufp)
+{
+ char *buf = *bufp;
+ size_t slen;
+
+ while (nlif > 0) {
+ ifa->ifa_next = (nlif > 1) ? ifa + 1 : NULL;
+ (void) strcpy(ifa->ifa_name = buf, lifrp->lifr_name);
+ slen = strlen(lifrp->lifr_name) + 1;
+ buf += (slen + 3) & ~3;
+ if (ioctl(fd, SIOCGLIFFLAGS, lifrp) == -1)
+ ifa->ifa_flags = 0;
+ else
+ ifa->ifa_flags = lifrp->lifr_flags;
+ if (ioctl(fd, SIOCGLIFADDR, lifrp) == -1)
+ ifa->ifa_addr = NULL;
+ else
+ ifa->ifa_addr = addrcpy(&lifrp->lifr_addr, &buf);
+ if (ioctl(fd, SIOCGLIFNETMASK, lifrp) == -1)
+ ifa->ifa_netmask = NULL;
+ else
+ ifa->ifa_netmask = addrcpy(&lifrp->lifr_addr, &buf);
+ if (ifa->ifa_flags & IFF_POINTOPOINT) {
+ if (ioctl(fd, SIOCGLIFDSTADDR, lifrp) == -1)
+ ifa->ifa_dstaddr = NULL;
+ else
+ ifa->ifa_dstaddr =
+ addrcpy(&lifrp->lifr_dstaddr, &buf);
+ } else if (ifa->ifa_flags & IFF_BROADCAST) {
+ if (ioctl(fd, SIOCGLIFBRDADDR, lifrp) == -1)
+ ifa->ifa_broadaddr = NULL;
+ else
+ ifa->ifa_broadaddr =
+ addrcpy(&lifrp->lifr_broadaddr, &buf);
+ } else {
+ ifa->ifa_dstaddr = NULL;
+ }
+
+ ifa++;
+ nlif--;
+ lifrp++;
+ }
+ *bufp = buf;
+ return (0);
+}
+
+static int
+getifaddrs(struct ifaddrs **ifap)
+{
+ int fd4, fd6;
+ int nif4, nif6 = 0;
+ struct lifreq *ifr4 = NULL;
+ struct lifreq *ifr6 = NULL;
+ struct ifaddrs *ifa = NULL;
+ char *buf;
+
+ if ((fd4 = socket(AF_INET, SOCK_DGRAM, 0)) == -1)
+ return (-1);
+ if ((fd6 = socket(AF_INET6, SOCK_DGRAM, 0)) == -1 &&
+ errno != EAFNOSUPPORT) {
+ (void) close(fd4);
+ return (-1);
+ }
+
+ if ((nif4 = get_lifreq(fd4, &ifr4)) == -1 ||
+ (fd6 != -1 && (nif6 = get_lifreq(fd6, &ifr6)) == -1))
+ goto failure;
+
+ if (nif4 == 0 && nif6 == 0) {
+ *ifap = NULL;
+ return (0);
+ }
+
+ ifa = (struct ifaddrs *) malloc(nbytes(ifr4, nif4, sizeof (struct sockaddr_in)) +
+ nbytes(ifr6, nif6, sizeof (struct sockaddr_in6)));
+ if (ifa == NULL)
+ goto failure;
+
+ buf = (char *)(ifa + nif4 + nif6);
+
+ if (populate(ifa, fd4, ifr4, nif4, AF_INET, &buf) == -1)
+ goto failure;
+ if (nif4 > 0 && nif6 > 0)
+ ifa[nif4 - 1].ifa_next = ifa + nif4;
+ if (populate(ifa + nif4, fd6, ifr6, nif6, AF_INET6, &buf) == -1)
+ goto failure;
+
+ return (0);
+
+failure:
+ free(ifa);
+ (void) close(fd4);
+ if (fd6 != -1)
+ (void) close(fd6);
+ free(ifr4);
+ free(ifr6);
+ return (-1);
+}
+
+static void
+freeifaddrs(struct ifaddrs *ifa)
+{
+ free(ifa);
+}
+
+/* End WIDE Project code */
+
+namespace Swift {
+
+std::vector<NetworkInterface> SolarisNetworkEnvironment::getNetworkInterfaces() const {
+ std::map<std::string, NetworkInterface> interfaces;
+
+ ifaddrs* addrs = 0;
+ int ret = getifaddrs(&addrs);
+ if (ret != 0) {
+ return std::vector<NetworkInterface>();
+ }
+
+ for (ifaddrs* a = addrs; a != 0; a = a->ifa_next) {
+ std::string name(a->ifa_name);
+ boost::optional<HostAddress> address;
+ if (a->ifa_addr->sa_family == PF_INET) {
+ sockaddr_in* sa = reinterpret_cast<sockaddr_in*>(a->ifa_addr);
+ address = HostAddress(reinterpret_cast<const unsigned char*>(&(sa->sin_addr)), 4);
+ }
+ else if (a->ifa_addr->sa_family == PF_INET6) {
+ sockaddr_in6* sa = reinterpret_cast<sockaddr_in6*>(a->ifa_addr);
+ address = HostAddress(reinterpret_cast<const unsigned char*>(&(sa->sin6_addr)), 16);
+ }
+ if (address) {
+ std::map<std::string, NetworkInterface>::iterator i = interfaces.insert(std::make_pair(name, NetworkInterface(name, a->ifa_flags & IFF_LOOPBACK))).first;
+ i->second.addAddress(*address);
+ }
+ }
+
+ freeifaddrs(addrs);
+
+ std::vector<NetworkInterface> result;
+ for (std::map<std::string,NetworkInterface>::const_iterator i = interfaces.begin(); i != interfaces.end(); ++i) {
+ result.push_back(i->second);
+ }
+ return result;
+}
+
+}
diff --git a/Swiften/Network/SolarisNetworkEnvironment.h b/Swiften/Network/SolarisNetworkEnvironment.h
new file mode 100644
index 0000000..7481ff4
--- /dev/null
+++ b/Swiften/Network/SolarisNetworkEnvironment.h
@@ -0,0 +1,29 @@
+/*
+ * Copyright (c) 2011 Tobias Markmann
+ * Licensed under the simplified BSD license.
+ * See Documentation/Licenses/BSD-simplified.txt for more information.
+ */
+
+/*
+* Copyright (c) 2013-2014 Remko Tronçon and Kevin Smith
+* Licensed under the GNU General Public License v3.
+* See Documentation/Licenses/GPLv3.txt for more information.
+*/
+
+#pragma once
+
+#include <vector>
+
+#include <Swiften/Base/boost_bsignals.h>
+
+#include <Swiften/Network/NetworkEnvironment.h>
+#include <Swiften/Network/NetworkInterface.h>
+
+namespace Swift {
+
+ class SolarisNetworkEnvironment : public NetworkEnvironment {
+ public:
+ std::vector<NetworkInterface> getNetworkInterfaces() const;
+ };
+
+}
diff --git a/Swiften/Parser/PayloadParserFactoryCollection.cpp b/Swiften/Parser/PayloadParserFactoryCollection.cpp
index e3efc3d..269ac3d 100644
--- a/Swiften/Parser/PayloadParserFactoryCollection.cpp
+++ b/Swiften/Parser/PayloadParserFactoryCollection.cpp
@@ -1,11 +1,11 @@
/*
- * Copyright (c) 2010 Remko Tronçon
+ * Copyright (c) 2010-2014 Remko Tronçon
* Licensed under the GNU General Public License v3.
* See Documentation/Licenses/GPLv3.txt for more information.
*/
#include <boost/bind.hpp>
#include <algorithm>
#include <Swiften/Parser/PayloadParserFactoryCollection.h>
#include <Swiften/Parser/PayloadParserFactory.h>
@@ -14,24 +14,24 @@ namespace Swift {
PayloadParserFactoryCollection::PayloadParserFactoryCollection() : defaultFactory_(NULL) {
}
void PayloadParserFactoryCollection::addFactory(PayloadParserFactory* factory) {
factories_.push_back(factory);
}
void PayloadParserFactoryCollection::removeFactory(PayloadParserFactory* factory) {
- factories_.erase(remove(factories_.begin(), factories_.end(), factory), factories_.end());
+ factories_.erase(std::remove(factories_.begin(), factories_.end(), factory), factories_.end());
}
void PayloadParserFactoryCollection::setDefaultFactory(PayloadParserFactory* factory) {
defaultFactory_ = factory;
}
PayloadParserFactory* PayloadParserFactoryCollection::getPayloadParserFactory(const std::string& element, const std::string& ns, const AttributeMap& attributes) {
std::vector<PayloadParserFactory*>::reverse_iterator i = std::find_if(
- factories_.rbegin(), factories_.rend(),
+ factories_.rbegin(), factories_.rend(),
boost::bind(&PayloadParserFactory::canParse, _1, element, ns, attributes));
return (i != factories_.rend() ? *i : defaultFactory_);
}
}
diff --git a/Swiften/Roster/XMPPRosterImpl.h b/Swiften/Roster/XMPPRosterImpl.h
index 8c8cf3e..96da1f3 100644
--- a/Swiften/Roster/XMPPRosterImpl.h
+++ b/Swiften/Roster/XMPPRosterImpl.h
@@ -11,19 +11,19 @@
#include <Swiften/Base/API.h>
#include <Swiften/Roster/XMPPRoster.h>
namespace Swift {
class SWIFTEN_API XMPPRosterImpl : public XMPPRoster {
public:
XMPPRosterImpl();
- void addContact(const JID& jid, const std::string& name, const std::vector<std::string>& groups, const RosterItemPayload::Subscription subscription);
+ void addContact(const JID& jid, const std::string& name, const std::vector<std::string>& groups, RosterItemPayload::Subscription subscription);
void removeContact(const JID& jid);
void clear();
bool containsJID(const JID& jid);
RosterItemPayload::Subscription getSubscriptionStateForJID(const JID& jid);
std::string getNameForJID(const JID& jid) const;
std::vector<std::string> getGroupsForJID(const JID& jid);
virtual std::vector<XMPPRosterItem> getItems() const;
diff --git a/Swiften/Serializer/PayloadSerializerCollection.cpp b/Swiften/Serializer/PayloadSerializerCollection.cpp
index ab2b4f4..0db89a9 100644
--- a/Swiften/Serializer/PayloadSerializerCollection.cpp
+++ b/Swiften/Serializer/PayloadSerializerCollection.cpp
@@ -1,11 +1,11 @@
/*
- * Copyright (c) 2010 Remko Tronçon
+ * Copyright (c) 2010-2014 Remko Tronçon
* Licensed under the GNU General Public License v3.
* See Documentation/Licenses/GPLv3.txt for more information.
*/
#include <boost/bind.hpp>
#include <algorithm>
#include <Swiften/Serializer/PayloadSerializerCollection.h>
#include <Swiften/Serializer/PayloadSerializer.h>
@@ -14,20 +14,20 @@ namespace Swift {
PayloadSerializerCollection::PayloadSerializerCollection() {
}
void PayloadSerializerCollection::addSerializer(PayloadSerializer* serializer) {
serializers_.push_back(serializer);
}
void PayloadSerializerCollection::removeSerializer(PayloadSerializer* serializer) {
- serializers_.erase(remove(serializers_.begin(), serializers_.end(), serializer), serializers_.end());
+ serializers_.erase(std::remove(serializers_.begin(), serializers_.end(), serializer), serializers_.end());
}
PayloadSerializer* PayloadSerializerCollection::getPayloadSerializer(boost::shared_ptr<Payload> payload) const {
std::vector<PayloadSerializer*>::const_iterator i = std::find_if(
- serializers_.begin(), serializers_.end(),
+ serializers_.begin(), serializers_.end(),
boost::bind(&PayloadSerializer::canSerialize, _1, payload));
return (i != serializers_.end() ? *i : NULL);
}
}
diff --git a/Swiften/Session/BasicSessionStream.cpp b/Swiften/Session/BasicSessionStream.cpp
index 7aaa5c2..5b4b7d5 100644
--- a/Swiften/Session/BasicSessionStream.cpp
+++ b/Swiften/Session/BasicSessionStream.cpp
@@ -15,29 +15,29 @@
#include <Swiften/StreamStack/WhitespacePingLayer.h>
#include <Swiften/StreamStack/CompressionLayer.h>
#include <Swiften/StreamStack/TLSLayer.h>
#include <Swiften/TLS/TLSContextFactory.h>
#include <Swiften/TLS/TLSContext.h>
namespace Swift {
BasicSessionStream::BasicSessionStream(
- StreamType streamType,
- boost::shared_ptr<Connection> connection,
- PayloadParserFactoryCollection* payloadParserFactories,
- PayloadSerializerCollection* payloadSerializers,
- TLSContextFactory* tlsContextFactory,
+ StreamType streamType,
+ boost::shared_ptr<Connection> connection,
+ PayloadParserFactoryCollection* payloadParserFactories,
+ PayloadSerializerCollection* payloadSerializers,
+ TLSContextFactory* tlsContextFactory,
TimerFactory* timerFactory,
XMLParserFactory* xmlParserFactory) :
- available(false),
- connection(connection),
- tlsContextFactory(tlsContextFactory),
- timerFactory(timerFactory),
+ available(false),
+ connection(connection),
+ tlsContextFactory(tlsContextFactory),
+ timerFactory(timerFactory),
compressionLayer(NULL),
tlsLayer(NULL),
whitespacePingLayer(NULL) {
xmppLayer = new XMPPLayer(payloadParserFactories, payloadSerializers, xmlParserFactory, streamType);
xmppLayer->onStreamStart.connect(boost::bind(&BasicSessionStream::handleStreamStartReceived, this, _1));
xmppLayer->onElement.connect(boost::bind(&BasicSessionStream::handleElementReceived, this, _1));
xmppLayer->onError.connect(boost::bind(&BasicSessionStream::handleXMPPError, this));
xmppLayer->onDataRead.connect(boost::bind(&BasicSessionStream::handleDataRead, this, _1));
xmppLayer->onWriteData.connect(boost::bind(&BasicSessionStream::handleDataWritten, this, _1));
@@ -48,19 +48,19 @@ BasicSessionStream::BasicSessionStream(
streamStack = new StreamStack(xmppLayer, connectionLayer);
available = true;
}
BasicSessionStream::~BasicSessionStream() {
delete compressionLayer;
if (tlsLayer) {
- tlsLayer->onError.disconnect(boost::bind(&BasicSessionStream::handleTLSError, this));
+ tlsLayer->onError.disconnect(boost::bind(&BasicSessionStream::handleTLSError, this, _1));
tlsLayer->onConnected.disconnect(boost::bind(&BasicSessionStream::handleTLSConnected, this));
delete tlsLayer;
}
delete whitespacePingLayer;
delete streamStack;
connection->onDisconnected.disconnect(boost::bind(&BasicSessionStream::handleConnectionFinished, this, _1));
delete connectionLayer;