diff --git a/lib/Basics/AttributeNameParser.cpp b/lib/Basics/AttributeNameParser.cpp index e6bb7e2a47..217689ae90 100644 --- a/lib/Basics/AttributeNameParser.cpp +++ b/lib/Basics/AttributeNameParser.cpp @@ -30,6 +30,8 @@ #include "AttributeNameParser.h" #include "Exceptions.h" +using AttributeName = triagens::basics::AttributeName; + void triagens::basics::TRI_ParseAttributeString ( std::string const& input, std::vector& result @@ -80,5 +82,31 @@ void triagens::basics::TRI_AttributeNamesToString ( } } +void triagens::basics::TRI_AttributeNamesToPidString ( + std::vector const& input, + std::string& result + ) { + TRI_ASSERT(result.size() == 0); + bool isFirst = true; + for (auto& it : input) { + if (! isFirst) { + result += "."; + } + isFirst = false; + result += it.name; + if (it.shouldExpand) { + break; + } + } +} - +bool triagens::basics::TRI_AttributeNamesHaveExpansion ( + std::vector const& input + ) { + for (auto& it : input) { + if (it.shouldExpand) { + return true; + } + } + return false; +} diff --git a/lib/Basics/AttributeNameParser.h b/lib/Basics/AttributeNameParser.h index f061536b12..cdb79ff0ba 100644 --- a/lib/Basics/AttributeNameParser.h +++ b/lib/Basics/AttributeNameParser.h @@ -90,6 +90,25 @@ namespace triagens { bool excludeExpansion = false ); +//////////////////////////////////////////////////////////////////////////////// +/// @brief Transform a vector of AttributeNames into a pid string. +/// Stops at first expansion +//////////////////////////////////////////////////////////////////////////////// + + void TRI_AttributeNamesToPidString ( + std::vector const& input, + std::string& result + ); + + +//////////////////////////////////////////////////////////////////////////////// +/// @brief Tests if this AttributeName uses an expansion operator +//////////////////////////////////////////////////////////////////////////////// + + bool TRI_AttributeNamesHaveExpansion ( + std::vector const& input + ); + } }