From e7747902e509cdbf895af3a7bc2025fe8193e3f7 Mon Sep 17 00:00:00 2001 From: Stefan Radomski Date: Mon, 12 Dec 2016 21:59:18 +0100 Subject: Reduced header dependencies --- src/uscxml/interpreter/Logging.h | 2 -- src/uscxml/plugins/Factory.h | 1 - src/uscxml/util/Convenience.cpp | 20 ++++++++++++++++++++ src/uscxml/util/Convenience.h | 20 +------------------- test/CMakeLists.txt | 4 ++-- 5 files changed, 23 insertions(+), 24 deletions(-) diff --git a/src/uscxml/interpreter/Logging.h b/src/uscxml/interpreter/Logging.h index 7221d5b..b139211 100644 --- a/src/uscxml/interpreter/Logging.h +++ b/src/uscxml/interpreter/Logging.h @@ -20,9 +20,7 @@ #ifndef LOGGING_H_3B1A3A0F #define LOGGING_H_3B1A3A0F -#include "uscxml/config.h" #include "uscxml/Common.h" - #include "uscxml/messages/Data.h" #include "uscxml/messages/Event.h" diff --git a/src/uscxml/plugins/Factory.h b/src/uscxml/plugins/Factory.h index e0015b5..f80b581 100644 --- a/src/uscxml/plugins/Factory.h +++ b/src/uscxml/plugins/Factory.h @@ -34,7 +34,6 @@ #include "Pluma/Pluma.hpp" #endif -#include #include #include #include diff --git a/src/uscxml/util/Convenience.cpp b/src/uscxml/util/Convenience.cpp index 7ceb875..a0263d2 100644 --- a/src/uscxml/util/Convenience.cpp +++ b/src/uscxml/util/Convenience.cpp @@ -23,6 +23,26 @@ namespace uscxml { +NumAttr::NumAttr(const std::string& str) { + size_t valueStart = str.find_first_of("0123456789."); + if (valueStart != std::string::npos) { + size_t valueEnd = str.find_last_of("0123456789."); + if (valueEnd != std::string::npos) { + value = str.substr(valueStart, (valueEnd - valueStart) + 1); + size_t unitStart = str.find_first_not_of(" \t", valueEnd + 1); + if (unitStart != std::string::npos) { + size_t unitEnd = str.find_last_of(" \t"); + if (unitEnd != std::string::npos && unitEnd > unitStart) { + unit = str.substr(unitStart, unitEnd - unitStart); + } else { + unit = str.substr(unitStart, str.length() - unitStart); + } + } + } + } +} + + bool isnan(double x) { return x != x; } diff --git a/src/uscxml/util/Convenience.h b/src/uscxml/util/Convenience.h index 532bcc0..cb4416d 100644 --- a/src/uscxml/util/Convenience.h +++ b/src/uscxml/util/Convenience.h @@ -45,25 +45,7 @@ template T strTo(std::string tmp) { class USCXML_API NumAttr { public: - NumAttr(const std::string& str) { - size_t valueStart = str.find_first_of("0123456789."); - if (valueStart != std::string::npos) { - size_t valueEnd = str.find_last_of("0123456789."); - if (valueEnd != std::string::npos) { - value = str.substr(valueStart, (valueEnd - valueStart) + 1); - size_t unitStart = str.find_first_not_of(" \t", valueEnd + 1); - if (unitStart != std::string::npos) { - size_t unitEnd = str.find_last_of(" \t"); - if (unitEnd != std::string::npos && unitEnd > unitStart) { - unit = str.substr(unitStart, unitEnd - unitStart); - } else { - unit = str.substr(unitStart, str.length() - unitStart); - } - } - } - } - } - + NumAttr(const std::string& str); std::string value; std::string unit; }; diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index c2fe40c..f5eba88 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -88,11 +88,11 @@ foreach (USCXML_ISSUE ${USCXML_ISSUES}) endif () endforeach () -# make sure all headers are self-reliant +# make sure the important headers are self-reliant set(USCXML_PUBLIC_HEADERS "${PROJECT_SOURCE_DIR}/src/uscxml/uscxml.h" "${PROJECT_SOURCE_DIR}/src/uscxml/Interpreter.h" - ) + ) file(GLOB_RECURSE USCXML_HEADERS ../src/*.h -- cgit v0.12