1 #ifndef VCTRS_NAMES_H 2 #define VCTRS_NAMES_H 3 4 enum name_repair_type { 5 name_repair_none = 0, 6 name_repair_minimal, 7 name_repair_unique, 8 name_repair_universal, 9 name_repair_check_unique, 10 name_repair_custom = 99 11 }; 12 13 struct name_repair_opts { 14 enum name_repair_type type; 15 struct vctrs_arg* arg; 16 SEXP fn; 17 bool quiet; 18 }; 19 20 extern struct name_repair_opts unique_repair_default_opts; 21 extern struct name_repair_opts unique_repair_silent_opts; 22 23 static struct name_repair_opts const * const p_unique_repair_default_opts = &unique_repair_default_opts; 24 static struct name_repair_opts const * const p_unique_repair_silent_opts = &unique_repair_silent_opts; 25 26 #define PROTECT_NAME_REPAIR_OPTS(opts) PROTECT((opts)->fn) 27 28 SEXP vec_as_names(SEXP names, const struct name_repair_opts* opts); 29 struct name_repair_opts new_name_repair_opts(SEXP name_repair, struct vctrs_arg* arg, bool quiet); 30 const char* name_repair_arg_as_c_string(enum name_repair_type type); 31 bool is_unique_names(SEXP names); 32 SEXP vec_as_unique_names(SEXP names, bool quiet); 33 34 SEXP r_seq_chr(const char* prefix, R_len_t n); 35 SEXP r_chr_paste_prefix(SEXP names, const char* prefix, const char* sep); 36 37 #include "owned.h" 38 SEXP vec_proxy_set_names(SEXP x, SEXP names, const enum vctrs_owned owned); 39 40 41 #endif 42