Standardize License information
[openafs.git] / src / WINNT / afssvrcfg / char_conv.cpp
1 /*
2  * Copyright 2000, International Business Machines Corporation and others.
3  * All Rights Reserved.
4  * 
5  * This software has been released under the terms of the IBM Public
6  * License.  For details, see the LICENSE file in the top-level source
7  * directory or online at http://www.openafs.org/dl/license10.html
8  */
9
10 /*
11  * INCLUDES _________________________________________________________________
12  *
13  */
14 #include <WINNT\afsapplib.h>
15 #include <char_conv.h>
16
17
18
19 /*
20  *  Class to convert a TCHAR string to an ANSI string.
21  */
22 S2A::S2A(LPCTSTR pszUnicode)
23 {
24     m_pszAnsi = StringToAnsi(pszUnicode);
25 }
26
27 S2A::~S2A()
28 {
29 // Only need to free the string if a conversion was performed
30 #ifdef UNICODE
31     if (m_pszAnsi)
32         FreeString(m_pszAnsi);
33 #endif
34 }
35
36
37 /*
38  *  Class to convert an ANSI string to a TCHAR string.  If UNICODE is defined,
39  *  then the TCHAR string will be a UNICODE string, otherwise it will be an
40  *  ANSI string.
41  */
42 A2S::A2S(const char *pszAnsi)
43 {
44     m_pszUnicode = AnsiToString(pszAnsi);
45 }
46
47 A2S::~A2S()
48 {
49 // Only need to free the string if a conversion was performed
50 #ifdef UNICODE
51     if (m_pszUnicode)
52         FreeString(m_pszUnicode);
53 #endif
54 }
55