Line data Source code
1 : /* Copyright (C) 1989-2020 Free Software Foundation, Inc. 2 : Written by James Clark (jjc@jclark.com) 3 : 4 : This file is part of groff, the GNU roff typesetting system. 5 : 6 : groff is free software; you can redistribute it and/or modify it under 7 : the terms of the GNU General Public License as published by the Free 8 : Software Foundation, either version 3 of the License, or 9 : (at your option) any later version. 10 : 11 : groff is distributed in the hope that it will be useful, but WITHOUT ANY 12 : WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 : FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14 : for more details. 15 : 16 : You should have received a copy of the GNU General Public License 17 : along with this program. If not, see <http://www.gnu.org/licenses/>. */ 18 : 19 : class reference_id { 20 : int filename_id; 21 : int pos; 22 : public: 23 5 : reference_id() : filename_id(-1) { } 24 0 : reference_id(int fid, int off) : filename_id(fid), pos(off) { } 25 0 : unsigned hash() const { return (filename_id << 4) + pos; } 26 0 : int is_null() const { return filename_id < 0; } 27 : friend inline int operator==(const reference_id &, const reference_id &); 28 : }; 29 : 30 0 : inline int operator==(const reference_id &r1, const reference_id &r2) 31 : { 32 0 : return r1.filename_id == r2.filename_id && r1.pos == r2.pos; 33 : } 34 : 35 : // Local Variables: 36 : // fill-column: 72 37 : // mode: C++ 38 : // End: 39 : // vim: set cindent noexpandtab shiftwidth=2 textwidth=72: