28 #define _unused(x) ((void)(x)) 30 #include "SUAPI-CppWrapper/model/ShadowInfo.hpp" 31 #include "SUAPI-CppWrapper/String.hpp" 32 #include "SUAPI-CppWrapper/model/TypedValue.hpp" 39 ShadowInfo::ShadowInfo()
40 : m_shadow_info(SU_INVALID)
45 CW::ShadowInfo::ShadowInfo(SUShadowInfoRef ref)
50 ShadowInfo::~ShadowInfo()
55 std::vector<std::string> ShadowInfo::get_keys()
57 size_t len = 0, count = 0;
58 SUResult res = SU_ERROR_NONE;
60 res = SUShadowInfoGetNumKeys(m_shadow_info, &len);
61 assert(res == SU_ERROR_NONE);
64 std::vector<SUStringRef> refs(len, SU_INVALID);
65 for(
auto i = 0; i < len; i++) {
66 res = SUStringCreate(&refs[i]);
67 assert(res == SU_ERROR_NONE);
69 res = SUShadowInfoGetKeys(m_shadow_info, len, &refs[0], &count);
70 assert(res == SU_ERROR_NONE); _unused(res);
71 std::vector<std::string> keys;
72 for(
auto ref : refs) {
73 keys.push_back(String(ref).std_string());
78 TypedValue ShadowInfo::get_value(
const std::string& key)
80 SUResult res = SU_ERROR_NONE;
81 SUTypedValueRef tval = SU_INVALID;
82 SUTypedValueRef* pTval = &tval;
83 res = SUTypedValueCreate(pTval);
84 assert(res == SU_ERROR_NONE);
85 res = SUShadowInfoGetValue(m_shadow_info, key.c_str(), pTval);
86 assert(res == SU_ERROR_NONE); _unused(res);
87 return TypedValue(*pTval);
90 bool ShadowInfo::set_value(
const std::string& key,
const TypedValue& tval)
92 SUResult res = SU_ERROR_NONE;
93 SUTypedValueRef tref = tval.ref();
94 res = SUShadowInfoSetValue(m_shadow_info, key.c_str(), tref);
95 if(res == SU_ERROR_NONE)