VCard import

VCard import

Postby Otto » Tue Apr 30, 2013 7:28 am

Hello,
does someone have code for VCard import into dbf file.
http://en.wikipedia.org/wiki/VCard
Thanks in advance
Otto
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
User avatar
Otto
 
Posts: 6346
Joined: Fri Oct 07, 2005 7:07 pm

Re: VCard import

Postby Antonio Linares » Tue Apr 30, 2013 9:27 am

Otto,

What vcard format are you using ? (from the ones explained in the wikipedia)
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42125
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: VCard import

Postby Otto » Tue Apr 30, 2013 12:00 pm

Hello Antonio,
I think VERSION 2.1 is mostly used at the moment.
Best regards,
Otto
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
User avatar
Otto
 
Posts: 6346
Joined: Fri Oct 07, 2005 7:07 pm

Re: VCard import

Postby nageswaragunupudi » Tue Apr 30, 2013 2:51 pm

Here is a simple function that parses VCard text Version 2.1 and returns an array containing 6 elements:
1. Title. 2. WorkPhone, 3. HomePhone, 4. WorkAddr, 5. HomeAddr and 6. Email.
Contents of the array can be stored in dbf or as other form of data.
Code: Select all  Expand view  RUN
function ParseVCard( cText )

   local nVer     := 0
   local aRet     := {}

   cText    := StrBetween( cText, "BEGIN:VCARD", "END:VCARD" )
   cText    := StrTran( cText, Chr(10), Chr(13 ) )
   if Empty( cText )
      MsgInfo( "Not valid VCard Info" )
   else
      nVer     := Val( StrBetween( cText, "VERSION:", Chr(13) ) )
      if nVer == 2.1
         AAdd( aRet, TagInfo( cText, "TITLE:" ) )
         AAdd( aRet, TagInfo( cText, "TEL;WORK;VOICE:" ) )
         AAdd( aRet, TagInfo( cText, "TEL;HOME;VOICE:" ) )
         AAdd( aRet, TagInfo( cText, "ADR;WORK:;;" ) )
         AAdd( aRet, TagInfo( cText, "ADR;HOME:;;" ) )
         AAdd( aRet, TagInfo( cText, "EMAIL;PREF;INTERNET:" ) )
      else
         if nVer > 0
            MsgInfo( "Version " + LTrim( Str( nVer ) ) + " not implemented" )
         endif
      endif
   endif

return aRet

//----------------------------------------------------------------------------//

tatic function TagInfo( cStr, cTag )
return StrBetween( cStr, cTag, Chr( 13 ) )

//----------------------------------------------------------------------------//

static function StrBetween( cStr, cAfter, cBefore )
return BeforAtNum( cBefore, AfterAtNum( cAfter, cStr, 1 ), 1 )

//----------------------------------------------------------------------------//
 

This function can be extended to all versions of VCard and more checks and for fields can be incorporated.
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10660
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: VCard import

Postby James Bott » Tue Apr 30, 2013 10:16 pm

Here is Rao's ccode converted to a class. I added a few more items. Using a class allows you to pass the entire oVcard object around to other routines.

In doing the conversion I did discover one big problem. There can be multiple email addresses all with the same tag. The preferred email address has this tag:

EMAIL;PREF;INTERNET:

However this can be followed by multiple email addresses all with this tag:

"EMAIL:INTERNET:"

Since Rao's code depends on there being a unique tag for each item, it won't work for these items--it will always return the first item. I am afraid that the only solution is to rewrite the entire code to read and parse each line sequentially. Maybe someone else has a better idea?

Regards,
James

Code: Select all  Expand view  RUN
// Purpose: VCard class
// Date: 4/30/2013

#include "fivewin.ch"

function main()
   local cVcard, aVcard, oVcard, cFile

   cFile:= "James Bott.vcf"

   oVcard:= TVcard():new( cFile )

   msgInfo( oVcard:cName )
   
   msgInfo( oVcard:cCompany )

return nil


//---------------------------------------------------------------------------//

class Tvcard
   data cName
   data cTitle
   data cCompany
   data cWorkPhone
   data cWorkFax
   data cHomePhone
   data cWorkAddress
   data cHomeAddress
   data cEmail
   data cEmail2

   Exported:
   method new( cVcard )
   method end() VIRTUAL
   
   Hidden:
   method tagInfo()
   method StrBetween()
