New posts are disabled while we improve the user experience.

You can browse the site, or for urgent issues, raise a query at MyAccount.

question

Upvotes
Accepted
10 3 7 11

Can user always call getAsString() to a DataBuffer

Can I always call getAsString() to a DataBuffer object?

Assume the actual DataBuffer type is Time or DateTime. How will a value got by getAsString() look like?


#productrfa-apic++
icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

· Write an Answer
Upvotes
Accepted
87.8k 294 53 79

@ming.cheng

Thanks for reaching out to us.

Yes, it will get a string of that date or time.

FieldEntry [    79] HSTCLSDATE
GetAsString(): 16 FEB 2023
2/16/2023
...
FieldEntry [   287] LOW_TIME
GetAsString(): 08:08:37:000:000:000
8:8:37

The following is the description of this method.

const rfa::common::RFA_String& rfa::data::DataBuffer::getAsString() const

Returns select types that are converted to a string representation. The associated set methods converts select types from a string representation. Invalid types include XMLEnum, OpaqueEnum, ANSI_PageEnum

The code looks like this:

         case DataBuffer::DateEnum:
            printf("\nGetAsString(): %s\n", dataBuffer.getAsString().c_str());
            _out->out(dataBuffer.getDate());
            break;
        case DataBuffer::TimeEnum:
            printf("\nGetAsString(): %s\n", dataBuffer.getAsString().c_str());
            _out->out(dataBuffer.getTime());
            break;

I hope that this information is of help.

icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

So for type XMLEnum, OpaqueEnum, ANSI_PageEnum, user can't call getAsString(). It's ok for the rest.

You are correct.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.