libosmscout
1.1.1
Toggle main menu visibility
Loading...
Searching...
No Matches
libosmscout-map
include
osmscoutmap
StyleError.h
Go to the documentation of this file.
1
#ifndef OSMSCOUT_STYLEERROR_H
2
#define OSMSCOUT_STYLEERROR_H
3
4
/*
5
This source is part of the libosmscout library
6
Copyright (C) 2023 Lukas Karas
7
8
This library is free software; you can redistribute it and/or
9
modify it under the terms of the GNU Lesser General Public
10
License as published by the Free Software Foundation; either
11
version 2.1 of the License, or (at your option) any later version.
12
13
This library is distributed in the hope that it will be useful,
14
but WITHOUT ANY WARRANTY; without even the implied warranty of
15
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16
Lesser General Public License for more details.
17
18
You should have received a copy of the GNU Lesser General Public
19
License along with this library; if not, write to the Free Software
20
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21
*/
22
23
#include <
osmscoutmap/MapImportExport.h
>
24
25
#include <string>
26
27
namespace
osmscout
{
28
32
class
OSMSCOUT_MAP_API
StyleError
33
{
34
public
:
35
enum
StyleErrorType
{
36
Symbol
,
Error
,
Warning
,
Exception
37
};
38
39
public
:
40
StyleError
(
StyleErrorType
type,
int
line,
int
column,
const
std::string &text) :
41
type(type), line(line), column(column), text(text){}
42
43
StyleError
(
const
StyleError
&) =
default
;
44
StyleError
(
StyleError
&&) =
default
;
45
46
StyleError
&
operator=
(
const
StyleError
&) =
default
;
47
StyleError
&
operator=
(
StyleError
&&) =
default
;
48
49
~StyleError
() =
default
;
50
51
StyleErrorType
GetType
()
const
52
{
53
return
type;
54
}
55
56
std::string
GetTypeName
()
const
57
{
58
switch
(type){
59
case
Symbol
:
60
return
"Symbol"
;
61
case
Error
:
62
return
"Error"
;
63
case
Warning
:
64
return
"Warning"
;
65
case
Exception
:
66
return
"Exception"
;
67
default
:
68
assert(
false
);
69
return
"???"
;
70
}
71
}
72
73
int
GetLine
()
const
74
{
75
return
line;
76
}
77
78
int
GetColumn
()
const
79
{
80
return
column;
81
}
82
83
const
std::string &
GetText
()
const
84
{
85
return
text;
86
}
87
88
std::string
GetShortDescription
()
const
89
{
90
return
GetTypeName
() +
": "
+
GetText
();
91
}
92
93
std::string
GetDescription
()
const
94
{
95
return
std::to_string(
GetLine
()) +
","
+ std::to_string(
GetColumn
()) +
" "
+
GetShortDescription
();
96
}
97
98
private
:
99
StyleErrorType type;
100
int
line;
101
int
column;
102
std::string text;
103
};
104
105
}
106
107
#endif
//OSMSCOUT_STYLEERROR_H
MapImportExport.h
OSMSCOUT_MAP_API
#define OSMSCOUT_MAP_API
Definition
MapImportExport.h:45
osmscout::StyleError::GetColumn
int GetColumn() const
Definition
StyleError.h:78
osmscout::StyleError::GetShortDescription
std::string GetShortDescription() const
Definition
StyleError.h:88
osmscout::StyleError::StyleErrorType
StyleErrorType
Definition
StyleError.h:35
osmscout::StyleError::Error
@ Error
Definition
StyleError.h:36
osmscout::StyleError::Exception
@ Exception
Definition
StyleError.h:36
osmscout::StyleError::Symbol
@ Symbol
Definition
StyleError.h:36
osmscout::StyleError::Warning
@ Warning
Definition
StyleError.h:36
osmscout::StyleError::StyleError
StyleError(const StyleError &)=default
osmscout::StyleError::StyleError
StyleError(StyleError &&)=default
osmscout::StyleError::GetType
StyleErrorType GetType() const
Definition
StyleError.h:51
osmscout::StyleError::GetLine
int GetLine() const
Definition
StyleError.h:73
osmscout::StyleError::StyleError
StyleError(StyleErrorType type, int line, int column, const std::string &text)
Definition
StyleError.h:40
osmscout::StyleError::operator=
StyleError & operator=(const StyleError &)=default
osmscout::StyleError::~StyleError
~StyleError()=default
osmscout::StyleError::GetDescription
std::string GetDescription() const
Definition
StyleError.h:93
osmscout::StyleError::GetTypeName
std::string GetTypeName() const
Definition
StyleError.h:56
osmscout::StyleError::operator=
StyleError & operator=(StyleError &&)=default
osmscout::StyleError::GetText
const std::string & GetText() const
Definition
StyleError.h:83
osmscout
Definition
Area.h:39
Generated by
1.17.0