GeezerVison is showing github.com — libfoundation: Add span overloads for array accessors · livecode/livecode@ae2cb83
This repository was archived by the owner on Aug 31, 2021. It is now read-only.
File treeExpand file treeCollapse file tree Open diff view settings Expand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboardExpand all lines: libfoundation/include/foundation-span.h +17Lines changed: 17 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -216,6 +216,23 @@ inline void MCMemoryClearSecure(MCSpan<ElementType> x_span) | 216 | 216 | x_span.sizeBytes()); | 217 | 217 | } | 218 | 218 |
| | 219 | +MC_DLLEXPORT | | 220 | +bool MCArrayStoreValueOnPath(MCArrayRef array, | | 221 | + bool case_sensitive, | | 222 | + MCSpan<MCNameRef> path, | | 223 | + MCValueRef value); | | 224 | + | | 225 | +MC_DLLEXPORT | | 226 | +bool MCArrayFetchValueOnPath(MCArrayRef array, | | 227 | + bool case_sensitive, | | 228 | + MCSpan<MCNameRef> path, | | 229 | + MCValueRef& r_value); | | 230 | + | | 231 | +MC_DLLEXPORT | | 232 | +bool MCArrayRemoveValueOnPath(MCArrayRef array, | | 233 | + bool case_sensitive, | | 234 | + MCSpan<MCNameRef> path); | | 235 | + | 219 | 236 | MC_DLLEXPORT | 220 | 237 | hash_t MCHashBytes(MCSpan<const byte_t> bytes); | 221 | 238 |
| |
Collapse file Copy file name to clipboardExpand all lines: libfoundation/src/foundation-array.cpp +28Lines changed: 28 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -433,6 +433,16 @@ bool MCArrayFetchValueOnPath(MCArrayRef self, bool p_case_sensitive, const MCNam | 433 | 433 | return MCArrayFetchValueOnPath((MCArrayRef)t_value, p_case_sensitive, p_path + 1, p_path_length - 1, r_value); | 434 | 434 | } | 435 | 435 |
| | 436 | +bool MCArrayFetchValueOnPath(MCArrayRef array, | | 437 | + bool case_sensitive, | | 438 | + const MCSpan<MCNameRef> path, | | 439 | + MCValueRef& value) | | 440 | +{ | | 441 | + return MCArrayFetchValueOnPath(array, case_sensitive, | | 442 | + path.data(), path.size(), | | 443 | + value); | | 444 | +} | | 445 | + | 436 | 446 | ////////////////////// | 437 | 447 |
| 438 | 448 | MC_DLLEXPORT_DEF | @@ -537,6 +547,16 @@ bool MCArrayStoreValueOnPath(MCArrayRef self, bool p_case_sensitive, const MCNam | 537 | 547 | return true; | 538 | 548 | } | 539 | 549 |
| | 550 | +bool MCArrayStoreValueOnPath(MCArrayRef array, | | 551 | + bool case_sensitive, | | 552 | + const MCSpan<MCNameRef> path, | | 553 | + MCValueRef value) | | 554 | +{ | | 555 | + return MCArrayStoreValueOnPath(array, case_sensitive, | | 556 | + path.data(), path.size(), | | 557 | + value); | | 558 | +} | | 559 | + | 540 | 560 | ////////////////////// | 541 | 561 |
| 542 | 562 | MC_DLLEXPORT_DEF | @@ -605,6 +625,14 @@ bool MCArrayRemoveValueOnPath(MCArrayRef self, bool p_case_sensitive, const MCNa | 605 | 625 | return true; | 606 | 626 | } | 607 | 627 |
| | 628 | +bool MCArrayRemoveValueOnPath(MCArrayRef array, | | 629 | + bool case_sensitive, | | 630 | + MCSpan<MCNameRef> path) | | 631 | +{ | | 632 | + return MCArrayRemoveValueOnPath(array, case_sensitive, | | 633 | + path.data(), path.size()); | | 634 | +} | | 635 | + | 608 | 636 | //////////////////////////////////////////////////////////////////////////////// | 609 | 637 |
| 610 | 638 | MC_DLLEXPORT_DEF | |
|