GNU Octave  8.1.0
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
ov-colon.h
Go to the documentation of this file.
1 ////////////////////////////////////////////////////////////////////////
2 //
3 // Copyright (C) 1996-2023 The Octave Project Developers
4 //
5 // See the file COPYRIGHT.md in the top-level directory of this
6 // distribution or <https://octave.org/copyright/>.
7 //
8 // This file is part of Octave.
9 //
10 // Octave is free software: you can redistribute it and/or modify it
11 // under the terms of the GNU General Public License as published by
12 // the Free Software Foundation, either version 3 of the License, or
13 // (at your option) any later version.
14 //
15 // Octave is distributed in the hope that it will be useful, but
16 // WITHOUT ANY WARRANTY; without even the implied warranty of
17 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 // GNU General Public License for more details.
19 //
20 // You should have received a copy of the GNU General Public License
21 // along with Octave; see the file COPYING. If not, see
22 // <https://www.gnu.org/licenses/>.
23 //
24 ////////////////////////////////////////////////////////////////////////
25 
26 #if ! defined (octave_ov_colon_h)
27 #define octave_ov_colon_h 1
28 
29 #include "octave-config.h"
30 
31 #include <cstdlib>
32 
33 #include <iosfwd>
34 #include <string>
35 
36 #include "mx-base.h"
37 #include "str-vec.h"
38 
39 #include "error.h"
40 #include "ov-base.h"
41 #include "ov-typeinfo.h"
42 
43 class octave_value_list;
44 
45 // A type to represent ':' as used for indexing.
46 
47 class
49 {
50 public:
51 
53  : octave_base_value () { }
54 
56  : octave_base_value () { }
57 
58  ~octave_magic_colon (void) = default;
59 
60  octave_base_value * clone (void) const
61  { return new octave_magic_colon (*this); }
63  { return new octave_magic_colon (); }
64 
65  octave::idx_vector index_vector (bool /* require_integers */ = false) const
66  { return octave::idx_vector (':'); }
67 
68  bool is_defined (void) const { return true; }
69 
70  bool is_constant (void) const { return true; }
71 
72  bool is_magic_colon (void) const { return true; }
73 
74  OCTINTERP_API void print (std::ostream& os, bool pr_as_read_syntax = false);
75 
76  OCTINTERP_API void print_raw (std::ostream& os,
77  bool pr_as_read_syntax = false) const;
78 
79 private:
80 
82 };
83 
84 #endif
bool is_constant(void) const
Definition: ov-colon.h:70
octave_base_value * clone(void) const
Definition: ov-colon.h:60
bool is_defined(void) const
Definition: ov-colon.h:68
octave_base_value * empty_clone(void) const
Definition: ov-colon.h:62
octave::idx_vector index_vector(bool=false) const
Definition: ov-colon.h:65
~octave_magic_colon(void)=default
octave_magic_colon(void)
Definition: ov-colon.h:52
bool is_magic_colon(void) const
Definition: ov-colon.h:72
octave_magic_colon(const octave_magic_colon &)
Definition: ov-colon.h:55
octave::idx_vector idx_vector
Definition: idx-vector.h:1039
#define DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA
Definition: ov-base.h:181