1 /* ScummVM - Graphic Adventure Engine 2 * 3 * ScummVM is the legal property of its developers, whose names 4 * are too numerous to list here. Please refer to the COPYRIGHT 5 * file distributed with this source distribution. 6 * 7 * This program is free software; you can redistribute it and/or 8 * modify it under the terms of the GNU General Public License 9 * as published by the Free Software Foundation; either version 2 10 * of the License, or (at your option) any later version. 11 * 12 * This program is distributed in the hope that it will be useful, 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 * GNU General Public License for more details. 16 * 17 * You should have received a copy of the GNU General Public License 18 * along with this program; if not, write to the Free Software 19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 20 * 21 */ 22 23 #ifndef AGS_ENGINE_AC_STRING_H 24 #define AGS_ENGINE_AC_STRING_H 25 26 //include <stdarg.h> 27 #include "ags/engine/ac/dynobj/cc_dynamic_object.h" 28 29 namespace AGS3 { 30 31 // Check that a supplied buffer from a text script function was not null 32 #define VALIDATE_STRING(strin) if (!strin) quit("!String argument was null: make sure you pass a string buffer") 33 34 int String_IsNullOrEmpty(const char *thisString); 35 const char *String_Copy(const char *srcString); 36 const char *String_Append(const char *thisString, const char *extrabit); 37 const char *String_AppendChar(const char *thisString, char extraOne); 38 const char *String_ReplaceCharAt(const char *thisString, int index, char newChar); 39 const char *String_Truncate(const char *thisString, int length); 40 const char *String_Substring(const char *thisString, int index, int length); 41 int String_CompareTo(const char *thisString, const char *otherString, bool caseSensitive); 42 int String_StartsWith(const char *thisString, const char *checkForString, bool caseSensitive); 43 int String_EfndsWith(const char *thisString, const char *checkForString, bool caseSensitive); 44 const char *String_Replace(const char *thisString, const char *lookForText, const char *replaceWithText, bool caseSensitive); 45 const char *String_LowerCase(const char *thisString); 46 const char *String_UpperCase(const char *thisString); 47 int String_GetChars(const char *texx, int index); 48 int StringToInt(const char *stino); 49 int StrContains(const char *s1, const char *s2); 50 int String_EndsWith(const char *thisString, const char *checkForString, bool caseSensitive); 51 52 //============================================================================= 53 54 const char *CreateNewScriptString(const char *fromText, bool reAllocate = true); 55 DynObjectRef CreateNewScriptStringObj(const char *fromText, bool reAllocate = true); 56 class SplitLines; 57 // Break up the text into lines restricted by the given width; 58 // returns number of lines, or 0 if text cannot be split well to fit in this width. 59 // Does additional processing, like removal of voice-over tags and text reversal if right-to-left text display is on. 60 size_t break_up_text_into_lines(const char *todis, SplitLines &lines, int wii, int fonnt, size_t max_lines = -1); 61 void check_strlen(char *ptt); 62 void my_strncpy(char *dest, const char *src, int len); 63 64 } // namespace AGS3 65 66 #endif 67