WSL/SLF GitLab Repository
Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
snow-models
meteoio
Commits
2d99fade
Commit
2d99fade
authored
Apr 18, 2016
by
Mathias Bavay
Browse files
The linking was failing following the last commit... A method was in the wrong namespace.
parent
398ad906
Changes
2
Hide whitespace changes
Inline
Side-by-side
meteoio/FileUtils.cc
View file @
2d99fade
...
...
@@ -318,6 +318,35 @@ void skipLines(std::istream& fin, const size_t& nbLines, const char& eoln)
}
}
void
readKeyValueHeader
(
std
::
map
<
std
::
string
,
std
::
string
>&
headermap
,
std
::
istream
&
fin
,
const
size_t
&
linecount
,
const
std
::
string
&
delimiter
,
const
bool
&
keep_case
)
{
size_t
linenr
=
0
;
std
::
string
line
;
//make a test for end of line encoding:
const
char
eol
=
FileUtils
::
getEoln
(
fin
);
for
(
size_t
ii
=
0
;
ii
<
linecount
;
ii
++
){
if
(
std
::
getline
(
fin
,
line
,
eol
))
{
std
::
string
key
,
value
;
linenr
++
;
const
bool
result
=
IOUtils
::
readKeyValuePair
(
line
,
delimiter
,
key
,
value
);
if
(
result
)
{
if
(
!
keep_case
)
headermap
[
IOUtils
::
strToLower
(
key
)
]
=
value
;
else
headermap
[
key
]
=
value
;
}
else
{
// means if ((key == "") || (value==""))
std
::
ostringstream
out
;
out
<<
"Invalid key value pair in line: "
<<
linenr
<<
" of header"
;
throw
IOException
(
out
.
str
(),
AT
);
}
}
else
{
throw
InvalidFormatException
(
"Premature EOF while reading Header"
,
AT
);
}
}
}
//below, the file indexer implementation
void
FileIndexer
::
setIndex
(
const
Date
&
i_date
,
const
std
::
streampos
&
i_pos
)
...
...
meteoio/IOUtils.cc
View file @
2d99fade
...
...
@@ -242,35 +242,6 @@ std::string getHostName() {
#endif
}
void
readKeyValueHeader
(
std
::
map
<
std
::
string
,
std
::
string
>&
headermap
,
std
::
istream
&
fin
,
const
size_t
&
linecount
,
const
std
::
string
&
delimiter
,
const
bool
&
keep_case
)
{
size_t
linenr
=
0
;
std
::
string
line
;
//make a test for end of line encoding:
const
char
eol
=
FileUtils
::
getEoln
(
fin
);
for
(
size_t
ii
=
0
;
ii
<
linecount
;
ii
++
){
if
(
std
::
getline
(
fin
,
line
,
eol
))
{
std
::
string
key
,
value
;
linenr
++
;
const
bool
result
=
readKeyValuePair
(
line
,
delimiter
,
key
,
value
);
if
(
result
)
{
if
(
!
keep_case
)
headermap
[
strToLower
(
key
)
]
=
value
;
else
headermap
[
key
]
=
value
;
}
else
{
// means if ((key == "") || (value==""))
std
::
ostringstream
out
;
out
<<
"Invalid key value pair in line: "
<<
linenr
<<
" of header"
;
throw
IOException
(
out
.
str
(),
AT
);
}
}
else
{
throw
InvalidFormatException
(
"Premature EOF while reading Header"
,
AT
);
}
}
}
size_t
readLineToVec
(
const
std
::
string
&
line_in
,
std
::
vector
<
double
>&
vec_data
)
{
vec_data
.
clear
();
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment