This file is indexed.

/usr/include/geos/geom/CoordinateList.h is in libgeos++-dev 3.6.2-1build2.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
/**********************************************************************
 *
 * GEOS - Geometry Engine Open Source
 * http://geos.osgeo.org
 *
 * Copyright (C) 2010 Sandro Santilli <strk@keybit.net>
 * Copyright (C) 2006 Refractions Research Inc.
 *
 * This is free software; you can redistribute and/or modify it under
 * the terms of the GNU Lesser General Public Licence as published
 * by the Free Software Foundation. 
 * See the COPYING file for more information.
 *
 **********************************************************************
 *
 * Last port: geom/CoordinateList.java ?? (never been in complete sync)
 *
 **********************************************************************/

#ifndef GEOS_GEOM_COORDINATELIST_H
#define GEOS_GEOM_COORDINATELIST_H

#include <geos/export.h>
#include <geos/geom/Coordinate.h> 

#include <list>
#include <ostream> // for operator<<
#include <memory> // for auto_ptr 

#ifdef _MSC_VER
#pragma warning(push)
#pragma warning(disable: 4251) // warning C4251: needs to have dll-interface to be used by clients of class
#endif

// Forward declarations
namespace geos {
	namespace geom { 
		//class Coordinate;
	}
}


namespace geos {
namespace geom { // geos::geom

/** \brief
 * A list of {@link Coordinate}s, which may
 * be set to prevent repeated coordinates from occuring in the list.
 *
 * Use this class when fast insertions and removal at arbitrary
 * position is needed.
 * The class keeps ownership of the Coordinates.
 *
 */
class GEOS_DLL CoordinateList {

public:

	typedef std::list<Coordinate>::iterator iterator;
	typedef std::list<Coordinate>::const_iterator const_iterator;
	typedef std::list<Coordinate>::size_type size_type;

	friend std::ostream& operator<< (std::ostream& os,
		const CoordinateList& cl);

	/** \brief
	 * Constructs a new list from an array of Coordinates, allowing
	 * repeated points.
	 *
	 * (I.e. this constructor produces a {@link CoordinateList} with
	 * exactly the same set of points as the input array.)
	 *
	 * @param v the initial coordinates
	 */
	CoordinateList(const std::vector<Coordinate>& v)
		:
		coords(v.begin(), v.end())
	{
	}

	CoordinateList()
		:
		coords()
	{
	}

	size_type size() const
	{
		return coords.size();
	}

	bool empty() const
	{
		return coords.empty();
	}

	iterator begin()
	{
		return coords.begin();
	}

	iterator end()
	{
		return coords.end();
	}

	const_iterator begin() const
	{
		return coords.begin();
	}

	const_iterator end() const
	{
		return coords.end();
	}

	/** \brief
	 * Inserts the specified coordinate at the specified position in this list.
	 *
	 * @param pos the position at which to insert
	 * @param coord the coordinate to insert
	 * @param allowRepeated if set to false, repeated coordinates are collapsed
	 *
	 * @return an iterator to the newly installed coordinate
	 *         (or previous, if equal and repeated are not allowed)
	 * 
	 * NOTE: when allowRepeated is false _next_ point is not checked
	 *       this matches JTS behavior
	 */
	iterator insert(iterator pos, const Coordinate& c, bool allowRepeated)
	{
		if ( !allowRepeated && pos != coords.begin() ) {
			iterator prev = pos; --prev;
			if ( c.equals2D(*prev) ) return prev;
		}
		return coords.insert(pos, c);
	}

	iterator insert(iterator pos, const Coordinate& c)
	{
		return coords.insert(pos, c);
	}

	iterator erase(iterator pos)
	{
		return coords.erase(pos);
	}

	iterator erase(iterator first, iterator last)
	{
		return coords.erase(first, last);
	}

	std::auto_ptr<Coordinate::Vect> toCoordinateArray() const
	{
		std::auto_ptr<Coordinate::Vect> ret(new Coordinate::Vect);
		ret->assign(coords.begin(), coords.end());
		return ret;
	}
	void closeRing()
	{   
		if(!coords.empty() && ! (*(coords.begin())).equals(*(coords.rbegin())))
		{   
			const Coordinate &c = *(coords.begin());
			coords.insert(coords.end(),c);
		}   
	}   


private:

	std::list<Coordinate> coords;
};

inline
std::ostream& operator<< (std::ostream& os, const CoordinateList& cl)
{
	os << "(";
	for (CoordinateList::const_iterator
		it=cl.begin(), end=cl.end();
		it != end;
		++it)
	{
		const Coordinate& c = *it;
		if ( it != cl.begin() ) os << ", ";
		os << c;
	}
	os << ")";

	return os;
}

} // namespace geos::geom
} // namespace geos

#ifdef _MSC_VER
#pragma warning(pop)
#endif

#endif // ndef GEOS_GEOM_COORDINATELIST_H