PageRenderTime 8ms CodeModel.GetById 1ms app.highlight 3ms RepoModel.GetById 1ms app.codeStats 0ms

/trunk/Lib/std/std_container.i

#
Swig | 109 lines | 74 code | 35 blank | 0 comment | 0 complexity | e1ddb231f65594eb0d0029307f069b8f MD5 | raw file
  1%include <std_common.i>
  2%include <exception.i>
  3%include <std_alloc.i>
  4
  5%{
  6#include <algorithm>
  7%}
  8
  9// Common container methods
 10
 11%define %std_container_methods(container...)
 12  container();
 13  container(const container&);
 14
 15  bool empty() const;
 16  size_type size() const;
 17  void clear();
 18
 19  void swap(container& v);
 20
 21  allocator_type get_allocator() const;
 22
 23  #ifdef SWIG_EXPORT_ITERATOR_METHODS
 24  class iterator;
 25  class reverse_iterator;
 26  class const_iterator;
 27  class const_reverse_iterator;
 28
 29  iterator begin();
 30  iterator end();
 31  reverse_iterator rbegin();
 32  reverse_iterator rend();
 33  #endif
 34
 35%enddef
 36
 37// Common sequence
 38
 39%define %std_sequence_methods_common(sequence)
 40  
 41  %std_container_methods(%arg(sequence));
 42  
 43  sequence(size_type size);
 44  void pop_back();
 45  
 46  void resize(size_type new_size);
 47  
 48  #ifdef SWIG_EXPORT_ITERATOR_METHODS
 49  iterator erase(iterator pos);
 50  iterator erase(iterator first, iterator last);
 51  #endif
 52  
 53%enddef
 54
 55
 56%define %std_sequence_methods(sequence)
 57  
 58  %std_sequence_methods_common(%arg(sequence));
 59  
 60  sequence(size_type size, const value_type& value);
 61  void push_back(const value_type& x);  
 62
 63  const value_type& front() const;
 64  const value_type& back() const;
 65 
 66  void assign(size_type n, const value_type& x);
 67
 68  void resize(size_type new_size, const value_type& x);
 69  
 70  #ifdef SWIG_EXPORT_ITERATOR_METHODS
 71  iterator insert(iterator pos, const value_type& x);
 72  void insert(iterator pos, size_type n, const value_type& x);
 73  #endif
 74  
 75%enddef
 76
 77%define %std_sequence_methods_val(sequence...)
 78  
 79  %std_sequence_methods_common(%arg(sequence));
 80  
 81  sequence(size_type size, value_type value);
 82  void push_back(value_type x);  
 83
 84  value_type front() const;
 85  value_type back() const;
 86 
 87  void assign(size_type n, value_type x);
 88
 89  void resize(size_type new_size, value_type x);
 90  
 91  #ifdef SWIG_EXPORT_ITERATOR_METHODS
 92  iterator insert(iterator pos, value_type x);
 93  void insert(iterator pos, size_type n, value_type x);
 94  #endif
 95  
 96%enddef
 97
 98
 99//
100// Ignore member methods for Type with no default constructor
101//
102%define %std_nodefconst_type(Type...)
103%feature("ignore") std::vector<Type >::vector(size_type size);
104%feature("ignore") std::vector<Type >::resize(size_type size);
105%feature("ignore") std::deque<Type >::deque(size_type size);
106%feature("ignore") std::deque<Type >::resize(size_type size);
107%feature("ignore") std::list<Type >::list(size_type size);
108%feature("ignore") std::list<Type >::resize(size_type size);
109%enddef