Debian Codegraph @

texk/lcdf-typetools/lcdf-typetools-src/liblcdf/landmark.cc

raw
1 // -*- related-file-name: "../include/lcdf/landmark.hh" -*-
2
3 /* landmark.{cc,hh} -- FILE:LINE type landmarks
4 *
5 * Copyright (c) 1998-2023 Eddie Kohler
6 *
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License as published by the Free
9 * Software Foundation; either version 2 of the License, or (at your option)
10 * any later version. This program is distributed in the hope that it will be
11 * useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
13 * Public License for more details.
14 */
15
16 #ifdef HAVE_CONFIG_H
17 # include <config.h>
18 #endif
19 #include <lcdf/landmark.hh>
20
21 Landmark
22 operator+(const Landmark &landmark, int offset)
23 {
24 if (landmark.has_line())
25 return Landmark(landmark.file(), landmark.line() + offset);
26 else
27 return landmark;
28 }
29
30 Landmark::operator String() const
31 {
32 if (_file && has_line())
33 return _file + ":" + String(_line);
34 else
35 return _file;
36 }