[C++] Any to Sequence < Any > Conversion/Extraction

Java, C++, C#, Delphi... - Using the UNO bridges
Post Reply
andre4s_y
Posts: 7
Joined: Tue Apr 13, 2010 7:02 am

[C++] Any to Sequence < Any > Conversion/Extraction

Post by andre4s_y »

Hi.. Help me...
I want to know how proper way to convert/extract (i do not know the exact term) Any value which has TypeClass_SEQUENCE to Sequence of Any in C++.
For example:

Code: Select all

//UNO/C++
    Any any_value;
    any_value = any_type; // dummy: any_tipe is any type from anywhere
    TypeClass type;
    type = any_value.getValueTypeClass();
    if(type == TypeClass_SEQUENCE)
    {
        Sequence < Any > seq_any;
        if(any_value>>=seq_any)
        {
            //do something if extraction success..
            //for example seq_any.getLength();
        }
        else
        {
            //the code stuck here.
            //the extraction is failed!
        }
    }
The code will success if i extract Any to Sequence of (for example) OUString. In this part, i exactly know that Any is Sequence of OUString.
Example:

Code: Select all

//UNO/C++
    Any any_value;
    any_value = any_string; //i know that this contain sequence of OUString
    TypeClass type;
    type = any_value.getValueTypeClass();
    if(type == TypeClass_SEQUENCE)
    {
        Sequence < OUString > seq_string;
        if(any_value>>=seq_string)
        {
            //success
        }
        else
        {
            //code never reach this part.
        }
    }
If actually the code can not do extraction from Any to Sequence of Any,
how i can identify what TypeClass is Any inside Sequence of Any which is Sequence of Any is an Any?
:knock:
Thank you for your guidance..
----
OOo 3.1.0 (Build:9399) On Ubuntu 8.04
Post Reply