00001 /* 00002 00003 Copyright (C) 1996-2012 John W. Eaton 00004 00005 This file is part of Octave. 00006 00007 Octave is free software; you can redistribute it and/or modify it 00008 under the terms of the GNU General Public License as published by the 00009 Free Software Foundation; either version 3 of the License, or (at your 00010 option) any later version. 00011 00012 Octave is distributed in the hope that it will be useful, but WITHOUT 00013 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 00014 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 00015 for more details. 00016 00017 You should have received a copy of the GNU General Public License 00018 along with Octave; see the file COPYING. If not, see 00019 <http://www.gnu.org/licenses/>. 00020 00021 */ 00022 00023 #if !defined (octave_magic_colon_h) 00024 #define octave_magic_colon_h 1 00025 00026 #include <cstdlib> 00027 00028 #include <iosfwd> 00029 #include <string> 00030 00031 #include "mx-base.h" 00032 #include "str-vec.h" 00033 00034 #include "error.h" 00035 #include "ov-base.h" 00036 #include "ov-typeinfo.h" 00037 00038 class octave_value_list; 00039 00040 class tree_walker; 00041 00042 // A type to represent ':' as used for indexing. 00043 00044 class 00045 octave_magic_colon : public octave_base_value 00046 { 00047 public: 00048 00049 octave_magic_colon (void) 00050 : octave_base_value () { } 00051 00052 octave_magic_colon (const octave_magic_colon&) 00053 : octave_base_value () { } 00054 00055 ~octave_magic_colon (void) { } 00056 00057 octave_base_value *clone (void) const { return new octave_magic_colon (*this); } 00058 octave_base_value *empty_clone (void) const { return new octave_magic_colon (); } 00059 00060 idx_vector index_vector (void) const { return idx_vector (':'); } 00061 00062 bool is_defined (void) const { return true; } 00063 00064 bool is_constant (void) const { return true; } 00065 00066 bool is_magic_colon (void) const { return true; } 00067 00068 void print (std::ostream& os, bool pr_as_read_syntax = false) const; 00069 00070 void print_raw (std::ostream& os, bool pr_as_read_syntax = false) const; 00071 00072 private: 00073 00074 DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA 00075 }; 00076 00077 #endif