Developer

API Reference

IvProperty

Brew Release
Brew MP 1.0.2
See Also
Description

Interface to parse the data stream containing vCard or vCalendar properties objects. IvProperty - Interface to IvProperty object.

Usage

Example usage, say if we have buffer as follows,
   TEL;TYPE=WORK,VOICE,PREF,MSG:+1-213-555-1234

   Once parsing is done we get the IvProperty object as, pIvProperty interface
   pointer. Some of the operations that can be performed

   Note: For our use case we assume the return values are AEE_SUCCESS and
         pointers passed in or allocated are valid

   //TEL;TYPE=WORK,VOICE,PREF,MSG:+1-213-555-1234
   void Sample_Properties_Usage1(IvProperty *pIvProperty)
   {
      int nResult = AEE_SUCCESS;
      int nNumParms = 0;
      IvParm *pIvParm = NULL;
      AEECLSID nObjectId = 0;
      AEEVProperty nPropId = 0;
      int nBufSizeReq = 0;
      char *pszStr = NULL;

      nResult = IvProperty_GetNumberOfParms(pIvProperty,0,&nNumParms);
      //upon return, nNumParms = 1;


      nResult = IvProperty_GetNumberOfParms(pIvProperty,
                                            AEEVPARM_TYPE,
                                            &nNumParms);
      //upon return, nNumParms=1

      nResult = IvProperty_GetParmAtIndex(pIvProperty, 0, 0,&pIvParm);
      //pIvParm would be pointing to a valid object

      nResult = IvParm_GetNumberOfValues(pIvParm,&nNumParms);
      //on return nNumParms=4

      nResult = IvProperty_GetObjectType(pIvProperty, &nObjectId);
      //upon return nObjectId=AEECLSID_vProperty

      nResult = IvProperty_GetId(pIvProperty,&nPropId);
      //on return nPropId = AEEVPROPERTY_TEL

      nResult = IvProperty_GetPropertyName(pIvProperty,NULL,0,&nBufSizeReq);

      pszStr = MALLOC(nBufSizeReq);

      nResult = IvProperty_GetPropertyName(pIvProperty,
                                           pszStr,
                                           nBufSizeReq,
                                           &nBufSizeReq);
      //upon return pszStr="TEL"

      IENV_FREEIF(pMe->pIEnv,pszStr);

      //get the raw buffer
      nResult = IvProperty_ParseValue(pIvProperty,
                                      FALSE,
                                      NULL,
                                      0,
                                      &nBufSizeReq);

      pszStr = MALLOC(nBufSizeReq);

      nResult = IvProperty_ParseValue(pIvProperty,
                                      FALSE,
                                      pszStr,
                                      nBufSizeReq,
                                      &nBufSizeReq);

      //upon return pszStr=+1-213-555-1234

      RELEASEIF(pIvParm);
      IENV_FREEIF(pMe->pIEnv,pszStr);
   }
   

   void Sample_Properties_Usage2(IEnv *pIEnv)
   {
      int nResult = AEE_SUCCESS;
      IvProperty *pIvProperty = NULL;
      AEEVDateTimePeriod time = {0,};

      nResult = IEnv_CreateInstance(pIEnv,
                                      AEECLSID_vProperty,
                                      (void **)&pIvProperty);

      //DTSTART:to current time in UTC

      time.dwValue1 = GETUTCSECONDS();
      time.bIsUTC = TRUE;
      time.dwValueType = AEEVVALUE_DATE_TIME;

      nResult = IvProperty_InitProperty(pIvProperty,
                                        AEEVPROPERTY_DTSTART,
                                        NULL,
                                        TRUE,
                                        &time,
                                        sizeof(time),
                                        NULL);


      RELEASEIF(pIvProperty);

      nResult = IEnv_CreateInstance(pIEnv,
                                      AEECLSID_vProperty,
                                      (void **)&pIvProperty);

      //If the user wants to intialise a property of the following format,
      //N:Public;John;Quinlan;Mr.;Esq.

      nResult = IvProperty_InitProperty(pIvProperty,
                                        0,
                                        "N",
                                        FALSE,
                                        "Public;John;Quinlan;Mr.;Esq.",
                                        std_strlen("Public;John;Quinlan;Mr.;Esq."),
                                        NULL);


      RELEASEIF(pIvProperty);

   }

  • Follow