Blender V2.61 - r43446

BLI_string.h

Go to the documentation of this file.
00001 /*
00002  * ***** BEGIN GPL LICENSE BLOCK *****
00003  *
00004  * This program is free software; you can redistribute it and/or
00005  * modify it under the terms of the GNU General Public License
00006  * as published by the Free Software Foundation; either version 2
00007  * of the License, or (at your option) any later version.
00008  *
00009  * This program is distributed in the hope that it will be useful,
00010  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012  * GNU General Public License for more details.
00013  *
00014  * You should have received a copy of the GNU General Public License
00015  * along with this program; if not, write to the Free Software Foundation,
00016  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
00017  *
00018  * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
00019  * All rights reserved.
00020  *
00021  * The Original Code is: all of this file.
00022  *
00023  * Contributor(s): none yet.
00024  *
00025  * ***** END GPL LICENSE BLOCK *****
00026  */
00027 
00028 #ifndef BLI_STRING_H
00029 #define BLI_STRING_H
00030 
00035 #ifdef __cplusplus
00036 extern "C" {
00037 #endif
00038 
00046 char *BLI_strdup(const char *str);
00047 
00057 char *BLI_strdupn(const char *str, const size_t len);
00058 
00065 char *BLI_strdupcat(const char *str1, const char *str2);
00066 
00077 char *BLI_strncpy(char *dst, const char *src, const size_t maxncpy);
00078 
00079     /* Makes a copy of the text within the "" that appear after some text 'blahblah'
00080      * i.e. for string 'pose["apples"]' with prefix 'pose[', it should grab "apples"
00081      * 
00082      *  - str: is the entire string to chop
00083      *  - prefix: is the part of the string to leave out 
00084      *
00085      * Assume that the strings returned must be freed afterwards, and that the inputs will contain 
00086      * data we want...
00087      */
00088 char *BLI_getQuotedStr(const char *str, const char *prefix);
00089 
00100 char *BLI_replacestr(char *str, const char *oldText, const char *newText);
00101 
00102     /* 
00103      * Replacement for snprintf
00104      */
00105 size_t BLI_snprintf(char *buffer, size_t len, const char *format, ...)
00106 #ifdef __GNUC__
00107 __attribute__ ((format (printf, 3, 4)))
00108 #endif
00109 ;
00110 
00111     /* 
00112      * Print formatted string into a newly mallocN'd string
00113      * and return it.
00114      */
00115 char *BLI_sprintfN(const char *format, ...)
00116 #ifdef __GNUC__
00117 __attribute__ ((format (printf, 1, 2)))
00118 #endif
00119 ;
00120 
00121 size_t BLI_strescape(char *dst, const char *src, const size_t maxlen);
00122 
00128 int BLI_strcaseeq(const char *a, const char *b);
00129 
00130 char *BLI_strcasestr(const char *s, const char *find);
00131 int BLI_strcasecmp(const char *s1, const char *s2);
00132 int BLI_strncasecmp(const char *s1, const char *s2, size_t len);
00133 int BLI_natstrcmp(const char *s1, const char *s2);
00134 size_t BLI_strnlen(const char *str, size_t maxlen);
00135 void BLI_timestr(double _time, char *str); /* time var is global */
00136 
00137 void BLI_ascii_strtolower(char *str, int len);
00138 void BLI_ascii_strtoupper(char *str, int len);
00139 
00140 #ifdef __cplusplus
00141 }
00142 #endif
00143 
00144 #endif