Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Aland, Sebastian
amdis
Commits
cce80ff0
Commit
cce80ff0
authored
Jun 03, 2011
by
Praetorius, Simon
Browse files
Initfile parser - small changes
parent
00561533
Changes
2
Hide whitespace changes
Inline
Side-by-side
AMDiS/src/Initfile.cc
View file @
cce80ff0
...
@@ -6,6 +6,8 @@
...
@@ -6,6 +6,8 @@
#include
<sstream>
#include
<sstream>
using
namespace
std
;
using
namespace
std
;
namespace
AMDiS
{
/// the small parser for the initfile. see description of read(Initfile&, istream&)
/// the small parser for the initfile. see description of read(Initfile&, istream&)
struct
Parser
{
struct
Parser
{
Parser
(
const
string
&
line
)
{
Parser
(
const
string
&
line
)
{
...
@@ -140,3 +142,5 @@ void Initfile::write(std::string fn) {
...
@@ -140,3 +142,5 @@ void Initfile::write(std::string fn) {
write
(
outFile
);
write
(
outFile
);
};
};
}
AMDiS/src/Initfile.h
View file @
cce80ff0
...
@@ -16,9 +16,11 @@
...
@@ -16,9 +16,11 @@
#include
<boost/algorithm/string/trim.hpp>
#include
<boost/algorithm/string/trim.hpp>
#include
<boost/lexical_cast.hpp>
#include
<boost/lexical_cast.hpp>
using
namespace
AMDiS
;
namespace
InitfileInternal
{
namespace
AMDiS
{
namespace
InitfileInternal
{
/// Exceptions
/// Exceptions
struct
WrongVectorSize
:
std
::
runtime_error
{
struct
WrongVectorSize
:
std
::
runtime_error
{
WrongVectorSize
(
std
::
string
m
)
:
std
::
runtime_error
(
m
)
{}
WrongVectorSize
(
std
::
string
m
)
:
std
::
runtime_error
(
m
)
{}
...
@@ -50,7 +52,7 @@ namespace InitfileInternal {
...
@@ -50,7 +52,7 @@ namespace InitfileInternal {
return
swap
;
return
swap
;
}
}
/// return the delimiter or throw an exception if there is no known delimiter in value
/// return the delimiter or throw an exception if there is no known delimiter in value
size_t
checkDelim
(
const
std
::
string
&
value
,
const
std
::
string
&
delims
)
{
inline
size_t
checkDelim
(
const
std
::
string
&
value
,
const
std
::
string
&
delims
)
{
size_t
pos
(
std
::
string
::
npos
);
size_t
pos
(
std
::
string
::
npos
);
for
(
unsigned
i
=
0
;
i
<
delims
.
length
();
++
i
)
{
for
(
unsigned
i
=
0
;
i
<
delims
.
length
();
++
i
)
{
pos
=
value
.
find
(
delims
[
i
]);
pos
=
value
.
find
(
delims
[
i
]);
...
@@ -164,7 +166,7 @@ namespace InitfileInternal {
...
@@ -164,7 +166,7 @@ namespace InitfileInternal {
temp_vec
[
i
]
=
c
[
i
];
temp_vec
[
i
]
=
c
[
i
];
convert
(
temp_vec
,
valStr
);
convert
(
temp_vec
,
valStr
);
}
}
}
// end namespace InitfileInternal
}
// end namespace InitfileInternal
/** The entry in an initfile. This helper class was constructed to allow calls like
/** The entry in an initfile. This helper class was constructed to allow calls like
* val = data.get(tag)
* val = data.get(tag)
...
@@ -375,4 +377,6 @@ protected:
...
@@ -375,4 +377,6 @@ protected:
int
msgInfo
,
msgWait
,
paramInfo
;
int
msgInfo
,
msgWait
,
paramInfo
;
};
};
}
// end namespace AMDiS
#endif
#endif
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