1*c2c66affSColin Finck /* 2*c2c66affSColin Finck * PROJECT: ReactOS Applications 3*c2c66affSColin Finck * LICENSE: LGPL - See COPYING in the top level directory 4*c2c66affSColin Finck * FILE: base/applications/msconfig_new/stringutils.h 5*c2c66affSColin Finck * PURPOSE: ANSI & UNICODE String Utility Functions 6*c2c66affSColin Finck * COPYRIGHT: Copyright 2011-2012 Hermes BELUSCA - MAITO <hermes.belusca@sfr.fr> 7*c2c66affSColin Finck */ 8*c2c66affSColin Finck 9*c2c66affSColin Finck #ifndef __STRINGUTILS_H__ 10*c2c66affSColin Finck #define __STRINGUTILS_H__ 11*c2c66affSColin Finck 12*c2c66affSColin Finck #pragma once 13*c2c66affSColin Finck 14*c2c66affSColin Finck #ifdef __cplusplus 15*c2c66affSColin Finck extern "C" { 16*c2c66affSColin Finck #endif 17*c2c66affSColin Finck 18*c2c66affSColin Finck // 19*c2c66affSColin Finck // String formatting 20*c2c66affSColin Finck // 21*c2c66affSColin Finck LPTSTR FormatStringV(LPCTSTR str, va_list args); 22*c2c66affSColin Finck LPTSTR FormatString(LPCTSTR str, ...); 23*c2c66affSColin Finck 24*c2c66affSColin Finck // 25*c2c66affSColin Finck // String handling (ANSI <-> Unicode UTF16) 26*c2c66affSColin Finck // 27*c2c66affSColin Finck LPSTR UnicodeToAnsi(LPCWSTR strW); 28*c2c66affSColin Finck LPWSTR AnsiToUnicode(LPCSTR strA); 29*c2c66affSColin Finck LPSTR DuplicateStringA(LPCSTR str); 30*c2c66affSColin Finck LPWSTR DuplicateStringW(LPCWSTR str); 31*c2c66affSColin Finck LPSTR DuplicateStringAEx(LPCSTR str, size_t numOfChars); 32*c2c66affSColin Finck LPWSTR DuplicateStringWEx(LPCWSTR str, size_t numOfChars); 33*c2c66affSColin Finck 34*c2c66affSColin Finck // 35*c2c66affSColin Finck // Conversion macros ANSI <-> Unicode 36*c2c66affSColin Finck // 37*c2c66affSColin Finck #ifdef UNICODE 38*c2c66affSColin Finck #define NewAnsiString(x) UnicodeToAnsi(x) 39*c2c66affSColin Finck #define NewPortableString(x) AnsiToUnicode(x) 40*c2c66affSColin Finck #define DuplicateString(x) DuplicateStringW(x) 41*c2c66affSColin Finck #define DuplicateStringEx(x, y) DuplicateStringWEx((x), (y)) 42*c2c66affSColin Finck #else 43*c2c66affSColin Finck #define NewAnsiString(x) DuplicateStringA(x) 44*c2c66affSColin Finck #define NewPortableString(x) DuplicateString(x) 45*c2c66affSColin Finck #define DuplicateString(x) DuplicateStringA(x) 46*c2c66affSColin Finck #define DuplicateStringEx(x, y) DuplicateStringAEx((x), (y)) 47*c2c66affSColin Finck #endif 48*c2c66affSColin Finck 49*c2c66affSColin Finck // 50*c2c66affSColin Finck // String search functions 51*c2c66affSColin Finck // 52*c2c66affSColin Finck #define FindSubStr(str, strSearch) _tcsstr((str), (strSearch)) 53*c2c66affSColin Finck LPTSTR FindSubStrI(LPCTSTR str, LPCTSTR strSearch); 54*c2c66affSColin Finck 55*c2c66affSColin Finck LPTSTR AppendPathSeparator(LPTSTR lpszPath); 56*c2c66affSColin Finck 57*c2c66affSColin Finck #ifdef __cplusplus 58*c2c66affSColin Finck } // extern "C" 59*c2c66affSColin Finck #endif 60*c2c66affSColin Finck 61*c2c66affSColin Finck #endif // __STRINGUTILS_H__ 62*c2c66affSColin Finck 63*c2c66affSColin Finck /* EOF */ 64