Path: blob/master/thirdparty/embree/common/sys/estring.cpp
9912 views
// Copyright 2009-2021 Intel Corporation1// SPDX-License-Identifier: Apache-2.023#include "estring.h"45#include <algorithm>6#include <ctype.h>78namespace embree9{10char to_lower(char c) { return char(tolower(int(c))); }11char to_upper(char c) { return char(toupper(int(c))); }12std::string toLowerCase(const std::string& s) { std::string dst(s); std::transform(dst.begin(), dst.end(), dst.begin(), to_lower); return dst; }13std::string toUpperCase(const std::string& s) { std::string dst(s); std::transform(dst.begin(), dst.end(), dst.begin(), to_upper); return dst; }1415Vec2f string_to_Vec2f ( std::string str )16{17size_t next = 0;18const float x = std::stof(str,&next); str = str.substr(next+1);19const float y = std::stof(str,&next);20return Vec2f(x,y);21}2223Vec3f string_to_Vec3f ( std::string str )24{25size_t next = 0;26const float x = std::stof(str,&next); str = str.substr(next+1);27const float y = std::stof(str,&next); str = str.substr(next+1);28const float z = std::stof(str,&next);29return Vec3f(x,y,z);30}3132Vec4f string_to_Vec4f ( std::string str )33{34size_t next = 0;35const float x = std::stof(str,&next); str = str.substr(next+1);36const float y = std::stof(str,&next); str = str.substr(next+1);37const float z = std::stof(str,&next); str = str.substr(next+1);38const float w = std::stof(str,&next);39return Vec4f(x,y,z,w);40}41}424344