~ubuntu-branches/ubuntu/wily/sflphone/wily

« back to all changes in this revision

Viewing changes to kde/src/lib/typedefs.h

  • Committer: Package Import Robot
  • Author(s): Mark Purcell
  • Date: 2014-01-28 18:23:36 UTC
  • mfrom: (1.1.11)
  • mto: This revision was merged to the branch mainline in revision 24.
  • Revision ID: package-import@ubuntu.com-20140128182336-3xenud1kbnwmf3mz
* New upstream release 
  - Fixes "New Upstream Release" (Closes: #735846)
  - Fixes "Ringtone does not stop" (Closes: #727164)
  - Fixes "[sflphone-kde] crash on startup" (Closes: #718178)
  - Fixes "sflphone GUI crashes when call is hung up" (Closes: #736583)
* Build-Depends: ensure GnuTLS 2.6
  - libucommon-dev (>= 6.0.7-1.1), libccrtp-dev (>= 2.0.6-3)
  - Fixes "FTBFS Build-Depends libgnutls{26,28}-dev" (Closes: #722040)
* Fix "boost 1.49 is going away" unversioned Build-Depends: (Closes: #736746)
* Add Build-Depends: libsndfile-dev, nepomuk-core-dev

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/****************************************************************************
2
 
 *   Copyright (C) 2009-2013 by Savoir-Faire Linux                          *
 
2
 *   Copyright (C) 2009-2014 by Savoir-Faire Linux                          *
3
3
 *   Author : Jérémy Quentin <jeremy.quentin@savoirfairelinux.com>          *
4
4
 *            Emmanuel Lepage Vallee <emmanuel.lepage@savoirfairelinux.com> *
5
5
 *                                                                          *
24
24
#include <QtCore/QMap>
25
25
#include <QVector>
26
26
#include <QtCore/QString>
 
27
#include <QtCore/QDebug>
27
28
 
28
29
typedef QMap<QString, QString> MapStringString;
29
30
typedef QVector< QMap<QString, QString> > VectorMapStringString;
30
31
typedef QMap<QString, int> MapStringInt;
31
32
 
 
33
template<class T, class E>
 
34
struct TypedStateMachine
 
35
{
 
36
    // no ctor/dtor and one public member variable for easy initialization
 
37
    T _data[size_t(E::COUNT)];
 
38
 
 
39
    T& operator[](E v) {
 
40
      if (size_t(v) >= size_t(E::COUNT)) {
 
41
         qDebug() << "State Machine Out of Bound" << size_t(v);
 
42
         throw v;
 
43
      }
 
44
      return _data[size_t(v)];
 
45
    }
 
46
 
 
47
    const T& operator[](E v) const {
 
48
      if (size_t(v) >= size_t(E::COUNT)) {
 
49
         qDebug() << "State Machine Out of Bound" << size_t(v);
 
50
         throw v;
 
51
      }
 
52
      return _data[size_t(v)];
 
53
    }
 
54
 
 
55
    T *begin() {
 
56
      return _data;
 
57
    }
 
58
 
 
59
    T *end() {
 
60
      return _data + size_t(E::COUNT);
 
61
    }
 
62
};
 
63
 
32
64
#define LIB_EXPORT Q_DECL_EXPORT
33
65
#define LIB_IMPORT Q_DECL_IMPORT
34
66
 
38
70
#define nullptr 0
39
71
#endif
40
72
 
41
 
 
 
73
//Doesn't work
 
74
#if ((__GNUC_MINOR__ > 8) || (__GNUC_MINOR__ == 8))
 
75
   #define STRINGIFY(x) #x
 
76
   #define IGNORE_NULL(content)\
 
77
   _Pragma(STRINGIFY(GCC diagnostic ignored "-Wzero-as-null-pointer-constant")) \
 
78
      content
 
79
#else
 
80
   #define IGNORE_NULL(content) content
 
81
#endif //ENABLE_IGNORE_NULL
42
82
#endif