GNU Octave  6.2.0
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
op-str-m.cc
Go to the documentation of this file.
1 ////////////////////////////////////////////////////////////////////////
2 //
3 // Copyright (C) 2003-2021 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 (HAVE_CONFIG_H)
27 # include "config.h"
28 #endif
29 
30 #include "errwarn.h"
31 #include "ovl.h"
32 #include "ov.h"
33 #include "ov-re-mat.h"
34 #include "ov-str-mat.h"
35 #include "ov-typeinfo.h"
36 #include "ops.h"
37 
38 DEFASSIGNOP (assign, char_matrix_str, octave_matrix)
39 {
40  octave_char_matrix_str& v1 = dynamic_cast<octave_char_matrix_str&> (a1);
41  const octave_matrix& v2 = dynamic_cast<const octave_matrix&> (a2);
42 
43  octave_value tmp
44  = v2.convert_to_str_internal (false, false,
45  a1.is_sq_string () ? '\'' : '"');
46 
47  v1.assign (idx, tmp.char_array_value ());
48 
49  return octave_value ();
50 }
51 
52 DEFNDCHARCATOP_FN (str_m, char_matrix_str, matrix, concat)
53 
54 DEFNDCHARCATOP_FN (m_str, matrix, char_matrix_str, concat)
55 
56 void
57 install_str_m_ops (octave::type_info& ti)
58 {
60  assign);
62  assign);
63 
66 
69 }
ComplexNDArray concat(NDArray &ra, ComplexNDArray &rb, const Array< octave_idx_type > &ra_idx)
Definition: CNDArray.cc:418
void assign(const octave_value_list &idx, const MT &rhs)
Definition: ov-base-mat.cc:225
octave_value convert_to_str_internal(bool, bool, char type) const
Definition: ov-ch-mat.h:148
charNDArray char_array_value(bool frc_str_conv=false) const
Definition: ov.h:850
const octave_base_value & a2
return octave_value(v1.char_array_value() . concat(v2.char_array_value(), ra_idx),((a1.is_sq_string()||a2.is_sq_string()) ? '\'' :'"'))
const octave_char_matrix & v2
void install_str_m_ops(octave::type_info &ti)
Definition: op-str-m.cc:57
#define DEFASSIGNOP(name, t1, t2)
Definition: ops.h:81
#define INSTALL_CATOP_TI(ti, t1, t2, f)
Definition: ops.h:60
#define INSTALL_ASSIGNOP_TI(ti, op, t1, t2, f)
Definition: ops.h:64
#define DEFNDCHARCATOP_FN(name, t1, t2, f)
Definition: ops.h:360