Files
@ r5093:287224e9627d
Branch filter:
Location: cpp/openttd-patchpack/source/string.h - annotation
r5093:287224e9627d
1.6 KiB
text/x-c
(svn r7162) -CodeChange: disabled compilation of unused code (Darkvater)
r2186:5ee653b1b5e1 r2186:5ee653b1b5e1 r1317:3783af524858 r1317:3783af524858 r1317:3783af524858 r1317:3783af524858 r1317:3783af524858 r1317:3783af524858 r1317:3783af524858 r1317:3783af524858 r1317:3783af524858 r1317:3783af524858 r1317:3783af524858 r1317:3783af524858 r1317:3783af524858 r1317:3783af524858 r1317:3783af524858 r1317:3783af524858 r1317:3783af524858 r1317:3783af524858 r1317:3783af524858 r1317:3783af524858 r1317:3783af524858 r1317:3783af524858 r1317:3783af524858 r2234:6f59925a7314 r2234:6f59925a7314 r2775:3e6efcedc84d r2775:3e6efcedc84d r2775:3e6efcedc84d r2775:3e6efcedc84d r4300:642b2431578b r4300:642b2431578b r4300:642b2431578b r4300:642b2431578b r4300:642b2431578b r4300:642b2431578b r4300:642b2431578b r4300:642b2431578b r4300:642b2431578b r4300:642b2431578b r4300:642b2431578b r4300:642b2431578b r4300:642b2431578b r4300:642b2431578b r4300:642b2431578b r4300:642b2431578b r4300:642b2431578b r4300:642b2431578b r4200:4e5f339514ce r4200:4e5f339514ce r4200:4e5f339514ce r2436:963efe8b84cc | /* $Id$ */
#ifndef STRING_H
#define STRING_H
/*
* dst: destination buffer
* src: string to copy/concatenate
* size: size of the destination buffer
* usage: ttd_strlcpy(dst, src, lengthof(dst));
*/
void ttd_strlcat(char *dst, const char *src, size_t size);
void ttd_strlcpy(char *dst, const char *src, size_t size);
/*
* dst: destination buffer
* src: string to copy
* last: pointer to the last element in the dst array
* if NULL no boundary check is performed
* returns a pointer to the terminating \0 in the destination buffer
* usage: strecpy(dst, src, lastof(dst));
*/
char* strecat(char* dst, const char* src, const char* last);
char* strecpy(char* dst, const char* src, const char* last);
char* CDECL str_fmt(const char* str, ...);
/** Scans the string for valid characters and if it finds invalid ones,
* replaces them with a question mark '?' */
void str_validate(char *str);
/**
* Valid filter types for IsValidAsciiChar.
*/
typedef enum CharSetFilter {
CS_ALPHANUMERAL, //! Both numeric and alphabetic and spaces and stuff
CS_NUMERAL, //! Only numeric ones
CS_ALPHA, //! Only alphabetic values
} CharSetFilter;
/**
* Only allow certain keys. You can define the filter to be used. This makes
* sure no invalid keys can get into an editbox, like BELL.
* @param key character to be checked
* @param afilter the filter to use
* @return true or false depending if the character is printable/valid or not
*/
bool IsValidAsciiChar(byte key, CharSetFilter afilter);
/** Convert the given string to lowercase */
void strtolower(char *str);
#endif /* STRING_H */
|