Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(926)

Side by Side Diff: swig/Lib/python/std_set.i

Issue 553095: Checkin swig binaries for win, linux and Mac... (Closed) Base URL: svn://chrome-svn/chrome/trunk/deps/third_party/
Patch Set: '' Created 10 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « swig/Lib/python/std_pair.i ('k') | swig/Lib/python/std_sstream.i » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 /*
2 Sets
3 */
4
5 %fragment("StdSetTraits","header",fragment="StdSequenceTraits")
6 %{
7 namespace swig {
8 template <class SwigPySeq, class T>
9 inline void
10 assign(const SwigPySeq& swigpyseq, std::set<T>* seq) {
11 // seq->insert(swigpyseq.begin(), swigpyseq.end()); // not used as not alw ays implemented
12 typedef typename SwigPySeq::value_type value_type;
13 typename SwigPySeq::const_iterator it = swigpyseq.begin();
14 for (;it != swigpyseq.end(); ++it) {
15 seq->insert(seq->end(),(value_type)(*it));
16 }
17 }
18
19 template <class T>
20 struct traits_asptr<std::set<T> > {
21 static int asptr(PyObject *obj, std::set<T> **s) {
22 return traits_asptr_stdseq<std::set<T> >::asptr(obj, s);
23 }
24 };
25
26 template <class T>
27 struct traits_from<std::set<T> > {
28 static PyObject *from(const std::set<T>& vec) {
29 return traits_from_stdseq<std::set<T> >::from(vec);
30 }
31 };
32 }
33 %}
34
35 %define %swig_set_methods(set...)
36 %swig_sequence_iterator(set);
37 %swig_container_methods(set);
38
39 %extend {
40 void append(value_type x) {
41 self->insert(x);
42 }
43
44 bool __contains__(value_type x) {
45 return self->find(x) != self->end();
46 }
47
48 value_type __getitem__(difference_type i) const throw (std::out_of_range) {
49 return *(swig::cgetpos(self, i));
50 }
51
52 };
53 %enddef
54
55 %include <std/std_set.i>
OLDNEW
« no previous file with comments | « swig/Lib/python/std_pair.i ('k') | swig/Lib/python/std_sstream.i » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698