endclass

//---------------------------------------------------------------------------//

method new( cVcard ) class TVCARD

   local nVer     := 0
   local aRet     := {}
   local cText    := memoRead( cVcard )

   cText    := ::StrBetween( cText, "BEGIN:VCARD", "END:VCARD" )
   cText    := StrTran( cText, Chr(10), Chr(13 ) )
   if Empty( cText )
      MsgInfo( "Not valid VCard Info" )
   else
      nVer     := Val( ::StrBetween( cText, "VERSION:", Chr(13) ) )
      if nVer == 2.1
         ::cName:= ::TagInfo( cText, "FN:" )
         ::cTitle:= ::TagInfo( cText, "TITLE:" )
         ::cCompany:= ::TagInfo( cText, "ORG:" )
         ::cWorkPhone:= ::TagInfo( cText, "TEL;WORK;VOICE:" )
         ::cWorkFax:= ::TagInfo( cText, "TEL:WORK:FAX:" )
         ::cHomePhone:= ::TagInfo( cText, "TEL;HOME;VOICE:" )
         ::cWorkAddress:= ::TagInfo( cText, "ADR;WORK:;;" )
         ::cHomeAddress:= ::TagInfo( cText, "ADR;HOME:;;" )
         ::cEmail:=  ::TagInfo( cText, "EMAIL;PREF;INTERNET:" )
         ::cEmail2:= ::TagInfo( cText, "EMAIL:INTERNET:" )
      else
         if nVer > 0
            MsgInfo( "VCard Version " + LTrim( Str( nVer ) ) + " not implemented" )
         endif
      endif
   endif

return self

//---------------------------------------------------------------------------//

method tagInfo( cStr, cTag ) Class TVCARD
return ::StrBetween( cStr, cTag, Chr( 13 ) )

//----------------------------------------------------------------------------//

method StrBetween( cStr, cAfter, cBefore ) Class TVCARD
return BeforAtNum( cBefore, AfterAtNum( cAfter, cStr, 1 ), 1 )

//----------------------------------------------------------------------------//

// end of file
 
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Re: VCard import

Postby Otto » Wed May 01, 2013 7:23 am

Hello James,

maybe we can use an array for the attributes.
To fill the array we could look for double dot “:” and then fill the array.

Best regards,
Otto

http://www.imc.org/pdi/pdiproddev.html
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
User avatar
Otto
 
Posts: 6346
Joined: Fri Oct 07, 2005 7:07 pm

Re: VCard import

Postby James Bott » Wed May 01, 2013 12:27 pm

Hi Otto,

maybe we can use an array for the attributes.


Sure.

The issue is that it needs to be completely written to read in every line of the vcard file. I will work on it as time permits.

Regards,
James
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Re: VCard import

Postby nageswaragunupudi » Thu May 02, 2013 12:29 pm

Sample VCard reader for vCard versions 2.1, 3.0 and 4.0.
This is under development and worked well with as many samples I could find. By testing with more samples we can improve this.
Code: Select all  Expand view  RUN
/*
*
*  vcard.prg
*  G.N.Rao
*  Apr 30-2013 06:27 PM
*
*/


#include "FiveWin.Ch"
#include "hbcompat.ch"
#include "ord.ch"
#include "xbrowse.ch"

//----------------------------------------------------------------------------//

REQUEST DBFCDX

//----------------------------------------------------------------------------//

function Main()

   local cCard, aInfo
   local oCard
   local cFile

   do while ! Empty( cFile := cGetFile( "VCard (*.vcf) |*.vcf|", "Select a VCard File", ;
                        nil, cFilePath( ExeName() ) ) )

      oCard    := TVCard():New( cFile )
      oCard:Display()
   enddo

return (0)

//----------------------------------------------------------------------------//

init procedure PrgInit

   SET DATE GERMAN
   SET CENTURY ON
   SET TIME FORMAT TO "HH:MM:SS"
   SET EPOCH TO YEAR(DATE())-50

   SET DELETED ON
   SET EXCLUSIVE OFF

   RDDSETDEFAULT( "DBFCDX" )

   XbrNumFormat( 'E', .t. )
   SetKinetic( .f. )
   SetGetColorFocus()

