comparison src/oct-map.h @ 3931:311981a9726d

[project @ 2002-05-07 04:49:53 by jwe]
author jwe
date Tue, 07 May 2002 04:49:53 +0000
parents b80bbb43a1a9
children 2e2e32198722
comparison
equal deleted inserted replaced
3930:61d4427c016e 3931:311981a9726d
27 #pragma interface 27 #pragma interface
28 #endif 28 #endif
29 29
30 #include "Map.h" 30 #include "Map.h"
31 31
32 #include "ov.h" 32 #include "oct-obj.h"
33 33
34 class string_vector; 34 class string_vector;
35 35
36 class 36 class
37 Octave_map : public CHMap<octave_value> 37 Octave_map
38 { 38 {
39 public: 39 public:
40 Octave_map (void) : CHMap<octave_value> (octave_value ()) { } 40 Octave_map (void) : map (octave_value_list ()) { }
41 41
42 Octave_map (const std::string& key, const octave_value& value) 42 Octave_map (const std::string& key, const octave_value& value)
43 : CHMap<octave_value> (octave_value ()) 43 : map (octave_value_list ())
44 { 44 {
45 CHMap<octave_value>::operator [] (key) = value; 45 map[key] = octave_value_list (value);
46 } 46 }
47 47
48 Octave_map (const Octave_map& m) : CHMap<octave_value> (m) { } 48 Octave_map (const Octave_map& m) : map (m.map) { }
49
50 Octave_map& operator = (const Octave_map& m)
51 {
52 if (this != &m)
53 map = m.map;
54
55 return *this;
56 }
49 57
50 ~Octave_map (void) { } 58 ~Octave_map (void) { }
51 59
60 int length (void) const { return map.length (); }
61
62 int empty (void) const { return map.empty (); }
63
64 octave_value& operator [] (const std::string& key) { return map[key](0); }
65
66 void del (const std::string& key) { map.del (key); }
67
68 Pix first (void) const { return map.first (); }
69 void next (Pix& i) const { map.next (i); }
70
71 std::string key (Pix p) const { return map.key (p); }
72
73 octave_value& contents (Pix p) const { return map.contents (p)(0); }
74
75 Pix seek (const std::string& key) const { return map.seek (key); }
76
77 int contains (const std::string& key) const { return map.contains (key); }
78
79 void clear (void) { map.clear (); }
80
52 string_vector make_name_list (void); 81 string_vector make_name_list (void);
82
83 private:
84
85 // The map of names to values.
86 CHMap<octave_value_list> map;
53 }; 87 };
54 88
55 #endif 89 #endif
56 90
57 /* 91 /*