×

Discussion Board

Results 1 to 2 of 2
  1. #1
    Registered User
    Join Date
    Oct 2005
    Posts
    7

    Behavior of TBuf Match() Function ?

    Hello,

    when I call the TBuf Match() function subsequently, it always seems to match
    from file beginning. How to continue matching from the position where the last
    match has been ?

    I want to search for filenames in following XML Structure:

    <photolist>
    <photo>
    <name>filename</name>
    ....
    </photo>
    <photo>....</photo>
    ....
    </photolist>
    I match for: <photo>, <name> then I read the filename, then match
    for </name> and for </photo>
    Then I want to continue matching in the next <photo> area. But the match
    function restarts at file beginning and the first <photo> tag is matched again.
    How to make Match() continue AFTER the first match position ?

    I have read that Find() always restarts at file beginning, but there is nothing
    said about the behavior of Match

  2. #2
    Registered User
    Join Date
    Mar 2003
    Posts
    12

    Re: Behavior of TBuf Match() Function ?

    Hi,
    Yes, it wasn't mentioned explictly that the Match function always starts from the beginning of the buffer. I guess, it may be implied.

    I have a very basic solution for your problem. Here is whats on my mind !!!

    When you perform the first search in the TBuf with the Match() function, it returns the offset in the buffer where the match is successful. Use this value to set the buffer's current reference pointer and perform the next search. Logically, the next Match call should start from the current reference pointer of the buffer. Try it !!!

    <code>
    TInt currPtr
    for loop
    {
    currPtr = myBuf->Match(KPhotoTag);
    myBuf->Des()->Set(currPtr);
    : // Get the data between the <Photo> tags
    :
    currPtr = myBuf->Match(KNameTag);
    myBuf->Des()->Set(currPtr);
    }
    </code>

    Hope this helps.

    Best regards,

    /* Bobby */

Similar Threads

  1. error LNK2019: unresolved external symbol ???
    By wgarnett in forum Symbian
    Replies: 3
    Last Post: 2009-09-28, 06:53
  2. ShortMsgReceived - Delphi
    By qb_soft in forum PC Suite API and PC Connectivity SDK
    Replies: 9
    Last Post: 2008-06-22, 10:30
  3. Tbuf Usage: Inside Headerfile Class
    By Alicia_S60 in forum Symbian
    Replies: 2
    Last Post: 2004-12-01, 04:19
  4. Cannot compile SDK's examples for 7650 platform...
    By midletsoft in forum Symbian Tools & SDKs
    Replies: 2
    Last Post: 2003-08-12, 19:11
  5. Problem with Nokia D211 Linux Drivers
    By fiveam in forum Multimodecards
    Replies: 1
    Last Post: 1970-01-01, 02:00

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×