25 template<
typename T>
struct is_string : std::false_type {};
133 inline T get(
const T& defaultval =
T())
const
146 inline T get(
const T& defaultval =
T())
const
149 return m_obj->getattribute(
m_name, TypeString, &s) ?
T(s) : defaultval;
174 return m_obj->getattribute_indexed(
m_name, index, TypeString, &s)
186 if (t == TypeString) {
187 s = get<std::string>();
188 }
else if (t != TypeUnknown) {
189 const int localsize = 64;
190 char localbuffer[localsize];
191 char*
buffer = localbuffer;
192 std::unique_ptr<char[]> allocbuffer;
193 if (t.
size() > localsize) {
194 allocbuffer.reset(
new char[t.
size()]);
195 buffer = allocbuffer.get();
209 template<
typename T,
typename Allocator = std::allocator<T>>
210 inline std::vector<T, Allocator>
as_vec()
const
214 using Vec = std::vector<T, Allocator>;
216 result.reserve(basevals);
217 for (
size_t i = 0; i < basevals; ++i)
218 result.push_back(get_indexed<T>(
int(i)));
GLsizei const GLchar *const * string
GLsizei const GLfloat * value
**But if you need a result
OIIO_UTIL_API std::string tostring(TypeDesc type, const void *data, const char *float_fmt, const char *string_fmt="%s", const char aggregate_delim[2]="()", const char *aggregate_sep=",", const char array_delim[2]="{}", const char *array_sep=",")
basic_string_view< char > string_view
AttrDelegate(C *obj, string_view name)
OIIO_HOSTDEVICE OIIO_CONSTEXPR14 size_t basevalues() const noexcept
std::vector< T, Allocator > as_vec() const
GLuint const GLchar * name
OIIO_HOSTDEVICE size_t size() const noexcept
OIIO_API bool attribute(string_view name, TypeDesc type, const void *val)
const T & operator=(const T &val)
T get_indexed(int index, const T &defaultval=T()) const
#define OIIO_NAMESPACE_END
const char * operator=(const char *val)
std::string as_string(const std::string &defaultval=std::string())
#define OIIO_NAMESPACE_BEGIN