Closed
      
        Bug 282777
      
      
        Opened 20 years ago
          Closed 20 years ago
      
        
    
  
Implement index() xpath function
Categories
(Core Graveyard :: XForms, defect)
Tracking
(Not tracked)
        RESOLVED
        FIXED
        
    
  
People
(Reporter: aaronr, Assigned: aaronr)
References
Details
Attachments
(1 file, 1 obsolete file)
| 
        
        
         7.48 KB,
          patch         
       | 
      Details | Diff | Splinter Review | 
Now that setIndex patch is in, I can implement index() xpath function.
        Attachment #174741 -
        Flags: review?(bugmail)
Comment on attachment 174741 [details] [diff] [review]
first attempt
>+NS_IMETHODIMP
>+nsXFormsUtilityService::GetRepeatIndex(nsIDOMNode *aRepeat, PRUint32 *aIndex)
>+{
>+  NS_ENSURE_ARG_POINTER(aRepeat);
>+  NS_ENSURE_ARG_POINTER(aIndex);
Nit: There should be no need to check that the 'returnpointer' (in this case
aIndex) is nonnull. If you really want to be sure add an assertion instead.
r=me except on the nsXFormsUtilityService.cpp part that I don't really know
enough xforms for.
        Attachment #174741 -
        Flags: review?(bugmail) → review+
Allan, can you give a second review, please?  I will fix Jonas' nit.
Status: NEW → ASSIGNED
          Comment 4•20 years ago
           
         | 
      ||
Comment on attachment 174741 [details] [diff] [review]
first attempt
I'll leave the transformiix-part in sicking's hands :)
>+nsXFormsUtilityService::GetRepeatIndex(nsIDOMNode *aRepeat, PRUint32 *aIndex)
>+{
>+  NS_ENSURE_ARG_POINTER(aRepeat);
>+  NS_ENSURE_ARG_POINTER(aIndex);
>+  *aIndex = 0;
>+
>+  nsCOMPtr<nsIXFormsRepeatElement> repeatEle = do_QueryInterface(aRepeat);
>+  NS_ENSURE_TRUE(repeatEle, NS_ERROR_NULL_POINTER);
>+
>+  return repeatEle->GetIndex(aIndex);
>+}
Almost the same comment from me. No need to check aRepeat either, as you check
it after the QI. aIndex will be checked by GetIndex(), and set if it returns
succesfully, so I guess you can just do:
>+nsXFormsUtilityService::GetRepeatIndex(nsIDOMNode *aRepeat, PRUint32 *aIndex)
>+{
>+  nsCOMPtr<nsIXFormsRepeatElement> repeatEle = do_QueryInterface(aRepeat);
>+  NS_ENSURE_STATE(repeatEle);
>+
>+  return repeatEle->GetIndex(aIndex);
>+}
With that, r=me.
patch that takes in comments from Allan and Jonas.  Peterv said that he didn't
need to sr as long as Jonas reviewed it.
        Attachment #174741 -
        Attachment is obsolete: true
          Comment 7•20 years ago
           
         | 
      ||
really marking fixed.
Status: NEW → RESOLVED
Closed: 20 years ago
Resolution: --- → FIXED
          Updated•9 years ago
           
         | 
      
Product: Core → Core Graveyard
          You need to log in
          before you can comment on or make changes to this bug.
        
Description
•