本文整理汇总了C++中tTJSVariant::GetString方法的典型用法代码示例。如果您正苦于以下问题:C++ tTJSVariant::GetString方法的具体用法?C++ tTJSVariant::GetString怎么用?C++ tTJSVariant::GetString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类tTJSVariant
的用法示例。
在下文中一共展示了tTJSVariant::GetString方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: exec
// 実行
bool exec(iTJSDispatch2 *obj, tTVPWindowMessage *message) {
switch (receiver.Type()) {
case tvtObject:
{
tTJSVariant result;
tTJSVariant wparam = (tjs_int)message->WParam;
tTJSVariant lparam = (tjs_int)message->LParam;
tTJSVariant *p[] = {&userData, &wparam, &lparam};
receiver.AsObjectClosureNoAddRef().FuncCall(0, NULL, NULL, &result, 3, p, NULL);
return (int)result != 0;
}
break;
case tvtString:
{
tTJSVariant result;
tTJSVariant wparam = (tjs_int)message->WParam;
tTJSVariant lparam = (tjs_int)message->LParam;
tTJSVariant *p[] = {&userData, &wparam, &lparam};
obj->FuncCall(0, receiver.GetString(), NULL, &result, 3, p, obj);
return (int)result != 0;
}
break;
case tvtInteger:
{
NativeReceiver receiverNative = (NativeReceiver)(tjs_int)receiver;
return receiverNative(obj, (void*)(tjs_int)userData, message);
}
break;
}
return false;
}
示例2: if
static void
getVariantString(tTJSVariant &var, IWriter *writer)
{
switch(var.Type()) {
case tvtVoid:
writer->write(L"void");
break;
case tvtObject:
{
iTJSDispatch2 *obj = var.AsObjectNoAddRef();
if (obj == NULL) {
writer->write(L"null");
} else if (obj->IsInstanceOf(TJS_IGNOREPROP,NULL,NULL,L"Array",obj) == TJS_S_TRUE) {
getArrayString(obj, writer);
} else {
getDictString(obj, writer);
}
}
break;
case tvtString:
quoteString(var.GetString(), writer);
break;
case tvtOctet:
quoteOctet(var.AsOctetNoAddRef(), writer);
break;
case tvtInteger:
writer->write(L"int ");
writer->write((tTVInteger)var);
break;
case tvtReal:
writer->write(L"real ");
writer->write((tTVReal)var);
break;
default:
writer->write(L"void");
break;
};
}
示例3: IDispatchWrapper
/**
* tTJSVariant を VARIANT に格納する
* @param result 格納先
* @param variant 格納元
*/
void
IDispatchWrapper::storeVariant(VARIANT &result, tTJSVariant &variant)
{
VariantClear(&result);
switch (variant.Type()) {
case tvtVoid:
//log(L"void");
break;
case tvtObject:
// オブジェクト
//log(L"object");
{
switch (variant.Type()) {
case tvtObject:
V_VT(&result) = VT_DISPATCH;
V_DISPATCH(&result) = new IDispatchWrapper(variant.AsObjectNoAddRef());
break;
default:
V_VT(&result) = VT_NULL;
break;
}
}
break;
case tvtString:
//log(L"string");
// 文字列
V_VT(&result) = VT_BSTR;
V_BSTR(&result) = SysAllocString(variant.GetString());
break;
case tvtOctet:
//log(L"octet");
// オクテット列
{
tTJSVariantOctet *octet = variant.AsOctetNoAddRef();
if (octet) {
SAFEARRAY *psa;
SAFEARRAYBOUND sabound;
sabound.lLbound = 0;
sabound.cElements = octet->GetLength();
if ((psa = SafeArrayCreate(VT_UI1, 1, &sabound))) {
// データをコピーする
unsigned char *p;
if (SUCCEEDED(SafeArrayAccessData(psa, (LPVOID*)&p))) {
memcpy(p, octet->GetData(), octet->GetLength());
SafeArrayUnaccessData(psa);
V_VT(&result) = VT_ARRAY | VT_UI1;
V_ARRAY(&result) = psa;
} else {
SafeArrayDestroy(psa);
}
} else {
// メモリ不足例外
}
}
}
break;
case tvtInteger:
// COM は 64bit をサポートしていない!!
// ということで COM に渡す引数で整数値は 32bit を超えないように注意すること(涙)
//log(L"integer");
V_VT(&result) = VT_I4;
V_I4(&result) = (int)(variant);
break;
case tvtReal:
//log(L"real");
V_VT(&result) = VT_R8;
V_R8(&result) = (double)(variant);
break;
}
}