return

//----------------------------------------------------------------------------//

CLASS TVCard

   DATA nVersion  AS NUMERIC
   DATA lValid    AS LOGICAL
   //
   DATA cFile
   DATA cName, cNameFmt, cAdrHome, cAdrWork, cAdrHomeFmt, cAdrWorkFmt, ;
      cTitle, cKind, cGender, cOrg, cRole, cNickName, cNote, ;
      cPhoneHome, cPhoneWork, cFaxHome, cFaxWork, cPhoneCell, ;
      cEmail, cPhotoRef, cPhotoBuf ;
      AS CHARACTER
   DATA dDOB AS DATE INIT CTOD( '' )
   //
   //
   METHOD New( cFile ) CONSTRUCTOR
   METHOD ReadFile( cFile )   INLINE ::ReadCardText( MemoRead( cFile ) )
   METHOD ReadCardText( cText )
   METHOD Display()
   //
   METHOD SaveToDBF() VIRTUAL
   METHOD ReadFromDBF() VIRTUAL
   METHOD SaveAsText() VIRTUAL
   METHOD RestoreFromText( cText ) VIRTUAL
   METHOD WriteVCard() VIRTUAL

ENDCLASS

//----------------------------------------------------------------------------//

METHOD New( cFile ) CLASS TVCard

   if ! Empty( cFile )
      if Len( cFile ) < 256 .and. Lower( cFileExt( cFile ) ) == "vcf"
         ::cFile     := cFileNoPath( cFile )
         ::ReadFile( cFile )
      else
         ::ReadCardText( cFile )
      endif
   endif

return Self

//----------------------------------------------------------------------------//

METHOD ReadCardText( cText ) CLASS TVCard

   local aLines, aLine
   local c, cVal, n, nAt
   local lAssigned, cAttr

   cText    := StrBetween( cText, "BEGIN:VCARD", "END:VCARD" )
   cText    := StrTran( cText, CRLF + ' ', '' )
   cText    := StrTran( cText, CRLF, Chr(10) )
   cText    := StrTran( cText, Chr(10) + ' ', '' )
   cText    := RemAll( cText, 10 )

   aLines        := HB_ATokens( cText, Chr(10) )
   for n := 1 to Len( aLines )
      c     := aLines[ n ]
      aLines[ n ] := { Upper( BeforAtNum( ':', c, 1 ) ), AfterAtNum( ':', c, 1 ), "" }
      if aLines[ n, 1 ] = "PHOTO" .and. ;
         "ENCODING" $ aLines[ n, 1 ] .and. ;
         "BASE64"   $ aLines[ n, 1 ]

         aLines[ n, 2 ] := DecodeBase64( aLines[ n, 2 ] )
      endif
   next n
   if aLines[ 1, 1 ] = "VERSION"
      ::nVersion  := Val( aLines[ 1, 2 ] )
   endif
   if ::nVersion == 2.1 .or. ::nVersion == 3 .or. ::nVersion == 4
      ::lValid    := .t.
   endif
   if ! ::lValid
      return Self
   endif
   ADel( aLines, 1, .t. )

   for n := 1 to Len( aLines )
      if !( ';' $ aLines[ n, 1 ] )
         aLines[ n, 1 ] += ';'
      endif
      c     := aLines[ n, 1 ]
      if ( nAt := At( '.', c ) ) > 0 .and. nAt < At( ';', c )
         aLines[ n, 3 ] := Trim( BeforAtNum( c, '.', 1 ) )  // Group
         aLines[ n, 1 ] := LTrim( AfterAtNum( c, '.', 1 ) )
      endif
   next


   for each aLine in aLines
      c     := aLine[ 1 ]
      cVal  := aLine[ 2 ]

      lAssigned   := .f.
      for each cAttr in { "TITLE", "GENDER", "KIND", "ORG", "ROLE", "NICKNAME", "NOTE" }
         if c = cAttr + ';'
            OSend( Self, "_c" + cAttr, cVal )
            lAssigned := .t.
            exit
         endif
      next
      if lAssigned
         loop
      endif
      //
      do case
      case c = 'N;'  ; ::cName      := cVal
      case c = 'FN;' ; ::cNameFmt   := cVal
      case c = 'ADR;'
         if "WORK" $ c
            ::cAdrWork     := cVal
         endif
         if "HOME" $ c .or. !( "WORK" $ c )
            ::cAdrHome     := cVal
         endif
      case c = 'LABEL;'
         cVal  := StrTran( cVal, "=0A=0D", CRLF )
         cVal  := StrTran( cVal, "=0D=0A", CRLF )
         cVal  := StrTran( cVal, "=20", " " )
         cVal  := FW_ValToExp( cVal )
         if "WORK" $ c
            ::cAdrWorkFmt     := cVal
         endif
         if "HOME" $ c .or. !( "WORK" $ c )
            ::cAdrHomeFmt     := cVal
         endif
      case c = 'TEL;'
         if "CELL" $ c
            ::cPhoneCell   := cVal
         else
            if "WORK" $ c
               if "FAX" $ c
                  ::cFaxWork     := cVal
               else
                  ::cPhoneWork   := cVal
               endif
            endif
            if "HOME" $ c .or. !( "WORK" $ c )
               if "FAX" $ c
                  ::cFaxHome     := cVal
               else
                  ::cPhoneHome   := cVal
               endif
            endif
         endif
      case c = 'EMAIL;'
         ::cEmail    := cVal
      case c = 'PHOTO;'
         if IsBinaryData( cVal )
            ::cPhotoBuf    := cVal
         else
            ::cPhotoRef    := cVal
         endif
      case c = 'BDAY;'
         c     := cVal
         ::dDOB  := STOD( Left( StrTran( StrTran( c, '-', '' ), '/', '' ), 8 ) )
      endcase
   next

