> home > Custom Layer Boundary API

buffer_find_all_matches

September 8th 2024
Find all matches for a search pattern in a buffer

Signature

C++
String_Match_List
buffer_find_all_matches(Application_Links* app,
                        Arena* arena,
                        Buffer_ID buffer,
                        i32 string_id,
                        Range_i64 range,
                        String_Const_u8 needle,
                        Character_Predicate* predicate,
                        Scan_Direction direction);

Parameters

app

the standard custom layer context pointer

arena

the arena on which the returned string will be allocated

buffer

the id of the buffer to search

string_id

the id to store into the resulting string matches

range

the range in byte positions where all matches must be contained

needle

the string to search for in the buffer range

predicate

a character predicate used to check the left and right side of the match to add left sloppy and right sloppy match flags.

direction

the direction of the scan through the buffer range determining the order of the generated matches

Return

a linked list of matches to the search pattern