Skip to content

Add docs for VecVec* operator[] #350

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Apr 22, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions packages/dartcv/analysis_options.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ analyzer:
non_constant_identifier_names: ignore
parameter_assignments: error
formatter:
pagewidth: 110
page_width: 110

linter:
rules:
Expand Down Expand Up @@ -217,7 +217,6 @@ linter:
- unnecessary_this
- unnecessary_to_list_in_spreads
- unrelated_type_equality_checks
- unsafe_html
- use_build_context_synchronously
- use_colored_box
- use_decorated_box
Expand Down
4 changes: 4 additions & 0 deletions packages/dartcv/lib/src/core/dmatch.dart
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,10 @@ class VecVecDMatch extends VecUnmodifible<cvg.VecVecDMatch, VecDMatch> {
@override
ffi.Pointer<ffi.Void> asVoid() => ref.ptr.cast<ffi.Void>();

/// Returns a **reference**
///
/// Note: the memory of returned [VecDMatch] is owned by this [VecVecDMatch],
/// explicitly call [VecDMatch.clone] if the parent [VecVecDMatch] may be disposed.
@override
VecDMatch operator [](int idx) =>
VecDMatch.fromPointer(ccore.std_VecVecDMatch_get_p(ptr, idx), attach: false);
Expand Down
12 changes: 12 additions & 0 deletions packages/dartcv/lib/src/core/point.dart
Original file line number Diff line number Diff line change
Expand Up @@ -635,6 +635,10 @@ class VecVecPoint extends VecUnmodifible<cvg.VecVecPoint, VecPoint> {
@override
ffi.Pointer<ffi.Void> asVoid() => ref.ptr.cast<ffi.Void>();

/// Returns a **reference**
///
/// Note: the memory of returned [VecPoint] is owned by this [VecVecPoint],
/// explicitly call [VecPoint.clone] if the parent [VecVecPoint] may be disposed.
@override
VecPoint operator [](int idx) => VecPoint.fromPointer(ccore.std_VecVecPoint_get_p(ptr, idx), attach: false);

Expand Down Expand Up @@ -711,6 +715,10 @@ class VecVecPoint2f extends VecUnmodifible<cvg.VecVecPoint2f, VecPoint2f> {
@override
ffi.Pointer<ffi.Void> asVoid() => ref.ptr.cast<ffi.Void>();

/// Returns a **reference**
///
/// Note: the memory of returned [VecPoint2f] is owned by this [VecVecPoint2f],
/// explicitly call [VecPoint2f.clone] if the parent [VecVecPoint2f] may be disposed.
@override
VecPoint2f operator [](int idx) =>
VecPoint2f.fromPointer(ccore.std_VecVecPoint2f_get_p(ptr, idx), attach: false);
Expand Down Expand Up @@ -789,6 +797,10 @@ class VecVecPoint3f extends VecUnmodifible<cvg.VecVecPoint3f, VecPoint3f> {
@override
ffi.Pointer<ffi.Void> asVoid() => ref.ptr.cast<ffi.Void>();

/// Returns a **reference**
///
/// Note: the memory of returned [VecPoint3f] is owned by this [VecVecPoint3f],
/// explicitly call [VecPoint3f.clone] if the parent [VecVecPoint3f] may be disposed.
@override
VecPoint3f operator [](int idx) =>
VecPoint3f.fromPointer(ccore.std_VecVecPoint3f_get_p(ptr, idx), attach: false);
Expand Down
4 changes: 4 additions & 0 deletions packages/dartcv/lib/src/core/vec.dart
Original file line number Diff line number Diff line change
Expand Up @@ -349,6 +349,10 @@ class VecVecChar extends VecUnmodifible<cvg.VecVecChar, VecChar> {
@override
ffi.Pointer<ffi.Void> asVoid() => throw UnsupportedError('Not supported');

/// Returns a **reference**
///
/// Note: the memory of returned [VecChar] is owned by this [VecVecChar],
/// explicitly call [VecChar.clone] if the parent [VecVecChar] may be disposed.
@override
VecChar operator [](int idx) => VecChar.fromPointer(ccore.std_VecVecChar_get(ptr, idx), attach: false);

Expand Down
Loading