return Self

//----------------------------------------------------------------------------//

METHOD Display() CLASS TVCard

   local oDlg, oFont, oImage
   local nRow, cAdrHomeFmt := '', cAdrWorkFmt := ''

   DEFINE FONT oFont NAME "TAHOMA" SIZE 0,-14
   DEFINE DIALOG oDlg SIZE 800,500 PIXEL FONT oFont ;
      TITLE ::cFile + " (Version : " + LTrim( Str( ::nVersion ) ) + " )"

   if ! Empty( ::cAdrHomeFmt )
      cAdrHomeFmt    := &( ::cAdrHomeFmt )
   endif

   if ! Empty( ::cAdrWorkFmt )
      cAdrWorkFmt    := &( ::cAdrWorkFmt )
   endif**

   nRow  := 10
   @ nRow,10 SAY "NameFmt : " SIZE 50,10 PIXEL OF oDlg RIGHT
   @ nRow,61 SAY ::cNameFmt SIZE 200,10 PIXEL OF oDlg COLOR CLR_BLACK,CLR_WHITE BORDER
/*
   nRow  += 12
   @ nRow,10 SAY "Name : " SIZE 50,10 PIXEL OF oDlg RIGHT
   @ nRow,61 SAY ::cName SIZE 200,10 PIXEL OF oDlg COLOR CLR_BLACK,CLR_WHITE BORDER
*/

   nRow  += 12
   @ nRow,10 SAY "Gender : " SIZE 50,10 PIXEL OF oDlg RIGHT
   @ nRow,61 SAY ::cGender SIZE 200,10 PIXEL OF oDlg COLOR CLR_BLACK,CLR_WHITE BORDER
   nRow  += 12
   @ nRow,10 SAY "Title : " SIZE 50,10 PIXEL OF oDlg RIGHT
   @ nRow,61 SAY ::cTitle SIZE 200,10 PIXEL OF oDlg COLOR CLR_BLACK,CLR_WHITE BORDER
   nRow  += 12
   @ nRow,10 SAY "Role : " SIZE 50,10 PIXEL OF oDlg RIGHT
   @ nRow,61 SAY ::cRole SIZE 200,10 PIXEL OF oDlg COLOR CLR_BLACK,CLR_WHITE BORDER
   nRow  += 12
   @ nRow,10 SAY "Orgnisn : " SIZE 50,10 PIXEL OF oDlg RIGHT
   @ nRow,61 SAY ::cOrg SIZE 200,10 PIXEL OF oDlg COLOR CLR_BLACK,CLR_WHITE BORDER
   nRow  += 12
   @ nRow,10 SAY "DateOfBirth : " SIZE 50,10 PIXEL OF oDlg RIGHT
   @ nRow,61 SAY ::dDOB SIZE 200,10 PIXEL OF oDlg COLOR CLR_BLACK,CLR_WHITE BORDER
   nRow  += 12
   @ nRow,10 SAY "PHONES (Work) : " SIZE 50,10 PIXEL OF oDlg RIGHT
   @ nRow,61 SAY ::cPhoneWork SIZE 200,10 PIXEL OF oDlg COLOR CLR_BLACK,CLR_WHITE BORDER
   nRow  += 12
   @ nRow,10 SAY "(Home) : " SIZE 50,10 PIXEL OF oDlg RIGHT
   @ nRow,61 SAY ::cPhoneHome SIZE 200,10 PIXEL OF oDlg COLOR CLR_BLACK,CLR_WHITE BORDER
   nRow  += 12
   @ nRow,10 SAY "FAX (Work) : " SIZE 50,10 PIXEL OF oDlg RIGHT
   @ nRow,61 SAY ::cFaxWork SIZE 200,10 PIXEL OF oDlg COLOR CLR_BLACK,CLR_WHITE BORDER
   nRow  += 12
   @ nRow,10 SAY "(Home) : " SIZE 50,10 PIXEL OF oDlg RIGHT
   @ nRow,61 SAY ::cFaxHome SIZE 200,10 PIXEL OF oDlg COLOR CLR_BLACK,CLR_WHITE BORDER
   nRow  += 12
   @ nRow,10 SAY "CellPhone : " SIZE 50,10 PIXEL OF oDlg RIGHT
   @ nRow,61 SAY ::cPhoneCell SIZE 200,10 PIXEL OF oDlg COLOR CLR_BLACK,CLR_WHITE BORDER
   nRow  += 12
   @ nRow,10 SAY "Email : " SIZE 50,10 PIXEL OF oDlg RIGHT
   @ nRow,61 SAY ::cEmail SIZE 200,10 PIXEL OF oDlg COLOR CLR_BLACK,CLR_WHITE BORDER
