Closed Bug 282777 Opened 20 years ago Closed 19 years ago

Implement index() xpath function

Categories

(Core Graveyard :: XForms, defect)

x86
All
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: aaronr, Assigned: aaronr)

References

Details

Attachments

(1 file, 1 obsolete file)

Now that setIndex patch is in, I can implement index() xpath function.
Attached patch first attempt (obsolete) — Splinter Review
Attachment #174741 - Flags: review?(bugmail)
Blocks: 281987
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 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.
Attached patch final patchSplinter Review
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
checked in.
Status: ASSIGNED → NEW
really marking fixed.
Status: NEW → RESOLVED
Closed: 19 years ago
Resolution: --- → FIXED
Product: Core → Core Graveyard
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: