GNU Octave  6.2.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-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 (octave_filepos_h)
27 #define octave_filepos_h 1
28 
29 #include "octave-config.h"
30 
31 namespace octave
32 {
33  class filepos
34  {
35  public:
36 
37  filepos (int l = 1, int c = 1) : m_line (l), m_column (c) { }
38 
39  filepos (const filepos&) = default;
40 
41  filepos& operator = (const filepos&) = default;
42 
43  ~filepos (void) = default;
44 
45  void set (int l, int c)
46  {
47  m_line = l;
48  m_column = c;
49  }
50 
51  void line (int l) { m_line = l; }
52  void column (int c) { m_column = c; }
53 
54  int line (void) const { return m_line; }
55  int column (void) const { return m_column; }
56 
57  void increment_line (int val = 1) { m_line += val; }
58  void increment_column (int val = 1) { m_column += val; }
59 
60  void decrement_line (int val = 1) { m_line -= val; }
61  void decrement_column (int val = 1) { m_column -= val; }
62 
63  void next_line (void)
64  {
65  m_line++;
66  m_column = 1;
67  }
68 
69  private:
70 
71  int m_line;
72  int m_column;
73  };
74 }
75 
76 #endif
void increment_column(int val=1)
Definition: filepos.h:58
void decrement_column(int val=1)
Definition: filepos.h:61
filepos(int l=1, int c=1)
Definition: filepos.h:37
void line(int l)
Definition: filepos.h:51
void decrement_line(int val=1)
Definition: filepos.h:60
void next_line(void)
Definition: filepos.h:63
void column(int c)
Definition: filepos.h:52
int column(void) const
Definition: filepos.h:55
filepos & operator=(const filepos &)=default
filepos(const filepos &)=default
~filepos(void)=default
void set(int l, int c)
Definition: filepos.h:45
int line(void) const
Definition: filepos.h:54
void increment_line(int val=1)
Definition: filepos.h:57