/*
   nRow  += 12
   @ nRow,10 SAY "ADDR (Work) : " SIZE 50,10 PIXEL OF oDlg RIGHT
   @ nRow,61 SAY ::cAdrWork SIZE 200,10 PIXEL OF oDlg COLOR CLR_BLACK,CLR_WHITE BORDER
   nRow  += 12
   @ nRow,10 SAY "(Home) : " SIZE 50,10 PIXEL OF oDlg RIGHT
   @ nRow,61 SAY ::cAdrHome SIZE 200,10 PIXEL OF oDlg COLOR CLR_BLACK,CLR_WHITE BORDER
*/

   nRow  += 12
   @ nRow,10 SAY "MailWork : " SIZE 50,10 PIXEL OF oDlg RIGHT
   @ nRow,61 SAY cAdrWorkFmt SIZE 200,30 PIXEL OF oDlg COLOR CLR_BLACK,CLR_WHITE BORDER
   nRow  += 32
   @ nRow,10 SAY "MailHome : " SIZE 50,10 PIXEL OF oDlg RIGHT
   @ nRow,61 SAY cAdrHomeFmt SIZE 200,30 PIXEL OF oDlg COLOR CLR_BLACK,CLR_WHITE BORDER
   nRow  += 30

   if ! Empty( ::cPhotoBuf )
      @ 10,290 IMAGE oImage SIZE 100,100 PIXEL OF oDlg
      WITH OBJECT oImage
         :LoadFromMemory( ::cPhotoBuf )
         :Refresh()
      END
   elseif ! Empty( ::cPhotoRef )
      @ 10,290 SAY ::cPhotoRef SIZE 100,100 PIXEL OF oDlg COLOR CLR_HRED,CLR_WHITE BORDER
   endif

   @ nRow-14,350 BUTTON "Close" SIZE 40,14 PIXEL OF oDlg ACTION oDlg:End()

   ACTIVATE DIALOG oDlg CENTERED
   RELEASE FONT oFont

   // QuickDisplay
   XBrowse( Self )


return nil

//----------------------------------------------------------------------------//

//----------------------------------------------------------------------------//

static function StrBetween( cStr, cAfter, cBefore, nOccur )
return BeforAtNum( cBefore, AfterAtNum( cAfter, cStr, IfNil( nOccur, 1 ) ), 1 )

