Public Member Functions | Private Member Functions | Private Attributes

ACE_Argv_Type_Converter Class Reference

To convert 'char' input/command line parameter to 'wchar_t'. More...

#include <Argv_Type_Converter.h>

List of all members.

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 parameters (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 parameter, same as 'argc'.
char ** char_argv_
 Data member pointer that contains converted argv in ACE_ANTI_TCHAR.

Detailed Description

To convert 'char' input/command line parameter to 'wchar_t'.

This class is to convert 'char' type command line parameter 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.


Constructor & Destructor Documentation

ACE_Argv_Type_Converter::ACE_Argv_Type_Converter ( int &  argc,
char **  argv 
)
ACE_Argv_Type_Converter::~ACE_Argv_Type_Converter ( void   ) 

Definition at line 56 of file Argv_Type_Converter.cpp.

{
#if defined (ACE_USES_WCHAR)
  // selectively delete the 'copy' of argv
  if (this->original_type_)
    {
      // if original type is wchar_t
      if (this->char_passed_)
        this->align_wchar_with_char ();

      for (int i = 0; i < this->before_pass_argc_; ++i)
        ACE_OS::free (this->char_argv_[i]);

      delete [] this->char_argv_;
    }
  else
    {
      // if original type is char
      if (this->wchar_passed_)
        this->align_char_with_wchar ();

      for (int i = 0; i < this->before_pass_argc_; ++i)
        ACE_OS::free (this->wchar_argv_[i]);

      delete [] this->wchar_argv_;
    }
#endif  // ACE_USES_WCHAR
}

ACE_Argv_Type_Converter::ACE_Argv_Type_Converter ( const ACE_Argv_Type_Converter  )  [private]

Copy Constructor should not be used.


Member Function Documentation

int & ACE_Argv_Type_Converter::get_argc ( void   )  [inline]

Returns the number of sub parameters (argc).

Definition at line 39 of file Argv_Type_Converter.inl.

{
  return this->saved_argc_;
}

char ** ACE_Argv_Type_Converter::get_ASCII_argv ( void   )  [inline]

Returns the pointer of ASCII (char) command line.

Definition at line 24 of file Argv_Type_Converter.inl.

{
#if defined (ACE_USES_WCHAR)
  if (this->wchar_passed_)
    {
      this->align_char_with_wchar ();
    }

  this->char_passed_ = true;
#endif  // ACE_USES_WCHAR

  return this->char_argv_;
}

ACE_TCHAR ** ACE_Argv_Type_Converter::get_TCHAR_argv ( void   )  [inline]

Returns the pointer of converted command line.

Definition at line 8 of file Argv_Type_Converter.inl.

{
#if defined (ACE_USES_WCHAR)
  if (this->char_passed_)
    {
      this->align_wchar_with_char ();
    }

  this->wchar_passed_ = true;
  return this->wchar_argv_;
#else
  return this->char_argv_;
#endif  // ACE_USES_WCHAR
}

ACE_Argv_Type_Converter ACE_Argv_Type_Converter::operator= ( const ACE_Argv_Type_Converter  )  [private]

Assignment '=' operator should not be used.


Member Data Documentation

Data member pointer that contains converted argv in ACE_ANTI_TCHAR.

Definition at line 90 of file Argv_Type_Converter.h.

Original number of input parameter, same as 'argc'.

Definition at line 87 of file Argv_Type_Converter.h.


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines