]> git.sesse.net Git - ffmpeg/blobdiff - libavutil/avstring.h
avopt: Check whether the object actually has got an AVClass
[ffmpeg] / libavutil / avstring.h
index 8d97e1f76809d6d1c77ce84b13ba91d5b4a96417..b7d10983c395cc433925e2f09ada3605c0c5d5a3 100644 (file)
 #include <stddef.h>
 #include "attributes.h"
 
+/**
+ * @addtogroup lavu_string
+ * @{
+ */
+
 /**
  * Return non-zero if pfx is a prefix of str. If it is, *ptr is set to
  * the address of the first character in str after the prefix.
@@ -61,6 +66,21 @@ int av_stristart(const char *str, const char *pfx, const char **ptr);
  */
 char *av_stristr(const char *haystack, const char *needle);
 
+/**
+ * Locate the first occurrence of the string needle in the string haystack
+ * where not more than hay_length characters are searched. A zero-length
+ * string needle is considered to match at the start of haystack.
+ *
+ * This function is a length-limited version of the standard strstr().
+ *
+ * @param haystack   string to search in
+ * @param needle     string to search for
+ * @param hay_length length of string to search in
+ * @return           pointer to the located match within haystack
+ *                   or a null pointer if no match
+ */
+char *av_strnstr(const char *haystack, const char *needle, size_t hay_length);
+
 /**
  * Copy the string src to dst, but no more than size - 1 bytes, and
  * null-terminate dst.
@@ -72,7 +92,7 @@ char *av_stristr(const char *haystack, const char *needle);
  * @param size size of destination buffer
  * @return the length of src
  *
- * WARNING: since the return value is the length of src, src absolutely
+ * @warning since the return value is the length of src, src absolutely
  * _must_ be a properly 0-terminated string, otherwise this will read beyond
  * the end of the buffer and possibly crash.
  */
@@ -90,9 +110,9 @@ size_t av_strlcpy(char *dst, const char *src, size_t size);
  * @param size size of destination buffer
  * @return the total length of src and dst
  *
- * WARNING: since the return value use the length of src and dst, these absolutely
- * _must_ be a properly 0-terminated strings, otherwise this will read beyond
- * the end of the buffer and possibly crash.
+ * @warning since the return value use the length of src and dst, these
+ * absolutely _must_ be a properly 0-terminated strings, otherwise this
+ * will read beyond the end of the buffer and possibly crash.
  */
 size_t av_strlcat(char *dst, const char *src, size_t size);
 
@@ -132,7 +152,22 @@ char *av_d2str(double d);
 char *av_get_token(const char **buf, const char *term);
 
 /**
- * Locale independent conversion of ASCII characters to upper case.
+ * Locale-independent conversion of ASCII isdigit.
+ */
+int av_isdigit(int c);
+
+/**
+ * Locale-independent conversion of ASCII isgraph.
+ */
+int av_isgraph(int c);
+
+/**
+ * Locale-independent conversion of ASCII isspace.
+ */
+int av_isspace(int c);
+
+/**
+ * Locale-independent conversion of ASCII characters to uppercase.
  */
 static inline int av_toupper(int c)
 {
@@ -142,7 +177,7 @@ static inline int av_toupper(int c)
 }
 
 /**
- * Locale independent conversion of ASCII characters to lower case.
+ * Locale-independent conversion of ASCII characters to lowercase.
  */
 static inline int av_tolower(int c)
 {
@@ -151,4 +186,41 @@ static inline int av_tolower(int c)
     return c;
 }
 
+/**
+ * Locale-independent conversion of ASCII isxdigit.
+ */
+int av_isxdigit(int c);
+
+/*
+ * Locale-independent case-insensitive compare.
+ * @note This means only ASCII-range characters are case-insensitive
+ */
+int av_strcasecmp(const char *a, const char *b);
+
+/**
+ * Locale-independent case-insensitive compare.
+ * @note This means only ASCII-range characters are case-insensitive
+ */
+int av_strncasecmp(const char *a, const char *b, size_t n);
+
+
+/**
+ * Thread safe basename.
+ * @param path the path, on DOS both \ and / are considered separators.
+ * @return pointer to the basename substring.
+ */
+const char *av_basename(const char *path);
+
+/**
+ * Thread safe dirname.
+ * @param path the path, on DOS both \ and / are considered separators.
+ * @return the path with the separator replaced by the string terminator or ".".
+ * @note the function may change the input string.
+ */
+const char *av_dirname(char *path);
+
+/**
+ * @}
+ */
+
 #endif /* AVUTIL_AVSTRING_H */