#include <Argv_Type_Converter.h>
Public Methods | |
| 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. More... | |
| char ** | get_ASCII_argv (void) |
| Returns the pointer of ASCII (char) command line. More... | |
| int & | get_argc (void) |
| Returns the number of sub paramters (argc). More... | |
Private Methods | |
| ACE_Argv_Type_Converter (const ACE_Argv_Type_Converter &) | |
| Copy Constructor should not be used. More... | |
| ACE_Argv_Type_Converter | operator= (const ACE_Argv_Type_Converter &) |
| Assignment '=' operator should not be used. More... | |
Private Attributes | |
| int & | saved_argc_ |
| Original number of input paramter, same as 'argc'. More... | |
| char ** | char_argv_ |
| Data member pointer that contains converted argv in ACE_ANTI_TCHAR. More... | |
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 38 of file Argv_Type_Converter.h.
|
||||||||||||
|
Definition at line 38 of file Argv_Type_Converter.cpp. References ACE_TEXT_ANTI_TO_TCHAR, and ACE_OS_String::strdup.
00039 : saved_argc_(argc) 00040 , char_argv_(argv) 00041 #if defined (ACE_USES_WCHAR) 00042 , wchar_argv_(0) 00043 , before_pass_argc_(argc) 00044 , original_type_(0) 00045 , wchar_passed_(0) 00046 , char_passed_(0) 00047 { 00048 this->initialize(); 00049 00050 for (int i = 0; i < argc; ++i) 00051 { 00052 this->wchar_argv_[i] = 00053 ACE_OS_String::strdup (ACE_TEXT_ANTI_TO_TCHAR (argv[i])); 00054 } 00055 } 00056 #else 00057 { 00058 } |
|
|
Definition at line 61 of file Argv_Type_Converter.cpp. References char_argv_.
00062 {
00063 #if defined (ACE_USES_WCHAR)
00064 // selectively delete the 'copy' of argv
00065 if (this->original_type_)
00066 {
00067 // if original type is wchar_t
00068 if (this->char_passed_)
00069 {
00070 this->align_wchar_with_char();
00071 }
00072 for (int i = 0; i < this->before_pass_argc_; ++i)
00073 {
00074 delete [] this->char_argv_[i];
00075 }
00076 delete [] this->char_argv_;
00077 }
00078 else
00079 {
00080 // if original type is char
00081 if (this->wchar_passed_) {
00082 this->align_char_with_wchar ();
00083 }
00084 for (int i = 0; i < this->before_pass_argc_; ++i)
00085 {
00086 delete [] this->wchar_argv_[i];
00087 }
00088 delete [] this->wchar_argv_;
00089 }
00090 #endif // ACE_USES_WCHAR
00091 }
|
|
|
Copy Constructor should not be used.
|
|
|
Returns the number of sub paramters (argc).
Definition at line 38 of file Argv_Type_Converter.inl. References saved_argc_.
00039 {
00040 return this->saved_argc_;
00041 }
|
|
|
Returns the pointer of ASCII (char) command line.
Definition at line 23 of file Argv_Type_Converter.inl. References char_argv_.
00024 {
00025 #if defined (ACE_USES_WCHAR)
00026 if (this->wchar_passed_)
00027 {
00028 this->align_char_with_wchar ();
00029 }
00030
00031 this->char_passed_ = 1;
00032 #endif // ACE_USES_WCHAR
00033
00034 return this->char_argv_;
00035 }
|
|
|
Returns the pointer of converted command line.
Definition at line 7 of file Argv_Type_Converter.inl. References char_argv_.
00008 {
00009 #if defined (ACE_USES_WCHAR)
00010 if (this->char_passed_)
00011 {
00012 this->align_wchar_with_char ();
00013 }
00014
00015 this->wchar_passed_ = true;
00016 return this->wchar_argv_;
00017 #else
00018 return this->char_argv_;
00019 #endif // ACE_USES_WCHAR
00020 }
|
|
|
Assignment '=' operator should not be used.
|
|
|
Data member pointer that contains converted argv in ACE_ANTI_TCHAR.
Definition at line 89 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 86 of file Argv_Type_Converter.h. Referenced by get_argc. |
1.2.14 written by Dimitri van Heesch,
© 1997-2002