MaterialX 1.38.2
Util.h
Go to the documentation of this file.
1//
2// TM & (c) 2017 Lucasfilm Entertainment Company Ltd. and Lucasfilm Ltd.
3// All rights reserved. See LICENSE.txt for license.
4//
5
6#ifndef MATERIALX_UTIL
7#define MATERIALX_UTIL
8
11
13
14namespace MaterialX
15{
16
17extern MX_CORE_API const string EMPTY_STRING;
18
20MX_CORE_API string getVersionString();
21
24MX_CORE_API std::tuple<int, int, int> getVersionIntegers();
25
27MX_CORE_API string createValidName(string name, char replaceChar = '_');
28
30MX_CORE_API bool isValidName(const string& name);
31
33MX_CORE_API string incrementName(const string& name);
34
37MX_CORE_API StringVec splitString(const string& str, const string& sep);
38
40MX_CORE_API string replaceSubstrings(string str, const StringMap& stringMap);
41
43MX_CORE_API string stringToLower(string str);
44
46MX_CORE_API bool stringEndsWith(const string& str, const string& suffix);
47
49MX_CORE_API string trimSpaces(const string& str);
50
52template<typename T> void hashCombine(size_t& seed, const T& value)
53{
54 seed ^= std::hash<T>()(value) + 0x9e3779b9 + (seed << 6) + (seed >> 2);
55}
56
58MX_CORE_API StringVec splitNamePath(const string& namePath);
59
61MX_CORE_API string createNamePath(const StringVec& nameVec);
62
64MX_CORE_API string parentNamePath(const string& namePath);
65
66} // namespace MaterialX
67
68#endif
Import and export declarations for the Core library.
vector< string > StringVec
A vector of strings.
Definition: Library.h:56
void hashCombine(size_t &seed, const T &value)
Combine the hash of a value with an existing seed.
Definition: Util.h:52