diff src/ov-base.cc @ 3933:f9ea3dcf58ee

[project @ 2002-05-15 03:21:00 by jwe]
author jwe
date Wed, 15 May 2002 03:21:01 +0000
parents e8627dc4bdf2
children 6e86256e9c54
line wrap: on
line diff
--- a/src/ov-base.cc	Tue May 07 18:10:44 2002 +0000
+++ b/src/ov-base.cc	Wed May 15 03:21:01 2002 +0000
@@ -53,7 +53,25 @@
 DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA (octave_base_value, "<unknown type>");
 
 octave_value
-octave_base_value::do_index_op (const octave_value_list&)
+octave_base_value::subsref (const std::string,
+			    const SLList<octave_value_list>&)
+{
+  std::string nm = type_name ();
+  error ("can't perform indexing operations for %s type", nm.c_str ());
+  return octave_value ();
+}
+
+octave_value_list
+octave_base_value::subsref (const std::string,
+			    const SLList<octave_value_list>&, int)
+{
+  std::string nm = type_name ();
+  error ("can't perform indexing operations for %s type", nm.c_str ());
+  return octave_value ();
+}
+
+octave_value
+octave_base_value::do_index_op (const octave_value_list&, int)
 {
   std::string nm = type_name ();
   error ("can't perform indexing operations for %s type", nm.c_str ());
@@ -77,32 +95,28 @@
 }
 
 octave_value
-octave_base_value::do_struct_elt_index_op (const std::string&,
-					   const octave_value_list&,
-					   bool)
-{
-  std::string nm = type_name ();
-  error ("can't perform indexed structure reference operations for %s type",
-	 nm.c_str ());
-  return octave_value ();
-}
-
-octave_value
-octave_base_value::do_struct_elt_index_op (const std::string&, bool)
+octave_base_value::subsasgn (const std::string type,
+			     const SLList<octave_value_list>& idx,
+			     const octave_value& rhs)
 {
-  std::string nm = type_name ();
-  error ("can't perform structure reference operations for %s type",
-	 nm.c_str ());
-  return octave_value ();
-}
+  octave_value retval;
 
-octave_lvalue
-octave_base_value::struct_elt_ref (octave_value *, const std::string&)
-{
-  std::string nm = type_name ();
-  error ("can't perform structure reference operations for %s type",
-	 nm.c_str ());
-  return octave_lvalue ();
+  if (is_defined ())
+    {
+      std::string nm = type_name ();
+      error ("can't perform indexed assignment for %s type", nm.c_str ());
+    }
+  else
+    {
+      // Create new object of appropriate type for given index and rhs
+      // types and then call subsasgn again for that object.
+
+      octave_value tmp = octave_value::empty_conv (type, rhs);
+
+      retval = tmp.subsasgn (type, idx, rhs);
+    }
+
+  return retval;
 }
 
 octave_value
@@ -143,6 +157,13 @@
   return true;
 }
 
+void
+octave_base_value::print_info (std::ostream& os,
+			       const std::string& prefix) const
+{
+  os << "no info for type: " << type_name () << "\n";
+}
+
 int
 octave_base_value::int_value (bool require_int, bool frc_str_conv) const
 {
@@ -271,6 +292,14 @@
   return retval;
 }
 
+string_vector
+octave_base_value::map_keys (void) const
+{
+  string_vector retval;
+  gripe_wrong_type_arg ("octave_base_value::map_keys()", type_name ());
+  return retval;
+}
+
 octave_stream
 octave_base_value::stream_value (void) const
 {