//----------------------------------------------------------------------------//

static function GetXmlTag( cText, cTag, nOccur )

   local cRet     := nil
   local c, n1, n2

   n1    := At( '<' + cTag + '>',  cText )
   n2    := At( '<' + cTag + '/>', cText  )
   if n2 > 0 .and. n2 < n1
      cRet     := ""
      cText    := SubStr( cText, n2 + Len( '<' + cTag + '/>' ) + 1 )
   elseif n1 > 0
      c        := SubStr( cText, n1 + Len( '<' + cTag + '>' ) + 1 )
      n2       := At( '</' + cTag + '>', c )
      if n2 > 0
         cRet  := Left( c, n2 - 1 )
         cText := SubStr( c, n2 + Len( '<' + cTag + '/>' ) + 1 )
      endif
   endif

return cRet  // nil -> tag not found, '' -> empty value

//----------------------------------------------------------------------------//

function DecodeBase64( cIn )

   local cOut  := ""

   do while ! Empty( cIn )
      cOut  += b64_sub( Left( cIn, 4 ) )
      cIn   := SubStr( cIn, 5 )
   enddo

return cOut

//----------------------------------------------------------------------------//

static function b64_sub( c4 )

   static cRef := "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"

   local a,b,c,d
   local x,y,z
   local cRet

   c4 := Left( c4 + "==", 4 )
   a  := At( SubStr( c4, 1, 1 ), cRef ) - 1
   b  := At( SubStr( c4, 2, 1 ), cRef ) - 1
   c  := At( SubStr( c4, 3, 1 ), cRef ) - 1
   d  := At( SubStr( c4, 4, 1 ), cRef ) - 1

   x  := a * 4
   x  += Int( b / 16 )
   if c == -1
      return Chr( x )
   endif
   b  := b % 16
   y  := b * 16
   y  += Int( c / 4 )
   if d == -1
      return Chr( x ) + Chr( y )
   endif
   c  := c % 4
   z  := c * 64
   z  += d

return Chr( x ) + Chr( y ) + Chr( z )

//----------------------------------------------------------------------------//
 

Here is a sample vcf file for testing:
Code: Select all  Expand view  RUN
BEGIN:VCARD
VERSION:2.1
N:Gump;Forrest
FN:Forrest Gump
ORG:Bubba Gump Shrimp Co.
TITLE:Shrimp Man
GENDER:M
PHOTO;TYPE=JPEG;ENCODING=BASE64:
 /9j/4AAQSkZJRgABAQAAAQABAAD/2wCEAAkGBhQSERQUExQUFRUVGBcYGRYXFRUVFxQXFRcX
 FxgYFBYXHCYeGBojGhQYHy8gJCcpLCwsFx4xNTAqNSYrLCkBCQoKDgwOGg8PGiwkHyQsLCwp
 KSosKSwsLCwsLCwsLCwsLCwsLCwsLCwsLCwsLCwsLCwsLCwsLCwsLCwsLCwsLP/AABEIAPcA
 zAMBIgACEQEDEQH/xAAcAAABBQEBAQAAAAAAAAAAAAAFAAIDBAYBBwj/xABAEAABAwIDBQYE
 BQ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LXxxC6kmJ
 eoCKO7cpzTlC4zU/KUkkFfKG/q+42iCK0g3GUjpv9yfVEcbh8zH04s4F7bCWkHxAcpcCLjWN
 Akkl0vIY3NKzL4KWXiNQNDfT6aovixLTGjRTaOmUuPuUkkbYoVRM5OXZQ2DTzvaeZPutXiaB
 0aYJi8Axe9uMaJJKuN/4BZ+wTW2icxA8QFjmmdY3W5eSaHSJaZbvad0pJI+GTd37i2oikk17
 FPIA63wm3SUS2dRkEHVvuEkk0+ExJctWX2sgc1UpjMT5H6FJJL5HQ3BWLa9PNTB3grMbc8T6
 Debj6R+6SSWyPwr6/qN4UviJ/T9AZUqZqz3cDHkLLT7K7GYnEUhVZ3bWu+EOJkjjbRJJZefI
 4K0bWnxxm+fY/9k=

