#include <Argv_Type_Converter.h>
Public Member Functions | |
| ACE_Argv_Type_Converter (int &argc, char **argv) | |
| ~ACE_Argv_Type_Converter (void) | |
| ACE_TCHAR ** | get_TCHAR_argv (void) |
| Returns the pointer of converted command line. | |
| char ** | get_ASCII_argv (void) |
| Returns the pointer of ASCII (char) command line. | |
| int & | get_argc (void) |
| Returns the number of sub paramters (argc). | |
Private Member Functions | |
| ACE_Argv_Type_Converter (const ACE_Argv_Type_Converter &) | |
| Copy Constructor should not be used. | |
| ACE_Argv_Type_Converter | operator= (const ACE_Argv_Type_Converter &) |
| Assignment '=' operator should not be used. | |
Private Attributes | |
| int & | saved_argc_ |
| Original number of input paramter, same as 'argc'. | |
| char ** | char_argv_ |
| Data member pointer that contains converted argv in ACE_ANTI_TCHAR. | |
This class is to convert 'char' type command line paramter to wide-character (wchar_t) format and stores the copy of it. This is useful for all classes that use 'char**' argv but cannot be converted into 'ACE_TCHAR**' version. Note that the converted data will be lost upon destruction, so classes should use this class as their data member.
Definition at line 39 of file Argv_Type_Converter.h.
|
||||||||||||
|
Definition at line 36 of file Argv_Type_Converter.cpp. References ACE_TEXT_ANTI_TO_TCHAR, and ACE_OS::strdup().
00037 : saved_argc_(argc), 00038 char_argv_(argv) 00039 #if defined (ACE_USES_WCHAR) 00040 , wchar_argv_(0), 00041 before_pass_argc_(argc), 00042 original_type_(0), 00043 wchar_passed_(0), 00044 char_passed_(0) 00045 { 00046 this->initialize(); 00047 00048 for (int i = 0; i < argc; ++i) 00049 this->wchar_argv_[i] = ACE_OS::strdup (ACE_TEXT_ANTI_TO_TCHAR (argv[i])); 00050 } 00051 #else 00052 { 00053 } |
|
|
Definition at line 56 of file Argv_Type_Converter.cpp. References char_argv_, and ACE_OS::free().
00057 {
00058 #if defined (ACE_USES_WCHAR)
00059 // selectively delete the 'copy' of argv
00060 if (this->original_type_)
00061 {
00062 // if original type is wchar_t
00063 if (this->char_passed_)
00064 this->align_wchar_with_char ();
00065
00066 for (int i = 0; i < this->before_pass_argc_; ++i)
00067 ACE_OS::free (this->char_argv_[i]);
00068
00069 delete [] this->char_argv_;
00070 }
00071 else
00072 {
00073 // if original type is char
00074 if (this->wchar_passed_)
00075 this->align_char_with_wchar ();
00076
00077 for (int i = 0; i < this->before_pass_argc_; ++i)
00078 ACE_OS::free (this->wchar_argv_[i]);
00079
00080 delete [] this->wchar_argv_;
00081 }
00082 #endif // ACE_USES_WCHAR
00083 }
|
|
|
Copy Constructor should not be used.
|
|
|
Returns the number of sub paramters (argc).
Definition at line 39 of file Argv_Type_Converter.inl. References saved_argc_.
00040 {
00041 return this->saved_argc_;
00042 }
|
|
|
Returns the pointer of ASCII (char) command line.
Definition at line 24 of file Argv_Type_Converter.inl. References char_argv_.
00025 {
00026 #if defined (ACE_USES_WCHAR)
00027 if (this->wchar_passed_)
00028 {
00029 this->align_char_with_wchar ();
00030 }
00031
00032 this->char_passed_ = 1;
00033 #endif // ACE_USES_WCHAR
00034
00035 return this->char_argv_;
00036 }
|
|
|
Returns the pointer of converted command line.
Definition at line 8 of file Argv_Type_Converter.inl. References char_argv_.
00009 {
00010 #if defined (ACE_USES_WCHAR)
00011 if (this->char_passed_)
00012 {
00013 this->align_wchar_with_char ();
00014 }
00015
00016 this->wchar_passed_ = true;
00017 return this->wchar_argv_;
00018 #else
00019 return this->char_argv_;
00020 #endif // ACE_USES_WCHAR
00021 }
|
|
|
Assignment '=' operator should not be used.
|
|
|
Data member pointer that contains converted argv in ACE_ANTI_TCHAR.
Definition at line 90 of file Argv_Type_Converter.h. Referenced by get_ASCII_argv(), get_TCHAR_argv(), and ~ACE_Argv_Type_Converter(). |
|
|
Original number of input paramter, same as 'argc'.
Definition at line 87 of file Argv_Type_Converter.h. Referenced by get_argc(). |
1.3.6