OGS
Region.cpp
Go to the documentation of this file.
1
// SPDX-FileCopyrightText: Copyright (c) OpenGeoSys Community (opengeosys.org)
2
// SPDX-License-Identifier: BSD-3-Clause
3
4
#include "
Region.h
"
5
6
#include <iterator>
7
#include <sstream>
8
9
#include "
BaseLib/Logging.h
"
10
11
namespace
FileIO
12
{
13
namespace
Gocad
14
{
15
std::ostream&
operator<<
(std::ostream& os,
Region
const
& r)
16
{
17
return
os <<
"("
<< r.
name
<<
"|"
<< r.
bit
<<
")"
;
18
}
19
20
Region
parseRegion
(std::string
const
& line)
21
{
22
std::istringstream iss(line);
23
std::istream_iterator<std::string> it(iss);
24
// Check first word is REGION or MODEL_REGION.
25
if
(*it != std::string(
"REGION"
) && *it != std::string(
"MODEL_REGION"
))
26
{
27
ERR
(
"Expected REGION or MODEL_REGION keyword but '{:s}' found.\n"
,
28
it->c_str());
29
throw
std::runtime_error(
30
"In parseRegion() expected REGION or MODEL_REGION keyword not "
31
"found.\n"
);
32
}
33
++it;
34
35
Region
r;
36
r.
name
= *it;
37
++it;
38
r.
bit
= atoi(it->c_str());
39
40
return
r;
41
}
42
43
}
// end namespace Gocad
44
}
// end namespace FileIO
Logging.h
ERR
void ERR(fmt::format_string< Args... > fmt, Args &&... args)
Definition
Logging.h:40
Region.h
FileIO::Gocad
Definition
Applications/FileIO/GocadIO/CoordinateSystem.cpp:15
FileIO::Gocad::operator<<
std::ostream & operator<<(std::ostream &os, CoordinateSystem const &c)
Definition
Applications/FileIO/GocadIO/CoordinateSystem.cpp:105
FileIO::Gocad::parseRegion
Region parseRegion(std::string const &line)
Definition
Region.cpp:20
FileIO
Definition
SHPImportDialog.h:8
FileIO::Gocad::Region
Definition
Region.h:14
FileIO::Gocad::Region::name
std::string name
Definition
Region.h:15
FileIO::Gocad::Region::bit
unsigned bit
Definition
Region.h:16
Applications
FileIO
GocadIO
Region.cpp
Generated by
1.14.0