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