Developer

API Reference

IvObjectParser

Brew Release
Brew MP 1.0.2
See Also
None
Description
END:VALARM END:VEVENT END:VCALENDAR
Note: For our use case we assume we always get the return value are AEE_SUCCESS and pointers passed in or allocated are valid
The parsing is done as follows.
   void Sample_vObjectParser_Usage1(IvObjectParser *pIvObjectParser)
   {
      IForceFeed    *pIForceFeed = NULL;
      AEEResult nResult = AEE_SUCCESS;
      char *pBufInitial = NULL, pBufFinal = NULL;
      int nBytesRead = 0, nNumObjects  = 0, nSizeReq = 0, nSize = 0;
      AEECLSID nObjectType = 0, nObjTypeTemp = 0;
      IvObject *pIvobjectParsed = NULL;

      nResult = IvObjectParser_QueryInterface(pIvObjectParser,
                                              AEEIID_IForceFeed,
                                              (void **)&pIForceFeed);

      // Read data from a vcalendar file into pBufInitial, update nBytesRead & then
      // use IFORCEFEED_Write to parse vCalendar buffer data
      nResult = IFORCEFEED_Write(pIForceFeed,
                                 pBufInitial,
                                 nBytesRead);

      nResult = IFORCEFEED_Write(pIForceFeed,NULL,0);

      nResult = IvObjectParser_GetNumberOfParsedObjects(pIvObjectParser,
                                                        &nNumObjects,
                                                        &nObjectType);
      // Upon reutrn nNumObjects holds 1 & nObjectType holds AEECLSID_vCalendar
      // since Only one clendar object buffer has given for parsing.

      if(1 != nNumObjects){
         // Do error hnadler
      }
      
      nResult = IvObjectParser_GetObjectAtIndex(pIvObjectParser,
                                                0,
                                                &pIvobjectParsed);
      
      nResult = IvObject_GetObjectType(pIvobjectParsed, &nObjTypeTemp);
      if(nObjectType != nObjTypeTemp){
         // Do error handler
      }

      nResult = IvObjectParser_GetBufferFromIvObject(pIvObjectParser,
                                                     (IvObject *)pIvobjectParsed,
                                                     NULL,
                                                     0,
                                                     &nSizeReq);
      if(0 == nSizeReq){
         // Do error handler
      }

      pBufFinal = (char*)IEnv_ErrMalloc(nSize);
      if(NULL == pBufFinal){
         // Do error handler
      }
      nSize = nSizeReq;
      nResult = IvObjectParser_GetBufferFromIvObject(pIvObjectParser,
                                                     pIvobjectParsed,
                                                     pBufFinal,
                                                     nSize,
                                                     &nSizeReq);
     IvObject_Release(pIvobjectParsed);
     IENV_FREEIF(pMe->pIEnv,pBufInitial);
     IENV_FREEIF(pMe->pIEnv,pBufFinal);
   }
Usage

If we have a simple buffer as follows in vCalendar file,
      BEGIN:VCALENDAR
      PRODID:-//Foo Bar//EN
      VERSION:2.0
      METHOD:PUBLISH
      BEGIN:VEVENT
      ORGANIZER:MAILTO:anyone@anywhere.com
      DTSTART:20071003T063000Z
      DTEND:20071003T070000Z
      SEQUENCE:0
      UID:040000008200E00074C5B7101A82E00800000000100C47396304C8010000000000000
       00010000000430E90713A99A345BD3C8FF5EBBFC655
      DTSTAMP:20071003T090837Z
  • Follow