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