From 321bddba749d6d2dd2756b15428f58bc8fd443cf Mon Sep 17 00:00:00 2001 From: Paul Beckingham Date: Fri, 25 Mar 2016 23:52:28 -0400 Subject: [PATCH] Rules: Added ::getIndentation --- src/Rules.cpp | 10 ++++++++++ src/Rules.h | 2 ++ 2 files changed, 12 insertions(+) diff --git a/src/Rules.cpp b/src/Rules.cpp index c0352838..1a64677d 100644 --- a/src/Rules.cpp +++ b/src/Rules.cpp @@ -333,3 +333,13 @@ void Rules::parseRuleTag (const std::vector & lines) } //////////////////////////////////////////////////////////////////////////////// +unsigned int Rules::getIndentation (const std::string& line) +{ + auto indent = line.find_first_not_of (" "); + if (indent == std::string::npos) + indent = 0; + + return indent; +} + +//////////////////////////////////////////////////////////////////////////////// diff --git a/src/Rules.h b/src/Rules.h index 15f9ada3..75e37dc1 100644 --- a/src/Rules.h +++ b/src/Rules.h @@ -61,6 +61,8 @@ private: void parseRuleExclusions (const std::vector &); void parseRuleTag (const std::vector &); + unsigned int getIndentation (const std::string&); + private: std::string _original_file {}; std::map _settings {};