Add support for MacOS and old compilers (not supporting C++11). Main patch is from Samuel Marks.

This commit is contained in:
2022-11-21 17:56:29 +01:00
parent 6e3958f09e
commit 7878f91cdd
5 changed files with 77 additions and 8 deletions

View File

@@ -17,6 +17,7 @@
along with libgourou. If not, see <http://www.gnu.org/licenses/>.
*/
#include <cctype>
#include <fulfillment_item.h>
#include <libgourou_common.h>
#include "user.h"
@@ -93,8 +94,12 @@ namespace gourou
std::string FulfillmentItem::getMetadata(std::string name)
{
// https://stackoverflow.com/questions/313970/how-to-convert-an-instance-of-stdstring-to-lower-case
#if __STDC_VERSION__ >= 201112L
std::transform(name.begin(), name.end(), name.begin(),
[](unsigned char c){ return std::tolower(c); });
#else
std::transform(name.begin(), name.end(), name.begin(), tolower);
#endif
name = std::string("dc:") + name;
pugi::xpath_node path = metadatas.select_node(name.c_str());