Skip to main content
summaryrefslogtreecommitdiffstats
blob: 8a86010d10c5ad40c12d6580b827fcc66f700321 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
#define INT      int
#define FUNCTION_MACRO(arg) globalFunc(arg)

enum Enumeration {
    enumerator
};

const int globalConstant = 0;
int globalVariable = 0;
static int globalStaticVariable = 0;

void globalFunc(int a);
static void globalStaticFunc() {
};

class Base1 {};
class Base2 {};

class ClassContainer : Base1, Base2 {
    friend void friendFunc();
    friend class FriendClass;    
    
public:
    static int staticPubField;
    const int constPubField;
    const static int constStaticPubField;
    int pubField;

    static int staticPubMethod(int arg) {
        FUNCTION_MACRO(arg);
        globalFunc(arg);
        return globalStaticVariable;
    }
    int pubMethod();

    enum pubEnumeration {pubEnumerator};
    class pubClass{};
    class pubStruct{};
    class pubUnion{};
    typedef pubClass pubTypedef;
    
protected:
    static const int constStaticProtField = 12; 
    static int staticProtField;
    const  int constProtField;
    int protField;

    static int staticProtMethod();
    int protMethod();

    enum protEnumeration {protEnumerator};
    class protClass{};
    class protStruct{};
    class protUnion{};
    typedef protClass protTypedef;
    
private:
    static const int constStaticPrivField = 12; 
    static int staticPrivField;
    const  int constPrivField;
    int privField;    

    static int staticPrivMethod();
    int privMethod();

    enum privEnumeration {privEnumerator};
    class privClass{};
    class privStruct{};
    class privUnion{};
    typedef privClass privTypedef;


};

template<class T1, class T2> class TemplateClass {
    T1 tArg1;
    T2 tArg2;
    TemplateClass(T1 arg1, T2 arg2) {
        tArg1 = arg1;
        tArg2 = arg2;
    }
};

template<class T1> class PartialInstantiatedClass : TemplateClass<T1, Base1> {};


struct CppStruct {
    int structField;
};

union CppUnion {
    int unionField;
};

typedef CppUnion TUnion;

namespace ns {
    int namespaceVar = 0;
    int namespaceFunc() {
	globalStaticFunc();
	return namespaceVar;
    }
}

INT ClassContainer::protMethod() {
    return protField;
}

INT ClassContainer::pubMethod() {
    int localVar = 0;
    return pubField + localVar;
}

INT ClassContainer::staticPrivMethod() {
    CppStruct* st= new CppStruct();
    st->structField= 1;
    CppUnion un;
    un.unionField= 2;
    staticPubMethod(staticPrivField);
label:
    FUNCTION_MACRO(0);
    if (un.unionField < st->structField) goto label;
    problemMethod();
    // external SDK
    SDKClass sdkClass;
    sdkClass.SDKMethod();
    SDKFunction();
    return 0;
}

//http://bugs.eclipse.org/209203
template <int n>
int f()
{
  return n;
}

Back to the top