Changeset View
Changeset View
Standalone View
Standalone View
intern/cycles/util/util_string.cpp
| Show All 11 Lines | |||||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||||
| * See the License for the specific language governing permissions and | * See the License for the specific language governing permissions and | ||||
| * limitations under the License. | * limitations under the License. | ||||
| */ | */ | ||||
| #include <stdarg.h> | #include <stdarg.h> | ||||
| #include <stdio.h> | #include <stdio.h> | ||||
| #include <algorithm> | |||||
| #include <cctype> | |||||
| #include "util/util_foreach.h" | #include "util/util_foreach.h" | ||||
| #include "util/util_string.h" | #include "util/util_string.h" | ||||
| #include "util/util_windows.h" | #include "util/util_windows.h" | ||||
| #ifdef _WIN32 | #ifdef _WIN32 | ||||
| # ifndef vsnprintf | # ifndef vsnprintf | ||||
| # define vsnprintf _vsnprintf | # define vsnprintf _vsnprintf | ||||
| # endif | # endif | ||||
| ▲ Show 20 Lines • Show All 139 Lines • ▼ Show 20 Lines | else | ||||
| return "False"; | return "False"; | ||||
| } | } | ||||
| string to_string(const char *str) | string to_string(const char *str) | ||||
| { | { | ||||
| return string(str); | return string(str); | ||||
| } | } | ||||
| string string_to_lower(const string &s) | |||||
| { | |||||
| string r = s; | |||||
| std::transform(r.begin(), r.end(), r.begin(), [](char c) { return std::tolower(c); }); | |||||
| return r; | |||||
| } | |||||
| /* Wide char strings helpers for Windows. */ | /* Wide char strings helpers for Windows. */ | ||||
| #ifdef _WIN32 | #ifdef _WIN32 | ||||
| wstring string_to_wstring(const string &str) | wstring string_to_wstring(const string &str) | ||||
| { | { | ||||
| const int length_wc = MultiByteToWideChar(CP_UTF8, 0, str.c_str(), str.length(), NULL, 0); | const int length_wc = MultiByteToWideChar(CP_UTF8, 0, str.c_str(), str.length(), NULL, 0); | ||||
| wstring str_wc(length_wc, 0); | wstring str_wc(length_wc, 0); | ||||
| ▲ Show 20 Lines • Show All 74 Lines • Show Last 20 Lines | |||||