aboutsummaryrefslogtreecommitdiff
path: root/Examples/test-suite/cpp17_nested_namespaces.i
blob: fcbf24c9ab7140fdbfce189e94d811e5998d534a (plain)
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
%module cpp17_nested_namespaces
// Tests c++17 style nested namespaces

%inline %{
// Tests with namespaces already defined using C++98 style (non-nested) namespaces
namespace A1 {
  struct A1Struct {
    void A1Method() {}
  };
  namespace B1 {
    struct B1Struct {
      void B1Method() {}
    };
  }
}
namespace A1::B1 {
  A1Struct createA1Struct() { return ::A1::A1Struct(); }
  B1Struct createB1Struct() { return ::A1::B1::B1Struct(); }
}

namespace A1 {
  namespace B1 {
    namespace C1 {
      struct C1Struct {
        void C1Method() {}
      };
    }
  }
}

namespace A1::B1::C1 {
  C1Struct createC1Struct() { return ::A1::B1::C1::C1Struct(); }
}
%}

%inline %{
// Tests with namespaces already defined using C++17 style (nested) namespaces
namespace A2::B2 {
  struct B2Struct {
    void B2Method() {}
  };
}

namespace A2::B2 {
  B2Struct createB2Struct() { return ::A2::B2::B2Struct(); }
}

namespace A2::B2::C2 {
    struct C2Struct {
      void C2Method() {}
    };
}

namespace A2::B2::C2 {
  C2Struct createC2Struct() { return ::A2::B2::C2::C2Struct(); }
}
%}


%inline %{
// Tests with namespaces already defined using C++17 style (nested) namespaces to 3 levels
namespace A3::B3::C3 {
    struct C3Struct {
      void C3Method() {}
    };
}

namespace A3::B3::C3 {
  C3Struct createC3Struct() { return ::A3::B3::C3::C3Struct(); }
}

namespace A3::B3 {
  struct B3Struct {
    void B3Method() {}
  };
}

namespace A3::B3 {
  B3Struct createB3Struct() { return ::A3::B3::B3Struct(); }
}
%}