4 #ifndef OPENVDB_UTIL_NAME_HAS_BEEN_INCLUDED
5 #define OPENVDB_UTIL_NAME_HAS_BEEN_INCLUDED
25 is.read(reinterpret_cast<char*>(&size),
sizeof(uint32_t));
27 if (size>0) is.read(&buffer[0], size);
35 uint32_t
size = uint32_t(name.size());
36 os.write(reinterpret_cast<char*>(&size),
sizeof(uint32_t));
37 os.write(&name[0], size);
42 template <
typename ContainerT>
46 if (in.empty())
return;
47 std::string::size_type pos = 0u, old = 0u;
48 while ((pos = in.find(delim, pos)) != std::string::npos) {
49 out.insert(out.end(), in.substr(old, (pos-old)));
53 out.insert(out.end(), in.substr(old, in.length()-old));
56 template <
typename ContainerT>
57 inline void split(ContainerT& out,
const std::string& in,
const std::set<char>& delims)
60 if (in.empty())
return;
61 std::string::size_type pos = 0u, old = 0u;
62 const std::string seq(delims.begin(), delims.end());
63 while ((pos = in.find_first_of(seq, pos)) != std::string::npos) {
64 out.insert(out.end(), in.substr(old, (pos-old)));
68 out.insert(out.end(), in.substr(old, in.length()-old));
73 if (start.length() > in.length())
return false;
74 return std::equal(start.begin(), start.end(), in.begin());
79 if (end.length() > in.length())
return false;
80 return std::equal(end.rbegin(), end.rend(), in.rbegin());
86 s.erase(s.begin(), std::find_if(s.begin(), s.end(), [](
int ch) {
91 s.erase(std::find_if(s.rbegin(), s.rend(), [](
int ch) {
99 [](
auto c){
return std::tolower(
c); });
107 #endif // OPENVDB_UTIL_NAME_HAS_BEEN_INCLUDED
bool starts_with(const std::string &in, const std::string &start)
void to_lower(std::string &s)
GLsizei const GLchar *const * string
#define OPENVDB_USE_VERSION_NAMESPACE
IMATH_HOSTDEVICE constexpr bool equal(T1 a, T2 b, T3 t) IMATH_NOEXCEPT
void writeString(std::ostream &os, const Name &name)
bool ends_with(const std::string &in, const std::string &end)
void trim(std::string &s)
GLuint const GLchar * name
GA_API const UT_StringHolder transform
Library and file format version numbers.
Name readString(std::istream &is)
void split(ContainerT &out, const std::string &in, const char delim)
#define OPENVDB_VERSION_NAME
The version namespace name for this library version.