/**
 * Copyright © 2019, Oracle and/or its affiliates. All rights reserved.
 *
 * Licensed under the Universal Permissive License v 1.0 as shown at
 * http://oss.oracle.com/licenses/upl
 *
 */
#ifndef VECTOR_OF_STRINGS_H
#define VECTOR_OF_STRINGS_H
#include <stddef.h>

struct vector_of_strings;

struct vector_of_strings *
mk_vector_of_strings(void);

struct vector_of_strings *
vector_of_strings_destroy(struct vector_of_strings *v);

char*
vector_of_strings_pop(struct vector_of_strings *v);

void
vector_of_strings_push(struct vector_of_strings *v, const char *string);

size_t
vector_of_strings_size(const struct vector_of_strings *v);

char const *
vector_of_strings_fetch(const struct vector_of_strings *v, size_t i);

int
vector_of_strings_any(const struct vector_of_strings *v,
                      int (*predicate)(const char *string, void *extra),
                      void *extra);
// Effect: If any string s in v returns predicate(s, extra)!=0 return
// one of those nonzero values.  If all return zero, return 0.  May
// call predicate zero or more times on every item in v.

#endif
