28 #define _unused(x) ((void)(x)) 30 #include "SUAPI-CppWrapper/model/RenderingOptions.hpp" 31 #include "SUAPI-CppWrapper/String.hpp" 32 #include "SUAPI-CppWrapper/model/TypedValue.hpp" 38 RenderingOptions::RenderingOptions()
39 : m_rendering_options(SU_INVALID)
44 RenderingOptions::RenderingOptions(SURenderingOptionsRef ref)
45 : m_rendering_options(ref)
49 RenderingOptions::~RenderingOptions()
53 std::vector<std::string> RenderingOptions::get_keys()
const 55 size_t len = 0, count = 0;
56 SUResult res = SU_ERROR_NONE;
58 res = SURenderingOptionsGetNumKeys(m_rendering_options, &len);
59 assert(res == SU_ERROR_NONE);
62 std::vector<SUStringRef> refs(len, SU_INVALID);
63 for(
auto i = 0; i < len; i++) {
64 res = SUStringCreate(&refs[i]);
65 assert(res == SU_ERROR_NONE);
67 res = SURenderingOptionsGetKeys(m_rendering_options, len, &refs[0], &count);
68 assert(res == SU_ERROR_NONE); _unused(res);
69 std::vector<std::string> keys;
70 for(
auto ref : refs) {
71 keys.push_back(String(ref).std_string());
76 TypedValue RenderingOptions::get_value(
const std::string& key)
const 78 SUResult res = SU_ERROR_NONE;
79 SUTypedValueRef tval = SU_INVALID;
80 SUTypedValueRef* pTval = &tval;
81 res = SUTypedValueCreate(pTval);
82 assert(res == SU_ERROR_NONE);
83 res = SURenderingOptionsGetValue(m_rendering_options, key.c_str(), pTval);
84 assert(res == SU_ERROR_NONE); _unused(res);
85 return TypedValue(*pTval);
88 bool CW::RenderingOptions::set_value(
const std::string& key,
const TypedValue& tval)
90 SUResult res = SU_ERROR_NONE;
91 SUTypedValueRef tref = tval.ref();
92 res = SURenderingOptionsSetValue(m_rendering_options, key.c_str(), tref);
93 if(res == SU_ERROR_NONE)