~ubuntu-branches/ubuntu/edgy/swig1.3/edgy

« back to all changes in this revision

Viewing changes to Lib/tcl/std_map.i

  • Committer: Bazaar Package Importer
  • Author(s): Adam Conrad
  • Date: 2005-12-05 01:16:04 UTC
  • mfrom: (1.2.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20051205011604-ygx904it6413k3go
Tags: 1.3.27-1ubuntu1
Resynchronise with Debian again, for the new subversion packages.

Show diffs side-by-side

added added

removed removed

Lines of Context:
5
5
//
6
6
// Common implementation
7
7
 
8
 
%include std_common.i
9
 
%include exception.i
10
 
 
11
 
%exception std::map::get {
12
 
    try {
13
 
        $action
14
 
    } catch (std::out_of_range& e) {
15
 
        SWIG_exception(SWIG_IndexError,const_cast<char*>(e.what()));
16
 
    }
17
 
}
18
 
 
19
 
%exception std::map::del  {
20
 
    try {
21
 
        $action
22
 
    } catch (std::out_of_range& e) {
23
 
        SWIG_exception(SWIG_IndexError,const_cast<char*>(e.what()));
24
 
    }
25
 
}
 
8
%include <std_common.i>
26
9
 
27
10
// ------------------------------------------------------------------------
28
11
// std::map
48
31
        bool empty() const;
49
32
        void clear();
50
33
        %extend {
51
 
            T& get(const K& key) {
 
34
            T& get(const K& key) throw (std::out_of_range) {
52
35
                std::map<K,T >::iterator i = self->find(key);
53
36
                if (i != self->end())
54
37
                    return i->second;
58
41
            void set(const K& key, const T& x) {
59
42
                (*self)[key] = x;
60
43
            }
61
 
            void del(const K& key) {
 
44
            void del(const K& key) throw (std::out_of_range) {
62
45
                std::map<K,T >::iterator i = self->find(key);
63
46
                if (i != self->end())
64
47
                    self->erase(i);
87
70
        bool empty() const;
88
71
        void clear();
89
72
        %extend {
90
 
            T& get(K key) {
 
73
            T& get(K key) throw (std::out_of_range) {
91
74
                std::map<K,T >::iterator i = self->find(key);
92
75
                if (i != self->end())
93
76
                    return i->second;
97
80
            void set(K key, const T& x) {
98
81
                (*self)[key] = x;
99
82
            }
100
 
            void del(K key) {
 
83
            void del(K key) throw (std::out_of_range) {
101
84
                std::map<K,T >::iterator i = self->find(key);
102
85
                if (i != self->end())
103
86
                    self->erase(i);
123
106
        bool empty() const;
124
107
        void clear();
125
108
        %extend {
126
 
            T get(const K& key) {
 
109
            T get(const K& key) throw (std::out_of_range) {
127
110
                std::map<K,T >::iterator i = self->find(key);
128
111
                if (i != self->end())
129
112
                    return i->second;
133
116
            void set(const K& key, T x) {
134
117
                (*self)[key] = x;
135
118
            }
136
 
            void del(const K& key) {
 
119
            void del(const K& key) throw (std::out_of_range) {
137
120
                std::map<K,T >::iterator i = self->find(key);
138
121
                if (i != self->end())
139
122
                    self->erase(i);
160
143
        bool empty() const;
161
144
        void clear();
162
145
        %extend {
163
 
            T get(K key) {
 
146
            T get(K key) throw (std::out_of_range) {
164
147
                std::map<K,T >::iterator i = self->find(key);
165
148
                if (i != self->end())
166
149
                    return i->second;
170
153
            void set(K key, T x) {
171
154
                (*self)[key] = x;
172
155
            }
173
 
            void del(K key) {
 
156
            void del(K key) throw (std::out_of_range) {
174
157
                std::map<K,T >::iterator i = self->find(key);
175
158
                if (i != self->end())
176
159
                    self->erase(i);