00001 /* -*- C++ -*- */ 00002 00003 //============================================================================= 00004 /** 00005 * @file ace_wchar.h 00006 * 00007 * $Id: ace_wchar.h 79146 2007-08-01 07:39:56Z johnnyw $ 00008 * 00009 * @author Darrell Brunsch <brunsch@uci.edu> 00010 */ 00011 //============================================================================= 00012 00013 #ifndef ACE_WCHAR_H 00014 #define ACE_WCHAR_H 00015 00016 #include "ace/config-macros.h" 00017 00018 #if !defined (ACE_LACKS_PRAGMA_ONCE) 00019 # pragma once 00020 #endif /* ACE_LACKS_PRAGMA_ONCE */ 00021 00022 #if defined ACE_HAS_WCHAR 00023 00024 /** 00025 * @class ACE_Wide_To_Ascii 00026 * 00027 * @brief A lightweight wchar* to char* string conversion class. 00028 * 00029 * The purpose of this class is to perform conversion from 00030 * wchar* to char* strings. It is not intended for general 00031 * purpose use. 00032 */ 00033 class ACE_Wide_To_Ascii 00034 { 00035 public: 00036 /// Ctor must take a wchar string. 00037 ACE_Wide_To_Ascii (const wchar_t *s); 00038 00039 /// Dtor will free up the memory. 00040 ~ACE_Wide_To_Ascii (void); 00041 00042 /// Return the internal char* representation. 00043 char *char_rep (void); 00044 00045 /// Converts an wchar_t string to ascii and returns a new string. 00046 static char *convert (const wchar_t *wstr); 00047 00048 private: 00049 /// Internal pointer to the converted string. 00050 char *s_; 00051 00052 }; 00053 #endif // ACE_HAS_WCHAR 00054 00055 00056 #endif /* ACE_WCHAR_H */