TEL;WORK;VOICE:(111) 555-1212
TEL;HOME;VOICE:(404) 555-1212
ADR;WORK:;;100 Waters Edge;Baytown;LA;30314;United States of America
LABEL;WORK;ENCODING=QUOTED-PRINTABLE:100 Waters Edge=0D=0ABaytown, LA 30314=0D=0AUnited States of

America
ADR;HOME:;;42 Plantation St.;Baytown;LA;30314;United States of America
LABEL;HOME;ENCODING=QUOTED-PRINTABLE:42 Plantation St.=0D=0ABaytown, LA 30314=0D=0AUnited States of

America
BDAY;:1972-10-15
EMAIL;PREF;INTERNET:forrestgump@example.com
REV:20080424T195243Z
END:VCARD
 

Display screen shot by the program
Image
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10660
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: VCard import

Postby James Bott » Thu May 02, 2013 2:07 pm

Rao,

Wow, great work. I was working on expanding the class I started, but I see you beat me to it.

I do wonder why you use static functions instead of protected methods? I have found static functions to be a problem when trying to subclass in other FW classes.

Also, why the regular function instead of a protected method?

And, I haven't tested this yet, but it looks like your class cannot detect the preferred email address. Is this correct?

Again nice class.

James
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Re: VCard import

Postby nageswaragunupudi » Thu May 02, 2013 2:41 pm

I do wonder why you use static functions instead of protected methods? I have found static functions to be a problem when trying to subclass in other FW classes.

Also, why the regular function instead of a protected method?

You have raised very valid issues.

First, let me answer these points with reference to this Vcard class.
These functions/static functions are not part of the class. For my personal use they are separate library functions, to be used as library functions from any other applications. I included them here (with some changes in names and code) to make the sample complete. In some cases we can remove "static" restriction.

Now about FWH. I see there is a case to move some functions & static functions as methods (protected or public) so that derived classes can use them. We shall keep this in mind while making further revisions from now onwards.

And, I haven't tested this yet, but it looks like your class cannot detect the preferred email address. Is this correct?

You are right. This needs modification. You will be helping to improve the class by such suggestions and reporting bugs.
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10660
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: VCard import

Postby James Bott » Thu May 02, 2013 3:16 pm

Rao,

These functions/static functions are not part of the class. For my personal use they are separate library functions, to be used as library functions from any other applications. I included them here (with some changes in names and code) to make the sample complete. In some cases we can remove "static" restriction.


OK, I understand. However, for the rest of us they are part of the class, so it would be better if those static functions were defined as protected methods. Then the class is still fully encapsulated and we can also subclass and use those methods if needed. And, of course, they won't affect the use of your library with the same routines as functions.

Regards,
James
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Re: VCard import

Postby StefanHaupt » Wed Aug 07, 2013 10:49 am

Rao,

Code: Select all  Expand view  RUN
for each cAttr in { "TITLE", "GENDER", "KIND", "ORG", "ROLE", "NICKNAME", "NOTE" }
         if c = cAttr + ';'
            OSend( Self, "_c" + cAttr, cVal )  // ???
            lAssigned := .t.
            exit
         endif
next


could you please explain what OSend (..) does in this code snippet ? I didn´t find any docs about OSend ().

Thanks.
kind regards
Stefan
StefanHaupt
 
Posts: 824
Joined: Thu Oct 13, 2005 7:39 am
Location: Germany

Re: VCard import

Postby nageswaragunupudi » Wed Aug 07, 2013 12:14 pm

OSend(...) is an FW function.

OSend( oObj, cvar ) is equivalent to oObj:cvar

OSend( oObj, _cvar, uVal ) is equivalent to oObj:cvar := uVal
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10660
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: VCard import

Postby StefanHaupt » Thu Aug 08, 2013 9:01 am

OK, thanks
kind regards
Stefan
StefanHaupt
 
Posts: 824
Joined: Thu Oct 13, 2005 7:39 am
Location: Germany

Re: VCard import

Postby Frafive » Wed Oct 01, 2014 10:38 am

Hola


Para exportar a Vcard ? alguien tiene algo hecho.

Un saludo
Gabriel
Frafive
 
Posts: 189
Joined: Wed Apr 05, 2006 9:48 pm

Next

Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: nageswaragunupudi and 52 guests