variant

How do you read from a multidimensional variant array returned from a COM object in PHP?

和自甴很熟 提交于 2019-12-01 07:06:28
问题 I'm working with a COM object that returns a multidimensional VARIANT array (vt_array), and I'm trying to read values from the array. When I use print_r($mdArray) it displays variant Object . ( variant_get_type($mdArray) returns 8204 .) I tried using foreach ($mdArray as $oneArray) but I get the message: Warning: Loader::getfields() [loader.getfields]: Can only handle single dimension variant arrays (this array has 2) in C:\Inetpub\wwwroot\root\script\fileloader.php on line 135 Fatal error:

JAXB: Can't unmarshal JAXBElement<?>, getting ElementNSImpl instead

不羁岁月 提交于 2019-12-01 00:34:50
Related to JAXB: How to implement a JAXB-compatible variant wrapper class? , I tried to use JAXBElement to represent "variant" or "any-type". Marshalling went fine, but during Unmarshalling, JAXB tries to assign ElementNSImpl to a JAXBElement field. Test Code (copy+paste+run) import static java.lang.System.*; import java.io.*; import java.util.*; import javax.xml.bind.*; import javax.xml.bind.annotation.*; import javax.xml.namespace.*; import org.junit.*; public class _JaxbElementProblem { @XmlRootElement @XmlType @XmlAccessorType(XmlAccessType.NONE) static class MyObject { public static final

How to use variant arrays in Delphi

≡放荡痞女 提交于 2019-11-30 14:37:35
问题 I have two Delphi7 programs: a COM automation server (EXE) and the other program which is using the automation server. I need to pass an array of bytes from one program to the other. After some searching I've found that using variant arrays is the way to go (correct me please if you know any better methods). My question is: How do I create a variant array in one program, and then how do I read its values in the other? I know about VarArrayCreate and VarArrayLowBound/VarArrayHighBound, but I'm

What is boost::variant memory and performance cost?

核能气质少年 提交于 2019-11-30 11:47:32
boost::variant seems a powerful container to manipulate a heterogeneous set of types. I am wondering its cost. In memory, I think it takes up the size of the largest type plus an integer representing which(). For apply_visitor(), I think its performance is very good, it can call directly the function other than lots of ifs. Are my points right? o11c You're almost right. The size of boost::variant is is the max size of any element, rounded up as needed for the largest alignment , plus the size of some integer, and again rounded up. Think about a variant of these types, assuming the tag is

How to use variant arrays in Delphi

て烟熏妆下的殇ゞ 提交于 2019-11-30 11:22:21
I have two Delphi7 programs: a COM automation server (EXE) and the other program which is using the automation server. I need to pass an array of bytes from one program to the other. After some searching I've found that using variant arrays is the way to go (correct me please if you know any better methods). My question is: How do I create a variant array in one program, and then how do I read its values in the other? I know about VarArrayCreate and VarArrayLowBound/VarArrayHighBound, but I'm unsure on how to do this properly. Thanks! Runner You create it like that: Declarations first var

Variant datatype library for C

爷,独闯天下 提交于 2019-11-30 06:02:44
问题 Is there a decent open-source C library for storing and manipulating dynamically-typed variables (a.k.a. variants)? I'm primarily interested in atomic values (int8, int16, int32, uint, strings, blobs, etc.), while JSON-style arrays and objects as well as custom objects would also be nice. A major case where such a library would be useful is in working with SQL databases. The most obvious feature of such a library would be a single type for all supported values, e.g.: struct Variant { enum

get<string> for variants fail under clang++ but not g++

流过昼夜 提交于 2019-11-29 13:07:41
The following code: variant<string> x = "abc"; cout << get<string>(x) << "\n"; works fine under g++ (version 7.2). However, when compiled under clang++ (version 5.0) using libstdc++, I get the following error in the get method: /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/7.2.0/../../../../include/c++/7.2.0/variant:238:46: fatal error: cannot cast 'std::variant<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >' to its private base class 'std::__detail::__variant::_Variant_storage<false, std:: __cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>

How to convert 8209 array object variant to VT_VARIANT

风格不统一 提交于 2019-11-29 13:04:01
I am calling a COM object method that returns an array variant object of type 8209 in my PHP code. $com_VArray = $com_Object->objectMethod; //Is a 8209 variant object I want in the end to pass the converted VT_VARIANT object as a value for another COM object method which requires its input to be VT_VARIANT[12]. I am converting $com_VArray to a VT_VARIANT object variant type by issuing the following $obj_VT_VARIANT = variant_cast($com_VArray, VT_VARIANT); But then I get this following error Fatal error: Uncaught exception 'com_exception' with message 'Variant type conversion failed: Type

BSTR's and VARIANT's under… mac os x

亡梦爱人 提交于 2019-11-29 12:49:41
Under mac os x I have office 2011 and its excel and VBA, and I have gcc-5.3.0's g++. I played a lot to passing arrays (of numerical built-in types) from VBA to the dylib (extension of dll's on mac os x) and updating them and sending them back to VBA, see for instance : passing c/c++ dylib function taking pointer to VBA on mac Now, I would like to do the same with strings, and first with just one string, not an array. I want to receive the string from VBA, modify it in C++, and send it back, updated, to VBA. The code on the C++ side is : #include <stdlib.h> #include <ctype.h> //for toupper

How to check whether a variant array is unallocated?

隐身守侯 提交于 2019-11-29 12:21:31
问题 Dim Result() As Variant In my watch window, this appears as Expression | Value | Type Result | | Variant/Variant() How do I check the following: if Result is nothing then or if Result is Not Set then This is basically what I am trying to accomplish, but the first one does not work and the second does not exist. 回答1: Chip Pearson made a useful module called modArraySupport that contains a bunch of functions to test for things like this. In your case, you would want to use IsArrayAllocated .