File: WKBStreamReader.cpp

package info (click to toggle)
geos 3.11.1-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 28,996 kB
  • sloc: cpp: 157,310; xml: 53,816; ansic: 6,956; sh: 302; makefile: 30
file content (53 lines) | stat: -rw-r--r-- 1,084 bytes parent folder | download
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
/**********************************************************************
 *
 * GEOS - Geometry Engine Open Source
 * http://geos.osgeo.org
 *
 * Copyright (C) 2020 Martin Davis
 *
 * 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.
 *
 **********************************************************************/

#include <geos/io/WKBReader.h>

#include <fstream>
#include <iostream>
#include <sstream>
#include <memory> // for unique_ptr
//#include <algorithm>

#include "WKBStreamReader.h"

using namespace geos::geom;

WKBStreamReader::WKBStreamReader(std::istream& p_instr)
    : instr(p_instr)
{
}

WKBStreamReader::~WKBStreamReader() {

}

/*public*/


/*
Return: nullptr if at EOF
*/
Geometry*
WKBStreamReader::next()
{
    std::string line;
    std::getline(instr, line);
    if (! instr) {
        return nullptr;
    }
    std::istringstream hex(line);
    auto g = rdr.readHEX( hex );
    return g.release();
}