1 /** @file stringop.h 2 ** @brief String operations 3 ** @author Andrea Vedaldi 4 **/ 5 6 /* 7 Copyright (C) 2007-12 Andrea Vedaldi and Brian Fulkerson. 8 All rights reserved. 9 10 This file is part of the VLFeat library and is made available under 11 the terms of the BSD license (see the COPYING file). 12 */ 13 14 #ifndef VL_STRINGOP_H 15 #define VL_STRINGOP_H 16 17 #include "generic.h" 18 19 /** @brief File protocols */ 20 enum { 21 VL_PROT_UNKNOWN = -1, /**< unknown protocol */ 22 VL_PROT_NONE = 0, /**< no protocol */ 23 VL_PROT_ASCII, /**< ASCII protocol */ 24 VL_PROT_BINARY /**< Binary protocol */ 25 } ; 26 27 28 VL_EXPORT vl_size vl_string_copy (char *destination, vl_size destinationSize, char const *source) ; 29 VL_EXPORT vl_size vl_string_copy_sub (char *destination, vl_size destinationSize, 30 char const *beginning, char const *end) ; 31 VL_EXPORT char *vl_string_parse_protocol (char const *string, int *protocol) ; 32 VL_EXPORT char const *vl_string_protocol_name (int prot) ; 33 VL_EXPORT vl_size vl_string_basename (char *destination, vl_size destinationSize, 34 char const *source, vl_size maxNumStrippedExtension) ; 35 VL_EXPORT vl_size vl_string_replace_wildcard (char * destination, vl_size destinationSize, 36 char const *src, char wildcardChar, char escapeChar, 37 char const *replacement) ; 38 VL_EXPORT char *vl_string_find_char_rev (char const *beginning, char const *end, char c) ; 39 VL_EXPORT vl_size vl_string_length (char const *string) ; 40 VL_EXPORT int vl_string_casei_cmp (const char *string1, const char *string2) ; 41 42 /** @name String enumerations 43 ** @{ */ 44 45 /** @brief Member of an enumeration */ 46 typedef struct _VlEnumerator 47 { 48 char const *name ; /**< enumeration member name. */ 49 vl_index value ; /**< enumeration member value. */ 50 } VlEnumerator ; 51 52 VL_EXPORT VlEnumerator *vl_enumeration_get (VlEnumerator const *enumeration, char const *name) ; 53 VL_EXPORT VlEnumerator *vl_enumeration_get_casei (VlEnumerator const *enumeration, char const *name) ; 54 VL_EXPORT VlEnumerator *vl_enumeration_get_by_value (VlEnumerator const *enumeration, vl_index value) ; 55 /** @} */ 56 57 /* VL_STRINGOP_H */ 58 #endif 59