Browse Source

Fix ambigious isspace that was preventing compilation, introduced by some earlier commit.

main
Sebastian Junges 8 years ago
parent
commit
cb5aff10ae
  1. 26
      src/storm-gspn/parser/GreatSpnEditorProjectParser.cpp
  2. 33
      src/storm-gspn/parser/PnmlParser.cpp

26
src/storm-gspn/parser/GreatSpnEditorProjectParser.cpp

@ -2,6 +2,8 @@
#ifdef STORM_HAVE_XERCES
#include <iostream>
#include <algorithm>
#include "storm-gspn/adapters/XercesAdapter.h"
@ -9,8 +11,18 @@
#include "storm/exceptions/WrongFormatException.h"
#include "storm/utility/macros.h"
namespace {
bool isOnlyWhitespace(std::string const& in) {
return std::all_of(in.begin(), in.end(), [](char c){
return std::isspace(static_cast<unsigned char>(c));
});
}
}
namespace storm {
namespace parser {
storm::gspn::GSPN* GreatSpnEditorProjectParser::parse(xercesc::DOMElement const* elementRoot) {
if (storm::adapters::XMLtoString(elementRoot->getTagName()) == "project") {
traverseProjectElement(elementRoot);
@ -46,7 +58,7 @@ namespace storm {
if (name.compare("gspn") == 0) {
traverseGspnElement(child);
} else if (std::all_of(name.begin(), name.end(), isspace)) {
} else if (isOnlyWhitespace(name)) {
// ignore node (contains only whitespace)
} else {
// Found node or attribute which is at the moment nod handled by this parser.
@ -84,7 +96,7 @@ namespace storm {
traverseNodesElement(child);
} else if (name.compare("edges") == 0) {
traverseEdgesElement(child);
} else if (std::all_of(name.begin(), name.end(), isspace)) {
} else if (isOnlyWhitespace(name)) {
// ignore node (contains only whitespace)
} else {
// Found node or attribute which is at the moment nod handled by this parser.
@ -114,7 +126,7 @@ namespace storm {
traversePlaceElement(child);
} else if(name.compare("transition") == 0) {
traverseTransitionElement(child);
} else if (std::all_of(name.begin(), name.end(), isspace)) {
} else if (isOnlyWhitespace(name)) {
// ignore node (contains only whitespace)
} else {
// Found node or attribute which is at the moment nod handled by this parser.
@ -144,7 +156,7 @@ namespace storm {
if (name.compare("arc") == 0) {
traverseArcElement(child);
} else if (std::all_of(name.begin(), name.end(), isspace)) {
} else if (isOnlyWhitespace(name)) {
// ignore node (contains only whitespace)
} else {
// Found node or attribute which is at the moment nod handled by this parser.
@ -192,7 +204,7 @@ namespace storm {
auto child = node->getChildNodes()->item(i);
auto name = storm::adapters::getName(child);
if (std::all_of(name.begin(), name.end(), isspace)) {
if (isOnlyWhitespace(name)) {
// ignore node (contains only whitespace)
} else {
// Found node or attribute which is at the moment nod handled by this parser.
@ -252,7 +264,7 @@ namespace storm {
auto child = node->getChildNodes()->item(i);
auto name = storm::adapters::getName(child);
if (std::all_of(name.begin(), name.end(), isspace)) {
if (isOnlyWhitespace(name)) {
// ignore node (contains only whitespace)
} else {
// Found node or attribute which is at the moment nod handled by this parser.
@ -325,7 +337,7 @@ namespace storm {
auto child = node->getChildNodes()->item(i);
auto name = storm::adapters::getName(child);
if (std::all_of(name.begin(), name.end(), isspace)) {
if (isOnlyWhitespace(name)) {
// ignore node (contains only whitespace)
} else if(ignoreArcChild(name)) {
// ignore

33
src/storm-gspn/parser/PnmlParser.cpp

@ -9,8 +9,19 @@
#include "storm/exceptions/WrongFormatException.h"
#include "storm/utility/macros.h"
namespace {
bool isOnlyWhitespace(std::string const& in) {
return std::all_of(in.begin(), in.end(), [](char c){
return std::isspace(static_cast<unsigned char>(c));
});
}
}
namespace storm {
namespace parser {
storm::gspn::GSPN * PnmlParser::parse(xercesc::DOMElement const* elementRoot ) {
if (storm::adapters::getName(elementRoot) == "pnml") {
traversePnmlElement(elementRoot);
@ -39,7 +50,7 @@ namespace storm {
if (name == "net") {
traverseNetOrPage(child);
} else if (std::all_of(name.begin(), name.end(), isspace)) {
} else if (isOnlyWhitespace(name)) {
// ignore node (contains only whitespace)
} else {
// Found node or attribute which is at the moment nod handled by this parser.
@ -79,7 +90,7 @@ namespace storm {
// Some pnml files have a child named page.
// The page node has the same children like the net node (e.g., place, transition, arc)
traverseNetOrPage(child);
} else if (std::all_of(name.begin(), name.end(), isspace)) {
} else if (isOnlyWhitespace(name)) {
// ignore node (contains only whitespace)
} else {
// Found node or attribute which is at the moment nod handled by this parser.
@ -120,7 +131,7 @@ namespace storm {
} else if(name == "capacity") {
capacity.first = true;
capacity.second = traverseCapacity(child);
} else if (std::all_of(name.begin(), name.end(), isspace)) {
} else if (isOnlyWhitespace(name)) {
// ignore node (contains only whitespace)
} else if (name == "name" ||
name == "graphics") {
@ -179,7 +190,7 @@ namespace storm {
timed.second = traverseTransitionType(child);
} else if (name == "priority") {
priority = traversePriority(child);
} else if (std::all_of(name.begin(), name.end(), isspace)) {
} else if (isOnlyWhitespace(name)) {
// ignore node (contains only whitespace)
} else if (name == "graphics" ||
name == "name" ||
@ -255,7 +266,7 @@ namespace storm {
} else if(name == "inscription") {
multiplicity.first = true;
multiplicity.second = traverseMultiplicity(child);
} else if (std::all_of(name.begin(), name.end(), isspace)) {
} else if (isOnlyWhitespace(name)) {
// ignore node (contains only whitespace)
} else if (name == "graphics" || name == "arcpath" || name == "tagged") {
// ignore these tags
@ -304,7 +315,7 @@ namespace storm {
auto value = storm::adapters::getName(child->getFirstChild());
value = value.substr(std::string("Default,").length());
result = std::stoull(value);
} else if (std::all_of(name.begin(), name.end(), isspace)) {
} else if (isOnlyWhitespace(name)) {
// ignore node (contains only whitespace)
} else if (name == "graphics") {
// ignore these tags
@ -330,7 +341,7 @@ namespace storm {
result = std::stoull(value);
} else if (name == "graphics") {
// ignore these nodes
} else if (std::all_of(name.begin(), name.end(), isspace)) {
} else if (isOnlyWhitespace(name)) {
// ignore node (contains only whitespace)
} else {
// Found node or attribute which is at the moment nod handled by this parser.
@ -354,7 +365,7 @@ namespace storm {
result = std::stoull(value);
} else if (name == "graphics") {
// ignore these nodes
} else if (std::all_of(name.begin(), name.end(), isspace)) {
} else if (isOnlyWhitespace(name)) {
// ignore node (contains only whitespace)
} else {
// Found node or attribute which is at the moment nod handled by this parser.
@ -373,7 +384,7 @@ namespace storm {
auto name = storm::adapters::getName(child);
if (name == "value") {
result = storm::adapters::getName(child->getFirstChild());
} else if (std::all_of(name.begin(), name.end(), isspace)) {
} else if (isOnlyWhitespace(name)) {
// ignore node (contains only whitespace)
} else {
// Found node or attribute which is at the moment nod handled by this parser.
@ -391,7 +402,7 @@ namespace storm {
auto name = storm::adapters::getName(child);
if (name == "value") {
result = storm::adapters::getName(child->getFirstChild()) == "true" ? true : false;
} else if (std::all_of(name.begin(), name.end(), isspace)) {
} else if (isOnlyWhitespace(name)) {
// ignore node (contains only whitespace)
} else {
// Found node or attribute which is at the moment nod handled by this parser.
@ -428,7 +439,7 @@ namespace storm {
auto value = storm::adapters::getName(child->getFirstChild());
value = value.substr(std::string("Default,").length());
result = std::stoull(value);
} else if (std::all_of(name.begin(), name.end(), isspace)) {
} else if (isOnlyWhitespace(name)) {
// ignore node (contains only whitespace)
} else if (name == "graphics") {
// ignore these tags

Loading…
Cancel
Save