Skip to content

Latest commit

 

History

History
917 lines (323 loc) · 15.5 KB

README.md

File metadata and controls

917 lines (323 loc) · 15.5 KB

Collections

CMake is missing a lot of helper functions when it comes to collections. However using the list function that CMake provides it is possible to add alot of functions that help the developer.

Function List

Function Descriptions

encoded_list

encoded_list_append

encoded_list_decode

encoded_list_get

encoded_list_peek_back

encoded_list_peek_front

encoded_list_pop_back

encoded_list_pop_front

encoded_list_remove_at

encoded_list_remove_item

encoded_list_set

encoded_list_to_cmake_string

is_encoded_list

index_range

linked_list_insert_after

linked_list_insert_before

linked_list_new

linked_list_node_new

linked_list_peek_back

linked_list_peek_front

linked_list_pop_back

linked_list_pop_front

linked_list_push_back

linked_list_push_front

linked_list_remove

linked_list_replace

list_after

list_all

list_any

list_at

list_before

list_check_items

list_combinations

list_contains

list_contains_any

list_count

list_equal

comapres two lists with each other usage list_equal( 1 2 3 4 1 2 3 4) list_equal( listA listB) list_equal( ${listA} ${listB}) ... COMPARATOR defaults to STREQUAL COMPARATOR can also be a lambda expression COMPARATOR can also be EQUAL

list_erase

removes the specified range from lst the start_index is inclusive and end_index is exclusive

list_erase_slice

removes the specified range from lst and returns the removed elements

list_except

return those elemnents of minuend that are not in subtrahend

list_extract

extracts elements from the list example set(lst 1 2 ) list_extract(lst a b c) a contains 1 b contains 2 c contains nothing returns the rest of list

list_extract_any_flag

extracts all of the specified flags and returns true if any of them were found

list_extract_any_labelled_value

list_extract_flag

extracts a single flag from a list returning true if it was found false otherwise. if flag exists multiple time online the first instance of the flag is removed from the list

list_extract_flags

extracts all flags specified and returns a map with the key being the flag name if it was found and the value being set to tru e.g. list_extract_flags([a,b,c,d] a c e) -> {a:true,c:true}, [b,d]

list_extract_flag_name

list_extract_labelled_keyvalue

list_extract_labelled_value

searchs for label in lst. if label is found the label and its following value is removed and returned if label is found but no value follows ${ARGN} is returned if following value is enclosed in [] the brackets are removed this allows mulitple values to be returned ie list_extract_labelled_value(lstA --test1) if lstA is a;b;c;--test1;[1;3;4];d the function returns 1;3;4

list_extract_matches

list_find

searchs lst for value and returns the first idx found returns -1 if value is not found

list_find_any

list_find_flags

list_fold

folds the specified list into a single result by recursively applying the aggregator

list_get

list_get_labelled_value

list_get_lean

list_intersect

returns a list containing all elemmtns contained in all passed list references

list_intersect_args

returns only those flags which are contained in list and in the varargs ie list = [--a --b --c --d] list_intersect_args(list --c --d --e) -> [--c --d]

list_isempty

checks if the given list reference is an empty list

list_isinorder

returns true if value ${a} comes before value ${b} in list __list_isinorder_lst sets ${result} to true or false

list_iterator

list_iterator_break

list_iterator_next

list_length

list_max

list_modify

list_normalize_index

returns the normalized index. negative indices are transformed to i => length - i if the index is out of range after transformation -1 is returned and a warnign is issued note: index evaluating to length are valid (one behind last)

list_parse_descriptor

returns true if value could be parsed

list_peek_back

list_peek_front

gets the first element of the list without modififying it

list_pop_back

removes the last element from list and returns it

list_pop_front

removes the first value of the list and returns it

list_push_back

adds a value to the end of the list

list_push_front

adds a value at the beginning of the list

list_regex_match

list_regex_match_ignore

list_remove

removes all items specified in varargs from list returns the number of items removed

list_remove_at

removes all items at all specified indices from list

list_remove_duplicates

list_replace_at

replaces lists value at i with new_value

list_replace_slice

list_reverse

list_select

uses the selector on each element of the list

list_select_property

list_set_at

sets the lists value at index to the specified value the index is normalized -> negativ indices count down from back of list

list_slice

retruns a portion of the list specified. negative indices count from back of list

list_sort

orders a list by a comparator function

list_split

list_split_at

list_swap

swaps the element of lst at i with element at index j

list_to_map

list_to_string

Converts a CMake list to a string containing elements separated by spaces

list_union

returns a list containing the unqiue set of all elements contained in passed list referencese

list_unique

takes the passed list and returns only its unique elements see cmake's list(REMOVE_DUPLICATES)

list_where

executes a predicate on every item of the list (passed by reference) and returns those items for which the predicate holds

list_without_range

removes the specifed range from the list and returns remaining elements

is_range

list_range_get

list_range_indices

list_range_partial_write

list_range_remove

list_range_replace

list_range_set

list_range_try_get

range_from_indices

range_indices

range_indices_valid

range_instanciate

range_parse

range_partial_unpack

range_simplify

set_difference

set_isequal

retruns true iff lhs and rhs are the same set (ignoring duplicates) the null set is only equal to the null set the order of the set (as implied in being a set) does not matter

set_issubset

returns true iff lhs is subset of rhs duplicate elements in lhs and rhs are ignored the null set is subset of every set including itself no other set is subset of the null set if rhs contains all elements of lhs then lhs is the subset of rhs

structured_list_parse

parses a structured list given the structure map returning a map which contains all the parsed values

list_structure_print_help