ReactOS  0.4.12-dev-51-ge94618b
stringutils.h
Go to the documentation of this file.
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
15 extern "C" {
16 #endif
17 
18 //
19 // String formatting
20 //
23 
24 //
25 // String handling (ANSI <-> Unicode UTF16)
26 //
31 LPSTR DuplicateStringAEx(LPCSTR str, size_t numOfChars);
32 LPWSTR 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))
54 
56 
57 #ifdef __cplusplus
58 } // extern "C"
59 #endif
60 
61 #endif // __STRINGUTILS_H__
62 
63 /* EOF */
char strA[12]
Definition: clipboard.c:2028
const CHAR * LPCTSTR
Definition: xmlstorage.h:193
LPSTR DuplicateStringAEx(LPCSTR str, size_t numOfChars)
Definition: stringutils.c:124
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
char * LPSTR
Definition: xmlstorage.h:182
Definition: match.c:390
CHAR * LPTSTR
Definition: xmlstorage.h:192
LPWSTR DuplicateStringWEx(LPCWSTR str, size_t numOfChars)
Definition: stringutils.c:142
WCHAR strW[12]
Definition: clipboard.c:2029
LPWSTR AnsiToUnicode(LPCSTR strA)
Definition: stringutils.c:69
const WCHAR * str
char * va_list
Definition: acmsvcex.h:78
const char * LPCSTR
Definition: xmlstorage.h:183
LPWSTR DuplicateStringW(LPCWSTR str)
Definition: stringutils.c:107
LPSTR UnicodeToAnsi(LPCWSTR strW)
Definition: stringutils.c:48
LPTSTR AppendPathSeparator(LPTSTR lpszPath)
Definition: stringutils.c:220
LPTSTR FindSubStrI(LPCTSTR str, LPCTSTR strSearch)
Definition: stringutils.c:183
LPTSTR FormatString(LPCTSTR str,...)
Definition: stringutils.c:33
LPTSTR FormatStringV(LPCTSTR str, va_list args)
Definition: stringutils.c:16
WCHAR * LPWSTR
Definition: xmlstorage.h:184
LPSTR DuplicateStringA(LPCSTR str)
Definition: stringutils.c:90