4 #include "pEpComServerAdapter_i.h"
5 #include "utf8_helper.h"
12 struct pEp_identity_cpp {
22 string _address = string(),
23 string _fpr = string(),
24 string _user_id = string(),
25 string _username = string(),
26 pEpComType _comm_type = pEpCtUnknown,
27 string _lang = string()
28 ) : address(_address), fpr(_fpr), user_id(_user_id), username(_username), comm_type(_comm_type), lang(_lang), me(false)
31 pEp_identity_cpp(const ::pEp_identity *_ident);
32 pEp_identity_cpp(const pEpIdentity *_ident);
34 pEp_identity * to_pEp_identity();
35 pEpIdentity * to_pEp_identity_s();
38 void copy_identity(pEpIdentity * ident_s, const pEp_identity * ident);
39 void free_identity_strings(pEpIdentity * ident_s);
40 void clear_identity_s(pEpIdentity& ident);
41 void clear_text_message(TextMessage *msg);
42 ::pEp_identity *new_identity(const pEpIdentity * ident);
44 void opt_field_array_from_C(stringpair_list_t* spair_list, LPSAFEARRAY* pair_list_out);
45 void clear_opt_field_array(LPSAFEARRAY* pair_list);
47 static LPTYPELIB pTypelib = NULL;
49 template< class UDType > static IRecordInfo *getRecordInfo()
51 LPTYPEINFO pTypeInfo = NULL;
52 LPSAFEARRAY psaUDType = NULL;
53 IRecordInfo* pRecInfo = NULL;
55 // Fetch the IRecordInfo interface describing the UDT
57 LoadRegTypeLib(LIBID_pEpCOMServerAdapterLib, 1, 0, GetUserDefaultLCID(), &pTypelib);
61 GUID guid = __uuidof(UDType);
62 HRESULT hr = pTypelib->GetTypeInfoOfGuid(guid, &pTypeInfo);
63 assert(SUCCEEDED(hr) && pTypeInfo);
64 hr = GetRecordInfoFromTypeInfo(pTypeInfo, &pRecInfo);
65 assert(SUCCEEDED(hr) && pRecInfo);
71 template< class UDType > LPSAFEARRAY newSafeArray(ULONG cElements)
73 IRecordInfo *pRecInfo = getRecordInfo< UDType >();
74 SAFEARRAYBOUND rgbounds = { cElements, 0 };
75 LPSAFEARRAY psaUDType = SafeArrayCreateEx(VT_RECORD, 1, &rgbounds, pRecInfo);
82 ::message * text_message_to_C(TextMessage *msg);
83 void text_message_from_C(TextMessage *msg2, const ::message *msg);