本文整理汇总了C++中tTJSVariant::Clear方法的典型用法代码示例。如果您正苦于以下问题:C++ tTJSVariant::Clear方法的具体用法?C++ tTJSVariant::Clear怎么用?C++ tTJSVariant::Clear使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类tTJSVariant
的用法示例。
在下文中一共展示了tTJSVariant::Clear方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: if
/**
* XMLのノードから tTJSVariantを取得する
* @param var 結果格納先
* @param node ノード
*/
static void
getVariantFromNode(tTJSVariant &var, xml_node *node)
{
if (node && node->type() == rapidxml::node_element) {
if (_wcsicmp(node->name(), L"undefined") == 0) {
var.Clear();
} else if (_wcsicmp(node->name(), L"null") == 0) {
var = tTJSVariant((iTJSDispatch2*)NULL);
} else if (_wcsicmp(node->name(), L"array") == 0) {
iTJSDispatch2 *array = TJSCreateArrayObject();
for (xml_node *propNode = node->first_node(); propNode; propNode = propNode->next_sibling()) {
if (_wcsicmp(propNode->name(), L"property") == 0) {
xml_attribute *attr_id = propNode->first_attribute(L"id");
if (attr_id) {
tjs_int id = wcstol(attr_id->value(), NULL, 10);
xml_node *valueNode = propNode->first_node();
if (valueNode) {
tTJSVariant value;
getVariantFromNode(value, valueNode);
array->PropSetByNum(0, id, &value, array);
}
}
}
}
var = tTJSVariant(array, array);
array->Release();
} else if (_wcsicmp(node->name(), L"object") == 0) {
iTJSDispatch2 *dict = TJSCreateDictionaryObject();
for (xml_node *propNode = node->first_node(); propNode; propNode = propNode->next_sibling()) {
if (_wcsicmp(propNode->name(), L"property") == 0) {
xml_attribute *attr_id = propNode->first_attribute(L"id");
if (attr_id) {
ttstr id = attr_id->value();
if (id.length() > 0) {
xml_node *valueNode = propNode->first_node();
if (valueNode) {
tTJSVariant value;
getVariantFromNode(value, valueNode);
dict->PropSet(0, id.c_str(), 0, &value, dict);
}
}
}
}
}
var = tTJSVariant(dict, dict);
dict->Release();
} else if (_wcsicmp(node->name(), L"string") == 0) {
var = node->value();
} else if (_wcsicmp(node->name(), L"number") == 0) {
var = wcstod(node->value(), NULL);
}
} else {
var.Clear();
}
}
示例2: FuncCall
virtual tjs_error TJS_INTF_METHOD FuncCall( // function invocation
tjs_uint32 flag, // calling flag
const tjs_char * membername,// member name ( NULL for a default member )
tjs_uint32 *hint, // hint for the member name (in/out)
tTJSVariant *result, // result
tjs_int numparams, // number of parameters
tTJSVariant **param, // parameters
iTJSDispatch2 *objthis // object as "this"
) {
breakResult.Clear();
if (numparams > 1) {
if ((int)*param[1] != TJS_HIDDENMEMBER) {
paramList[0] = param[0];
paramList[1] = param[2];
(void)func->FuncCall(0, NULL, NULL, &breakResult, paramCount, paramList, functhis);
}
}
if (result) {
*result = breakResult.Type() == tvtVoid;
}
return TJS_S_OK;
}
示例3: tTJSVariant
/**
* VARIANT を tTJSVariant に格納する
* @param result 変換先
* @param variant 変換元
*/
void
IDispatchWrapper::storeVariant(tTJSVariant &result, VARIANT &variant)
{
result.Clear();
switch (variant.vt) {
case VT_NULL:
result = (iTJSDispatch2*)NULL;
break;
case VT_I8:
result = variant.llVal;
break;
case VT_I4:
result = (tjs_int32)variant.lVal;
break;
case VT_UI1:
result = (tjs_int32)variant.bVal;
break;
case VT_I2:
result = (tjs_int32)variant.iVal;
break;
case VT_R4:
result = (double)variant.fltVal;
break;
case VT_R8:
result = variant.dblVal;
break;
case VT_BOOL:
result = (variant.boolVal == VARIANT_TRUE);
break;
case VT_BSTR:
result = variant.bstrVal;
break;
case VT_ARRAY | VT_UI1:
{
SAFEARRAY *psa = variant.parray;
unsigned char *p;
if (SUCCEEDED(SafeArrayAccessData(psa, (LPVOID*)&p))) {
// p;
//psa->rgsabound->cElements;
// XXX variant にどう入れよう?
SafeArrayUnaccessData(psa);
}
}
break;
case VT_UNKNOWN:
case VT_DISPATCH:
if (variant.punkVal) {
iTJSDispatch2 *obj = NULL;
if (variant.punkVal->QueryInterface(IID_iTJSDispatch2, (void**)&obj) == S_OK) {
result = obj;
obj->Release();
} else {
IDispatch *dispatch = NULL;
if (variant.punkVal->QueryInterface(IID_IDispatch, (void**)&dispatch) == S_OK) {
iTJSDispatch2 *obj = new iTJSDispatch2Wrapper(dispatch);
result = obj;
obj->Release();
dispatch->Release();
}
}
} else {
result = (iTJSDispatch2*)NULL;
}
break;
case VT_BYREF | VT_I8:
result = *variant.pllVal;
break;
case VT_BYREF | VT_I4:
result = (tjs_int32)*variant.plVal;
break;
case VT_BYREF | VT_UI1:
result = (tjs_int32)*variant.pbVal;
break;
case VT_BYREF | VT_I2:
result = (tjs_int32)*variant.piVal;
break;
case VT_BYREF | VT_R4:
result = *variant.pfltVal;
break;
case VT_BYREF | VT_R8:
result = *variant.pdblVal;
break;
case VT_BYREF | VT_BOOL:
result = (*variant.pboolVal == VARIANT_TRUE);
break;
case VT_BYREF | VT_BSTR:
result = *variant.pbstrVal;
break;
case VT_BYREF | VT_ARRAY | VT_UI1:
{
SAFEARRAY *psa = *(variant.pparray);
const tjs_uint8 *p;
if (SUCCEEDED(SafeArrayAccessData(psa, (LPVOID*)&p))) {
result = tTJSVariant(p, psa->rgsabound->cElements);
SafeArrayUnaccessData(psa);
//.........这里部分代码省略.........