From a6dcb236e2f1f7225ad03a75dd10640db4240adf Mon Sep 17 00:00:00 2001 From: gereon Date: Mon, 7 Jan 2013 12:25:53 +0100 Subject: [PATCH] implementing check for filename extension --- src/parser/AutoTransitionParser.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/parser/AutoTransitionParser.cpp b/src/parser/AutoTransitionParser.cpp index 517f72850..82243ee9f 100644 --- a/src/parser/AutoTransitionParser.cpp +++ b/src/parser/AutoTransitionParser.cpp @@ -61,6 +61,15 @@ AutoTransitionParser::AutoTransitionParser(const std::string& filename) TransitionType AutoTransitionParser::analyzeFilename(const std::string& filename) { TransitionType type = Unknown; + // find file extension + std::string::size_type extpos = filename.rfind("."); + if (extpos == std::string::npos) return Unknown; + else extpos++; + + // check file extension + if (filename.substr(extpos) == "dtmc") type = DTMC; + else if (filename.substr(extpos) == "ndtmc") type = NDTMC; + return type; }