simple_test_app.h 4.25 KB
Newer Older
hjk's avatar
hjk committed
1 2 3 4
/**************************************************************************
**
** This file is part of Qt Creator
**
hjk's avatar
hjk committed
5
** Copyright (c) 2012 Nokia Corporation and/or its subsidiary(-ies).
hjk's avatar
hjk committed
6
**
7
** Contact: Nokia Corporation (qt-info@nokia.com)
hjk's avatar
hjk committed
8 9 10 11
**
**
** GNU Lesser General Public License Usage
**
Thomas Murach's avatar
Thomas Murach committed
12 13 14 15 16 17
** This file may be used under the terms of the GNU Lesser General Public
** License version 2.1 as published by the Free Software Foundation and
** appearing in the file LICENSE.LGPL included in the packaging of this file.
** Please review the following information to ensure the GNU Lesser General
** Public License version 2.1 requirements will be met:
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
hjk's avatar
hjk committed
18 19
**
** In addition, as a special exception, Nokia gives you certain additional
Thomas Murach's avatar
Thomas Murach committed
20
** rights. These rights are described in the Nokia Qt LGPL Exception
hjk's avatar
hjk committed
21 22
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
Thomas Murach's avatar
Thomas Murach committed
23 24 25 26 27
** Other Usage
**
** Alternatively, this file may be used in accordance with the terms and
** conditions contained in a signed written agreement between you and Nokia.
**
hjk's avatar
hjk committed
28
** If you have questions regarding the use of this file, please contact
29
** Nokia at qt-info@nokia.com.
hjk's avatar
hjk committed
30 31 32 33 34 35
**
**************************************************************************/

#ifndef SIMPLE_DEBUGGER_TEST_H
#define SIMPLE_DEBUGGER_TEST_H

hjk's avatar
hjk committed
36 37 38
namespace breakpoints {

    struct SomeClassWithInlineConstructor
hjk's avatar
hjk committed
39
    {
hjk's avatar
hjk committed
40 41 42 43 44 45
        SomeClassWithInlineConstructor()
        {
            a = 21;
        }
        int a;
    };
hjk's avatar
hjk committed
46

hjk's avatar
hjk committed
47
    struct SomeBaseClassWithInlineConstructor
hjk's avatar
hjk committed
48
    {
hjk's avatar
hjk committed
49 50 51 52 53 54 55 56 57 58
        SomeBaseClassWithInlineConstructor()
        {
            a = 21;
        }
        virtual ~SomeBaseClassWithInlineConstructor();
        int a;
    };

    struct SomeDerivedClassWithInlineConstructor
        : SomeBaseClassWithInlineConstructor
hjk's avatar
hjk committed
59
    {
hjk's avatar
hjk committed
60 61 62 63 64 65 66 67 68 69
        SomeDerivedClassWithInlineConstructor()
        {
            a = 21;
        }
        virtual ~SomeDerivedClassWithInlineConstructor();
        int a;
    };

    template <class T>
    struct SomeTemplatedClassWithInlineConstructor
hjk's avatar
hjk committed
70
    {
hjk's avatar
hjk committed
71 72 73 74 75 76
        SomeTemplatedClassWithInlineConstructor()
        {
            a = 21;
        }
        T a;
    };
hjk's avatar
hjk committed
77

hjk's avatar
hjk committed
78 79
    template <class T>
    struct SomeTemplatedBaseClassWithInlineConstructor
hjk's avatar
hjk committed
80
    {
hjk's avatar
hjk committed
81 82 83 84 85
        SomeTemplatedBaseClassWithInlineConstructor()
        {
            a = 21;
        }
        virtual ~SomeTemplatedBaseClassWithInlineConstructor();
hjk's avatar
hjk committed
86

hjk's avatar
hjk committed
87 88
        T a;
    };
hjk's avatar
hjk committed
89

hjk's avatar
hjk committed
90 91 92
    template <class T>
    struct SomeTemplatedDerivedClassWithInlineConstructor
        : SomeTemplatedBaseClassWithInlineConstructor<T>
hjk's avatar
hjk committed
93
    {
hjk's avatar
hjk committed
94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114
        SomeTemplatedDerivedClassWithInlineConstructor()
        {
            a = 21;
        }
        virtual ~SomeTemplatedDerivedClassWithInlineConstructor();
        T a;
    };


    SomeBaseClassWithInlineConstructor::~SomeBaseClassWithInlineConstructor() {}

    SomeDerivedClassWithInlineConstructor::~SomeDerivedClassWithInlineConstructor() {}

    template <typename T>
    SomeTemplatedBaseClassWithInlineConstructor<T>::
        ~SomeTemplatedBaseClassWithInlineConstructor() {}

    template <typename T>
    SomeTemplatedDerivedClassWithInlineConstructor<T>::
        ~SomeTemplatedDerivedClassWithInlineConstructor() {}

115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140
    struct X : virtual SomeClassWithInlineConstructor
    {
        X() { a = 1; }
    };

    struct Y : virtual SomeClassWithInlineConstructor
    {
        Y() { a = 2; }
    };

    struct Z : X, Y
    {
        Z() : SomeClassWithInlineConstructor(), X(), Y() {}
    };

    template <class T> T twice(T t)
    {
        return 2 * t;
    }

    template <class T> struct Twice
    {
        Twice(T t) { t_ = 2 * t; }
        T t_;
    };

hjk's avatar
hjk committed
141 142 143 144 145 146 147 148
    void testBreakpoints()
    {
        SomeClassWithInlineConstructor a;
        SomeBaseClassWithInlineConstructor b;
        SomeDerivedClassWithInlineConstructor c;
        SomeTemplatedClassWithInlineConstructor<int> d;
        SomeTemplatedBaseClassWithInlineConstructor<int> e;
        SomeTemplatedDerivedClassWithInlineConstructor<int> f;
149 150 151
        Z z;
        int aa = twice(1);
        int bb = twice(1.0);
hjk's avatar
hjk committed
152
        // <=== Break here.
153 154 155
        Twice<int> cc = Twice<int>(1);
        Twice<float> dd = Twice<float>(1.0);
        dummyStatement(&a, &b, &c, &d, &e, &f, &z, bb, aa, cc, dd);
hjk's avatar
hjk committed
156
    }
hjk's avatar
hjk committed
157 158

} // namespace breakpoints
hjk's avatar
hjk committed
159 160

#endif // SIMPLE_DEBUGGER_TEST_H