GNU Octave  9.1.0
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
filepos.h
Go to the documentation of this file.
1 ////////////////////////////////////////////////////////////////////////
2 //
3 // Copyright (C) 2019-2024 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_filepos_h)
27 #define octave_filepos_h 1
28 
29 #include "octave-config.h"
30 
32 
33 class filepos
34 {
35 public:
36 
37  filepos () : m_line (0), m_column (0) { }
38 
39  filepos (int l, int c) : m_line (l), m_column (c) { }
40 
41  filepos (const filepos&) = default;
42 
43  filepos& operator = (const filepos&) = default;
44 
45  ~filepos () = default;
46 
47  operator bool () { return m_line > 0 && m_column > 0; }
48 
49  void line (int l) { m_line = l; }
50  void column (int c) { m_column = c; }
51 
52  int line () const { return m_line; }
53  int column () const { return m_column; }
54 
55  void increment_line (int val = 1) { m_line += val; }
56  void increment_column (int val = 1) { m_column += val; }
57 
58  void decrement_line (int val = 1) { m_line -= val; }
59  void decrement_column (int val = 1) { m_column -= val; }
60 
61  void next_line ()
62  {
63  m_line++;
64  m_column = 1;
65  }
66 
67 private:
68 
69  int m_line;
70  int m_column;
71 };
72 
73 OCTAVE_END_NAMESPACE(octave)
74 
75 #endif
~filepos()=default
void next_line()
Definition: filepos.h:61
void decrement_column(int val=1)
Definition: filepos.h:59
void increment_column(int val=1)
Definition: filepos.h:56
int line() const
Definition: filepos.h:52
filepos()
Definition: filepos.h:37
filepos(int l, int c)
Definition: filepos.h:39
void increment_line(int val=1)
Definition: filepos.h:55
filepos(const filepos &)=default
void decrement_line(int val=1)
Definition: filepos.h:58
void line(int l)
Definition: filepos.h:49
int column() const
Definition: filepos.h:53
void column(int c)
Definition: filepos.h:50
OCTAVE_BEGIN_NAMESPACE(octave) static octave_value daspk_fcn