comparison libinterp/octave-value/ov.cc @ 20615:729a85dafba8

use new string_value method to handle value extraction errors * ov-class.cc, ov-classdef.cc, ov-fcn-handle.cc, ov-fcn-inline.cc, ov.cc, pt-idx.cc: Use new string_value method.
author John W. Eaton <jwe@octave.org>
date Thu, 08 Oct 2015 17:55:57 -0400
parents 56fee8f84fe7
children e5986cba4ca8
comparison
equal deleted inserted replaced
20614:10ec79b47808 20615:729a85dafba8
2832 const Cell type = m.contents ("type"); 2832 const Cell type = m.contents ("type");
2833 const Cell subs = m.contents ("subs"); 2833 const Cell subs = m.contents ("subs");
2834 2834
2835 for (int k = 0; k < nel; k++) 2835 for (int k = 0; k < nel; k++)
2836 { 2836 {
2837 if (type(k).is_string ()) 2837 std::string item = type(k).string_value ("%s: type(%d) must be a string", name, k+1);
2838 { 2838
2839 std::string item = type(k).string_value (); 2839 if (item == "{}")
2840 if (item == "{}") 2840 type_string[k] = '{';
2841 type_string[k] = '{'; 2841 else if (item == "()")
2842 else if (item == "()") 2842 type_string[k] = '(';
2843 type_string[k] = '('; 2843 else if (item == ".")
2844 else if (item == ".") 2844 type_string[k] = '.';
2845 type_string[k] = '.';
2846 else
2847 {
2848 error ("%s: invalid indexing type '%s'", name, item.c_str ());
2849 return;
2850 }
2851 }
2852 else 2845 else
2853 { 2846 {
2854 error ("%s: type(%d) must be a string", name, k+1); 2847 error ("%s: invalid indexing type '%s'", name, item.c_str ());
2855 return; 2848 return;
2856 } 2849 }
2857 2850
2858 octave_value_list idx_item; 2851 octave_value_list idx_item;
2859 2852