Mercurial > octave-nkf
comparison liboctave/cmd-hist.cc @ 11500:7aeb4eb7403f
cmd-hist.h, cmd-hist.cc: sprinkle with const
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Thu, 13 Jan 2011 02:48:07 -0500 |
parents | a1deab9a6e71 |
children | fd0a3ac60b0e |
comparison
equal
deleted
inserted
replaced
11499:8f23b6757225 | 11500:7aeb4eb7403f |
---|---|
63 | 63 |
64 void do_add (const std::string&); | 64 void do_add (const std::string&); |
65 | 65 |
66 void do_remove (int); | 66 void do_remove (int); |
67 | 67 |
68 int do_where (void); | 68 int do_where (void) const; |
69 | 69 |
70 int do_length (void); | 70 int do_length (void) const; |
71 | 71 |
72 int do_max_input_history (void); | 72 int do_max_input_history (void) const; |
73 | 73 |
74 int do_base (void); | 74 int do_base (void) const; |
75 | 75 |
76 int do_current_number (void); | 76 int do_current_number (void) const; |
77 | 77 |
78 void do_stifle (int); | 78 void do_stifle (int); |
79 | 79 |
80 int do_unstifle (void); | 80 int do_unstifle (void); |
81 | 81 |
82 int do_is_stifled (void); | 82 int do_is_stifled (void) const; |
83 | 83 |
84 void do_set_mark (int); | 84 void do_set_mark (int); |
85 | 85 |
86 int do_goto_mark (void); | 86 int do_goto_mark (void); |
87 | 87 |
88 void do_read (const std::string&, bool); | 88 void do_read (const std::string&, bool); |
89 | 89 |
90 void do_read_range (const std::string&, int, int, bool); | 90 void do_read_range (const std::string&, int, int, bool); |
91 | 91 |
92 void do_write (const std::string&); | 92 void do_write (const std::string&) const; |
93 | 93 |
94 void do_append (const std::string&); | 94 void do_append (const std::string&); |
95 | 95 |
96 void do_truncate_file (const std::string&, int); | 96 void do_truncate_file (const std::string&, int) const; |
97 | 97 |
98 string_vector do_list (int, bool); | 98 string_vector do_list (int, bool) const; |
99 | 99 |
100 std::string do_get_entry (int); | 100 std::string do_get_entry (int) const; |
101 | 101 |
102 void do_replace_entry (int, const std::string&); | 102 void do_replace_entry (int, const std::string&); |
103 | 103 |
104 void do_clean_up_and_save (const std::string&, int); | 104 void do_clean_up_and_save (const std::string&, int); |
105 | 105 |
126 { | 126 { |
127 ::octave_remove_history (n); | 127 ::octave_remove_history (n); |
128 } | 128 } |
129 | 129 |
130 int | 130 int |
131 gnu_history::do_where (void) | 131 gnu_history::do_where (void) const |
132 { | 132 { |
133 return ::octave_where_history (); | 133 return ::octave_where_history (); |
134 } | 134 } |
135 | 135 |
136 int | 136 int |
137 gnu_history::do_length (void) | 137 gnu_history::do_length (void) const |
138 { | 138 { |
139 return ::octave_history_length (); | 139 return ::octave_history_length (); |
140 } | 140 } |
141 | 141 |
142 int | 142 int |
143 gnu_history::do_max_input_history (void) | 143 gnu_history::do_max_input_history (void) const |
144 { | 144 { |
145 return ::octave_max_input_history (); | 145 return ::octave_max_input_history (); |
146 } | 146 } |
147 | 147 |
148 int | 148 int |
149 gnu_history::do_base (void) | 149 gnu_history::do_base (void) const |
150 { | 150 { |
151 return ::octave_history_base (); | 151 return ::octave_history_base (); |
152 } | 152 } |
153 | 153 |
154 int | 154 int |
155 gnu_history::do_current_number (void) | 155 gnu_history::do_current_number (void) const |
156 { | 156 { |
157 return (xsize > 0) ? do_base () + do_where () : -1; | 157 return (xsize > 0) ? do_base () + do_where () : -1; |
158 } | 158 } |
159 | 159 |
160 void | 160 void |
168 { | 168 { |
169 return ::octave_unstifle_history (); | 169 return ::octave_unstifle_history (); |
170 } | 170 } |
171 | 171 |
172 int | 172 int |
173 gnu_history::do_is_stifled (void) | 173 gnu_history::do_is_stifled (void) const |
174 { | 174 { |
175 return ::octave_history_is_stifled (); | 175 return ::octave_history_is_stifled (); |
176 } | 176 } |
177 | 177 |
178 void | 178 void |
247 else | 247 else |
248 error ("gnu_history::read_range: missing file name"); | 248 error ("gnu_history::read_range: missing file name"); |
249 } | 249 } |
250 | 250 |
251 void | 251 void |
252 gnu_history::do_write (const std::string& f_arg) | 252 gnu_history::do_write (const std::string& f_arg) const |
253 { | 253 { |
254 if (initialized) | 254 if (initialized) |
255 { | 255 { |
256 std::string f = f_arg; | 256 std::string f = f_arg; |
257 | 257 |
314 } | 314 } |
315 } | 315 } |
316 } | 316 } |
317 | 317 |
318 void | 318 void |
319 gnu_history::do_truncate_file (const std::string& f_arg, int n) | 319 gnu_history::do_truncate_file (const std::string& f_arg, int n) const |
320 { | 320 { |
321 if (initialized) | 321 if (initialized) |
322 { | 322 { |
323 std::string f = f_arg; | 323 std::string f = f_arg; |
324 | 324 |
331 error ("gnu_history::truncate_file: missing file name"); | 331 error ("gnu_history::truncate_file: missing file name"); |
332 } | 332 } |
333 } | 333 } |
334 | 334 |
335 string_vector | 335 string_vector |
336 gnu_history::do_list (int limit, bool number_lines) | 336 gnu_history::do_list (int limit, bool number_lines) const |
337 { | 337 { |
338 string_vector retval; | 338 string_vector retval; |
339 | 339 |
340 if (limit) | 340 if (limit) |
341 retval = ::octave_history_list (limit, number_lines); | 341 retval = ::octave_history_list (limit, number_lines); |
342 | 342 |
343 return retval; | 343 return retval; |
344 } | 344 } |
345 | 345 |
346 std::string | 346 std::string |
347 gnu_history::do_get_entry (int n) | 347 gnu_history::do_get_entry (int n) const |
348 { | 348 { |
349 std::string retval; | 349 std::string retval; |
350 | 350 |
351 char *line = ::octave_history_get (do_base () + n); | 351 char *line = ::octave_history_get (do_base () + n); |
352 | 352 |
763 { | 763 { |
764 xsize = n; | 764 xsize = n; |
765 } | 765 } |
766 | 766 |
767 int | 767 int |
768 command_history::do_size (void) | 768 command_history::do_size (void) const |
769 { | 769 { |
770 return xsize; | 770 return xsize; |
771 } | 771 } |
772 | 772 |
773 void | 773 void |
775 { | 775 { |
776 ignoring_additions = flag; | 776 ignoring_additions = flag; |
777 } | 777 } |
778 | 778 |
779 bool | 779 bool |
780 command_history::do_ignoring_entries (void) | 780 command_history::do_ignoring_entries (void) const |
781 { | 781 { |
782 return ignoring_additions; | 782 return ignoring_additions; |
783 } | 783 } |
784 | 784 |
785 void | 785 void |
791 command_history::do_remove (int) | 791 command_history::do_remove (int) |
792 { | 792 { |
793 } | 793 } |
794 | 794 |
795 int | 795 int |
796 command_history::do_where (void) | 796 command_history::do_where (void) const |
797 { | 797 { |
798 return 0; | 798 return 0; |
799 } | 799 } |
800 | 800 |
801 int | 801 int |
802 command_history::do_length (void) | 802 command_history::do_length (void) const |
803 { | 803 { |
804 return 0; | 804 return 0; |
805 } | 805 } |
806 | 806 |
807 int | 807 int |
808 command_history::do_max_input_history (void) | 808 command_history::do_max_input_history (void) const |
809 { | 809 { |
810 return 0; | 810 return 0; |
811 } | 811 } |
812 | 812 |
813 int | 813 int |
814 command_history::do_base (void) | 814 command_history::do_base (void) const |
815 { | 815 { |
816 return 0; | 816 return 0; |
817 } | 817 } |
818 | 818 |
819 int | 819 int |
820 command_history::do_current_number (void) | 820 command_history::do_current_number (void) const |
821 { | 821 { |
822 return (xsize > 0) ? do_base () + do_where () : -1; | 822 return (xsize > 0) ? do_base () + do_where () : -1; |
823 } | 823 } |
824 | 824 |
825 void | 825 void |
832 { | 832 { |
833 return -1; | 833 return -1; |
834 } | 834 } |
835 | 835 |
836 int | 836 int |
837 command_history::do_is_stifled (void) | 837 command_history::do_is_stifled (void) const |
838 { | 838 { |
839 return 0; | 839 return 0; |
840 } | 840 } |
841 | 841 |
842 void | 842 void |
863 if (f.empty ()) | 863 if (f.empty ()) |
864 error ("command_history::read_range: missing file name"); | 864 error ("command_history::read_range: missing file name"); |
865 } | 865 } |
866 | 866 |
867 void | 867 void |
868 command_history::do_write (const std::string& f_arg) | 868 command_history::do_write (const std::string& f_arg) const |
869 { | 869 { |
870 if (initialized) | 870 if (initialized) |
871 { | 871 { |
872 std::string f = f_arg; | 872 std::string f = f_arg; |
873 | 873 |
901 } | 901 } |
902 } | 902 } |
903 } | 903 } |
904 | 904 |
905 void | 905 void |
906 command_history::do_truncate_file (const std::string& f_arg, int) | 906 command_history::do_truncate_file (const std::string& f_arg, int) const |
907 { | 907 { |
908 if (initialized) | 908 if (initialized) |
909 { | 909 { |
910 std::string f = f_arg; | 910 std::string f = f_arg; |
911 | 911 |
916 error ("command_history::truncate_file: missing file name"); | 916 error ("command_history::truncate_file: missing file name"); |
917 } | 917 } |
918 } | 918 } |
919 | 919 |
920 string_vector | 920 string_vector |
921 command_history::do_list (int, bool) | 921 command_history::do_list (int, bool) const |
922 { | 922 { |
923 return string_vector (); | 923 return string_vector (); |
924 } | 924 } |
925 | 925 |
926 std::string | 926 std::string |
927 command_history::do_get_entry (int) | 927 command_history::do_get_entry (int) const |
928 { | 928 { |
929 return std::string (); | 929 return std::string (); |
930 } | 930 } |
931 | 931 |
932 void | 932 void |
948 error ("command_history::clean_up_and_save: missing file name"); | 948 error ("command_history::clean_up_and_save: missing file name"); |
949 } | 949 } |
950 } | 950 } |
951 | 951 |
952 void | 952 void |
953 command_history::error (int err_num) | 953 command_history::error (int err_num) const |
954 { | 954 { |
955 (*current_liboctave_error_handler) ("%s", gnulib::strerror (err_num)); | 955 (*current_liboctave_error_handler) ("%s", gnulib::strerror (err_num)); |
956 } | 956 } |
957 | 957 |
958 void | 958 void |
959 command_history::error (const std::string& s) | 959 command_history::error (const std::string& s) const |
960 { | 960 { |
961 (*current_liboctave_error_handler) ("%s", s.c_str ()); | 961 (*current_liboctave_error_handler) ("%s", s.c_str ()); |
962 } | 962 } |