ACE_ARGV_T< CHAR_TYPE > Class Template Reference

Builds a counted argument vector (ala argc/argv) from either a string or a set of separate tokens. This class preserves whitespace within tokens only if the whitespace-containing token is enclosed in either single (') or double (") quotes. This is consistent with the expected behavior if an argument vector obtained using this class is passed to, for example, ACE_Get_Opt. More...

#include <ARGV.h>

Collaboration diagram for ACE_ARGV_T< CHAR_TYPE >:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 ACE_ARGV_T (const CHAR_TYPE buf[], bool substitute_env_args=true)
 ACE_ARGV_T (int argc, CHAR_TYPE *argv[], bool substitute_env_args=true, bool quote_args=false)
 ACE_ARGV_T (CHAR_TYPE *argv[], bool substitute_env_args=true, bool quote_args=false)
 ACE_ARGV_T (CHAR_TYPE *first_argv[], CHAR_TYPE *second_argv[], bool substitute_env_args=true, bool quote_args=false)
 ACE_ARGV_T (bool substitute_env_args=true)
 ~ACE_ARGV_T (void)
 Destructor.
void dump (void) const
 Dump the state of this object.
int add (const CHAR_TYPE *next_arg, bool quote_arg=false)
int add (CHAR_TYPE *argv[], bool quote_args=false)
Accessor methods
These methods access the argument vector contained in this object.

const CHAR_TYPE * operator[] (size_t index)
CHAR_TYPE ** argv (void)
int argc (void) const
 Returns the current number of arguments.
const CHAR_TYPE * buf (void)

Public Attributes

 ACE_ALLOC_HOOK_DECLARE

Private Member Functions

 ACE_ARGV_T (const ACE_ARGV_T< CHAR_TYPE > &)
 Copy constructor not implemented.
ACE_ARGV_T operator= (const ACE_ARGV_T< CHAR_TYPE > &)
 Assignment operator not implemented.
int create_buf_from_queue (void)
 Creates buf_ from the queue of added args, deletes previous buf_.
int string_to_argv (void)
 Converts buf_ into the CHAR_TYPE *argv[] format.

Private Attributes

bool substitute_env_args_
 Replace args with environment variable values?
bool iterative_
int argc_
 Number of arguments in the ARGV array.
CHAR_TYPE ** argv_
 The array of string arguments.
CHAR_TYPE * buf_
 Buffer containing the <argv> contents.
size_t length_
ACE_Unbounded_Queue< ACE_ARGV_Queue_Entry_T<
CHAR_TYPE > > 
queue_

Detailed Description

template<typename CHAR_TYPE>
class ACE_ARGV_T< CHAR_TYPE >

Builds a counted argument vector (ala argc/argv) from either a string or a set of separate tokens. This class preserves whitespace within tokens only if the whitespace-containing token is enclosed in either single (') or double (") quotes. This is consistent with the expected behavior if an argument vector obtained using this class is passed to, for example, ACE_Get_Opt.

This class can substitute environment variable values for tokens that are environment variable references (e.g., $VAR). This only works if the token is an environment variable reference and nothing else; it doesn't substitute environment variable references within a token. For example, $HOME/file will not substitute the value of the HOME environment variable.

Definition at line 96 of file ARGV.h.


Constructor & Destructor Documentation

template<typename CHAR_TYPE>
ACE_ARGV_T< CHAR_TYPE >::ACE_ARGV_T ( const CHAR_TYPE  buf[],
bool  substitute_env_args = true 
) [explicit]

Splits the specified string into an argument vector. Arguments in the string are delimited by whitespace. Whitespace-containing arguments must be enclosed in quotes, either single (') or double (").

Parameters:
buf A nul-terminated CHAR_TYPE array to split into arguments for the vector.
substitute_env_args If non-zero, any token that is an environment variable reference (e.g., $VAR) will have its environment variable value in the resultant vector in place of the environment variable name.

Definition at line 79 of file ARGV.cpp.

References ACE_ERROR, ACE_NEW, ACE_TEXT, ACE_TRACE, LM_ERROR, ACE_OS::strcpy(), and ACE_OS::strlen().

00081   : substitute_env_args_ (substitute_env_args),
00082     iterative_ (false),
00083     argc_ (0),
00084     argv_ (0),
00085     buf_ (0),
00086     length_ (0),
00087     queue_ ()
00088 {
00089   ACE_TRACE ("ACE_ARGV_T::ACE_ARGV_T CHAR_TYPE[] to CHAR_TYPE *[]");
00090 
00091   if (buf == 0 || buf[0] == 0)
00092     return;
00093 
00094   // Make an internal copy of the string.
00095   ACE_NEW (this->buf_,
00096            CHAR_TYPE[ACE_OS::strlen (buf) + 1]);
00097   ACE_OS::strcpy (this->buf_, buf);
00098 
00099   // Create this->argv_.
00100   if (this->string_to_argv () == -1)
00101     ACE_ERROR ((LM_ERROR,
00102                 ACE_TEXT ("%p\n"),
00103                 ACE_TEXT ("string_to_argv")));
00104 }

template<typename CHAR_TYPE>
ACE_ARGV_T< CHAR_TYPE >::ACE_ARGV_T ( int  argc,
CHAR_TYPE *  argv[],
bool  substitute_env_args = true,
bool  quote_args = false 
) [explicit]

Initializes the argument vector from a set of arguments. Any environment variable references are translated (if applicable) during execution of this method. In contrast with ACE_ARGV_T(CHAR_TYPE *[], bool, bool), this ctor does not require argv to be 0-terminated as the number of arguments is provided explicitely.

Parameters:
argc The number of arguments in the argv array.
argv An array of tokens to initialize the object with. All needed data is copied from argv during this call; the pointers in argv are not needed after this call, and the memory referred to by argv is not referenced by this object.
substitute_env_args If non-zero, any element of argv that is an environment variable reference (e.g., $VAR) will have its environment variable value in the resultant vector in place of the environment variable name.
quote_args If non-zero each argument argv[i] needs to be enclosed in double quotes ('"').

Definition at line 130 of file ARGV.cpp.

References ACE_TRACE, ACE_ARGV_T< CHAR_TYPE >::argc_, and ACE_OS::argv_to_string().

00134   : substitute_env_args_ (substitute_env_args),
00135     iterative_ (false),
00136     argc_ (0),
00137     argv_ (0),
00138     buf_ (0),
00139     length_ (0),
00140     queue_ ()
00141 {
00142   ACE_TRACE ("ACE_ARGV_T::ACE_ARGV_T int,CHAR_TYPE*[] to CHAR_TYPE[]");
00143 
00144   this->argc_ = ACE_OS::argv_to_string (argc,
00145                                         argv,
00146                                         this->buf_,
00147                                         substitute_env_args,
00148                                         quote_arg);
00149 }

template<typename CHAR_TYPE>
ACE_ARGV_T< CHAR_TYPE >::ACE_ARGV_T ( CHAR_TYPE *  argv[],
bool  substitute_env_args = true,
bool  quote_args = false 
) [explicit]

Initializes the argument vector from a set of arguments. Any environment variable references are translated (if applicable) during execution of this method.

Parameters:
argv An array of tokens to initialize the object with. The array must be terminated with a 0 pointer. All needed data is copied from argv during this call; the pointers in argv are not needed after this call, and the memory referred to by argv is not referenced by this object.
substitute_env_args If non-zero, any element of argv that is an environment variable reference (e.g., $VAR) will have its environment variable value in the resultant vector in place of the environment variable name.
quote_args If non-zero each argument argv[i] needs to be enclosed in double quotes ('"').

Definition at line 107 of file ARGV.cpp.

References ACE_TRACE, ACE_ARGV_T< CHAR_TYPE >::argc_, and ACE_OS::argv_to_string().

00110   : substitute_env_args_ (substitute_env_args),
00111     iterative_ (false),
00112     argc_ (0),
00113     argv_ (0),
00114     buf_ (0),
00115     length_ (0),
00116     queue_ ()
00117 {
00118   ACE_TRACE ("ACE_ARGV_T::ACE_ARGV_T CHAR_TYPE*[] to CHAR_TYPE[]");
00119 
00120   if (argv == 0 || argv[0] == 0)
00121     return;
00122 
00123   this->argc_ = ACE_OS::argv_to_string (argv,
00124                                         this->buf_,
00125                                         substitute_env_args,
00126                                         quote_arg);
00127 }

template<typename CHAR_TYPE>
ACE_ARGV_T< CHAR_TYPE >::ACE_ARGV_T ( CHAR_TYPE *  first_argv[],
CHAR_TYPE *  second_argv[],
bool  substitute_env_args = true,
bool  quote_args = false 
)

Initializes the argument vector from two combined argument vectors.

Parameters:
first_argv An array of tokens to initialize the object with. The array must be terminated with a 0 pointer.
second_argv An array of tokens that is concatenated with the the tokens in first_argv. The array must be terminated with a 0 pointer.
substitute_env_args If non-zero, any element of first_argv or second_argv that is an environment variable reference (e.g., $VAR) will have its environment variable value in the resultant vector in place of the environment variable name.
quote_args If non-zero each arguments first_argv[i] and second_argv[i] needs to be enclosed in double quotes ('"').

Definition at line 153 of file ARGV.cpp.

References ACE_NEW, ACE_TRACE, ACE_ARGV_T< CHAR_TYPE >::argc_, ACE_OS::argv_to_string(), ACE_OS::strcat(), ACE_OS::strcpy(), and ACE_OS::strlen().

00157   : substitute_env_args_ (substitute_env_args),
00158     iterative_ (false),
00159     argc_ (0),
00160     argv_ (0),
00161     buf_ (0),
00162     length_ (0),
00163     queue_ ()
00164 {
00165   ACE_TRACE ("ACE_ARGV_T::ACE_ARGV_T CHAR_TYPE*[] + CHAR_TYPE *[] to CHAR_TYPE[]");
00166 
00167   int first_argc = 0;
00168   int second_argc = 0;
00169 
00170   CHAR_TYPE *first_buf = 0;
00171   CHAR_TYPE *second_buf = 0;
00172 
00173   // convert the first argv to a string
00174   if (first_argv != 0 && first_argv[0] != 0)
00175     {
00176       first_argc = ACE_OS::argv_to_string (first_argv,
00177                                            first_buf,
00178                                            substitute_env_args,
00179                                            quote_args);
00180     }
00181 
00182   // convert the second argv to a string
00183   if (second_argv != 0 && second_argv[0] != 0)
00184     {
00185       second_argc = ACE_OS::argv_to_string (second_argv,
00186                                             second_buf,
00187                                             substitute_env_args,
00188                                             quote_args);
00189     }
00190 
00191   // Add the number of arguments in both the argvs.
00192   this->argc_ = first_argc + second_argc;
00193 
00194   size_t buf_len =
00195     ACE_OS::strlen (first_buf) + ACE_OS::strlen (second_buf) + 1;
00196 
00197   // Allocate memory to the lenght of the combined argv string.
00198   ACE_NEW (this->buf_,
00199            CHAR_TYPE[buf_len + 1]);
00200 
00201   // copy the first argv string to the buffer
00202   ACE_OS::strcpy (this->buf_, first_buf);
00203 
00204   // concatenate the second argv string to the buffer
00205   ACE_OS::strcat (this->buf_, second_buf);
00206 
00207   //   Delete the first and second buffers
00208   delete [] first_buf;
00209   delete [] second_buf;
00210 }

template<typename CHAR_TYPE>
ACE_ARGV_T< CHAR_TYPE >::ACE_ARGV_T ( bool  substitute_env_args = true  )  [explicit]

Initialize this object so arguments can be added later using one of the add methods. This is referred to as the iterative method of adding arguments to this object.

Definition at line 213 of file ARGV.cpp.

References ACE_TRACE.

00214   : substitute_env_args_ (substitute_env_args),
00215     iterative_ (true),
00216     argc_ (0),
00217     argv_ (0),
00218     buf_ (0),
00219     length_ (0),
00220     queue_ ()
00221 {
00222   ACE_TRACE ("ACE_ARGV_T::ACE_ARGV_T Iterative");
00223 
00224   // Nothing to do yet -- the user puts in arguments via add ()
00225 }

template<typename CHAR_TYPE>
ACE_ARGV_T< CHAR_TYPE >::~ACE_ARGV_T ( void   ) 

Destructor.

Definition at line 291 of file ARGV.cpp.

References ACE_TRACE, ACE_ARGV_T< CHAR_TYPE >::argv_, and ACE_OS::free().

00292 {
00293   ACE_TRACE ("ACE_ARGV_T::~ACE_ARGV_T");
00294 
00295   if (this->argv_ != 0)
00296     for (int i = 0; this->argv_[i] != 0; i++)
00297       ACE_OS::free ((void *) this->argv_[i]);
00298 
00299   delete [] this->argv_;
00300   delete [] this->buf_;
00301 }

template<typename CHAR_TYPE>
ACE_ARGV_T< CHAR_TYPE >::ACE_ARGV_T ( const ACE_ARGV_T< CHAR_TYPE > &   )  [private]

Copy constructor not implemented.


Member Function Documentation

template<typename CHAR_TYPE>
int ACE_ARGV_T< CHAR_TYPE >::add ( CHAR_TYPE *  argv[],
bool  quote_args = false 
)

Add an array of arguments. This only works in the iterative mode.

Note:
This method copies the specified pointers, but not the data contained in the referenced memory. Thus, if the content of the memory referred to by any of the argv elements is changed after this method returns, the results are undefined.
Parameters:
argv Pointers to the arguments to add to the vector. argv must be terminated by a 0 pointer.
quote_args If non-zero each argument argv[i] needs to be enclosed in double quotes ('"').
Return values:
0 on success; -1 on failure. Most likely errno values are:
  • EINVAL: This object is not in iterative mode.
  • ENOMEM: Not enough memory available to save next_arg.

Definition at line 279 of file ARGV.cpp.

00280 {
00281   for (int i = 0; argv[i] != 0; i++)
00282     if (this->add (argv[i], quote_args) == -1)
00283       return -1;
00284 
00285   return 0;
00286 }

template<typename CHAR_TYPE>
int ACE_ARGV_T< CHAR_TYPE >::add ( const CHAR_TYPE *  next_arg,
bool  quote_arg = false 
)

Add another argument. This only works in the iterative mode.

Note:
This method copies the specified pointer, but not the data contained in the referenced memory. Thus, if the content of the memory referred to by next_arg are changed after this method returns, the results are undefined.
Parameters:
next_arg Pointer to the next argument to add to the vector.
quote_arg The argument next_arg need to be quoted while adding to the vector.
Return values:
0 on success; -1 on failure. Most likely errno values are:
  • EINVAL: This object is not in iterative mode.
  • ENOMEM: Not enough memory available to save next_arg.

Definition at line 229 of file ARGV.cpp.

References ACE_ERROR_RETURN, ACE_TEXT, ACE_ARGV_T< CHAR_TYPE >::argc_, ACE_ARGV_T< CHAR_TYPE >::argv_, ACE_ARGV_T< CHAR_TYPE >::buf_, ACE_OS::free(), ACE_ARGV_T< CHAR_TYPE >::length_, LM_ERROR, ACE_OS::strchr(), and ACE_OS::strlen().

Referenced by ACE_Service_Config::parse_args_i().

00230 {
00231   // Only allow this to work in the "iterative" verion -- the
00232   // ACE_ARGVs created with the one argument constructor.
00233   if (!this->iterative_)
00234     {
00235       errno = EINVAL;
00236       return -1;
00237     }
00238 
00239   this->length_ += ACE_OS::strlen (next_arg);
00240   if (quote_arg && ACE_OS::strchr (next_arg, ' ') != 0)
00241     {
00242       this->length_ += 2;
00243       if (ACE_OS::strchr (next_arg, '"') != 0)
00244         for (const CHAR_TYPE * p = next_arg; *p != '\0'; ++p)
00245           if (*p == '"') ++this->length_;
00246     }
00247   else
00248     {
00249       quote_arg = false;
00250     }
00251 
00252   // Put the new argument at the end of the queue.
00253   if (this->queue_.enqueue_tail (ACE_ARGV_Queue_Entry_T<CHAR_TYPE> (next_arg, quote_arg)) == -1)
00254     ACE_ERROR_RETURN ((LM_ERROR,
00255                        ACE_TEXT ("Can't add more to ARGV queue")),
00256                       -1);
00257 
00258   ++this->argc_;
00259 
00260   // Wipe argv_ and buf_ away so that they will be recreated if the
00261   // user calls argv () or buf ().
00262   if (this->argv_ != 0)
00263     {
00264       for (int i = 0; this->argv_[i] != 0; i++)
00265         ACE_OS::free ((void *) this->argv_[i]);
00266 
00267       delete [] this->argv_;
00268       this->argv_ = 0;
00269     }
00270 
00271   delete [] this->buf_;
00272   this->buf_ = 0;
00273 
00274   return 0;
00275 }

template<typename CHAR_TYPE>
ACE_INLINE int ACE_ARGV_T< CHAR_TYPE >::argc ( void   )  const

Returns the current number of arguments.

Definition at line 43 of file ARGV.inl.

References ACE_TRACE, ACE_ARGV_T< CHAR_TYPE >::argc_, and ACE_ARGV_T< CHAR_TYPE >::argv().

Referenced by ACE_Service_Gestalt::initialize(), ACE_Service_Gestalt::initialize_i(), and ACE_Service_Config::parse_args_i().

00044 {
00045   ACE_TRACE ("ACE_ARGV_T::argc");
00046  // Try to create the argv_ if it isn't there
00047   ACE_ARGV_T<CHAR_TYPE> *nonconst_this =
00048     const_cast <ACE_ARGV_T<CHAR_TYPE> *> (this);
00049  (void) nonconst_this->argv ();
00050   return this->argc_;
00051 }

template<typename CHAR_TYPE>
ACE_INLINE CHAR_TYPE ** ACE_ARGV_T< CHAR_TYPE >::argv ( void   ) 

Returns the current argument vector. The returned pointers are to data maintained internally to this class. Do not change or delete either the pointers or the memory to which they refer.

Definition at line 70 of file ARGV.inl.

References ACE_TRACE, ACE_ARGV_T< CHAR_TYPE >::argv_, and ACE_ARGV_T< CHAR_TYPE >::create_buf_from_queue().

Referenced by ACE_ARGV_T< CHAR_TYPE >::argc(), ACE_ARGV_T< CHAR_TYPE >::dump(), ACE_Service_Gestalt::initialize(), ACE_Service_Gestalt::initialize_i(), ACE_ARGV_T< CHAR_TYPE >::operator[](), and ACE_Service_Config::parse_args_i().

00071 {
00072   ACE_TRACE ("ACE_ARGV_T::argv");
00073 
00074   // Try to create the argv_ if it isn't there
00075   if (this->argv_ == 0)
00076     {
00077       if (this->iterative_ && this->buf_ == 0)
00078         this->create_buf_from_queue ();
00079 
00080       // Convert buf_ to argv_
00081       if (this->string_to_argv () == -1)
00082         return (CHAR_TYPE **) 0;
00083     }
00084 
00085   return (CHAR_TYPE **) this->argv_;
00086 }

template<typename CHAR_TYPE>
ACE_INLINE const CHAR_TYPE * ACE_ARGV_T< CHAR_TYPE >::buf ( void   ) 

Returns a single string form of the current arguments. The returned pointer refers to memory maintained internally to this class. Do not change or delete it.

Definition at line 56 of file ARGV.inl.

References ACE_TRACE, ACE_ARGV_T< CHAR_TYPE >::buf_, and ACE_ARGV_T< CHAR_TYPE >::create_buf_from_queue().

00057 {
00058   ACE_TRACE ("ACE_ARGV_T::buf");
00059 
00060   if (this->buf_ == 0 && this->iterative_)
00061     this->create_buf_from_queue ();
00062 
00063   return (const CHAR_TYPE *) this->buf_;
00064 }

template<typename CHAR_TYPE>
int ACE_ARGV_T< CHAR_TYPE >::create_buf_from_queue ( void   )  [private]

Creates buf_ from the queue of added args, deletes previous buf_.

Definition at line 308 of file ARGV.cpp.

References ACE_NEW_RETURN, ACE_TRACE, ACE_Unbounded_Queue_Iterator< T >::advance(), ACE_ARGV_Queue_Entry_T< CHAR_TYPE >::arg_, ACE_ARGV_T< CHAR_TYPE >::buf_, ACE_Unbounded_Queue_Iterator< T >::done(), ACE_OS::memcpy(), ACE_Unbounded_Queue_Iterator< T >::next(), ACE_ARGV_Queue_Entry_T< CHAR_TYPE >::quote_arg_, ACE_OS::strchr(), and ACE_OS::strlen().

Referenced by ACE_ARGV_T< CHAR_TYPE >::argv(), and ACE_ARGV_T< CHAR_TYPE >::buf().

00309 {
00310   ACE_TRACE ("ACE_ARGV_T::create_buf_from_queue");
00311 
00312   // If the are no arguments, don't do anything
00313   if (this->argc_ <= 0)
00314     return -1;
00315 
00316   delete [] this->buf_;
00317 
00318   ACE_NEW_RETURN (this->buf_,
00319                   CHAR_TYPE[this->length_ + this->argc_],
00320                   -1);
00321 
00322   // Get an iterator over the queue
00323   ACE_Unbounded_Queue_Iterator<ACE_ARGV_Queue_Entry_T<CHAR_TYPE> > iter (this->queue_);
00324 
00325   ACE_ARGV_Queue_Entry_T<CHAR_TYPE> *arg = 0;
00326   CHAR_TYPE *ptr = this->buf_;
00327   size_t len;
00328 
00329   while (!iter.done ())
00330     {
00331       // Get next argument from the queue.
00332       iter.next (arg);
00333       iter.advance ();
00334 
00335       if (arg->quote_arg_)
00336         {
00337           *ptr++ = '"';
00338           if (ACE_OS::strchr (arg->arg_, '"') != 0)
00339             {
00340               CHAR_TYPE prev = 0;
00341               for (const CHAR_TYPE * p = arg->arg_; *p != '\0'; ++p)
00342                 {
00343                   if (*p == '"' && prev != '\\') *ptr++ = '\\';
00344                   prev = *ptr++ = *p;
00345                 }
00346             }
00347           else
00348             {
00349               len = ACE_OS::strlen (arg->arg_);
00350               // Copy the argument into buf_
00351               ACE_OS::memcpy ((void *) ptr,
00352                               (const void *) (arg->arg_),
00353                               len * sizeof (CHAR_TYPE));
00354               // Move the pointer down.
00355               ptr += len;
00356             }
00357           *ptr++ = '"';
00358         }
00359       else
00360         {
00361           len = ACE_OS::strlen (arg->arg_);
00362           // Copy the argument into buf_
00363           ACE_OS::memcpy ((void *) ptr,
00364                           (const void *) (arg->arg_),
00365                           len * sizeof (CHAR_TYPE));
00366           // Move the pointer down.
00367           ptr += len;
00368         }
00369 
00370       // Put in an argument separating space.
00371       *ptr++ = ' ';
00372     }
00373 
00374   // Put in the NUL terminator
00375   ptr[-1] = '\0';
00376 
00377   return 0;
00378 }

template<typename CHAR_TYPE>
void ACE_ARGV_T< CHAR_TYPE >::dump ( void   )  const

Dump the state of this object.

Definition at line 39 of file ARGV.cpp.

References ACE_BEGIN_DUMP, ACE_DEBUG, ACE_END_DUMP, ACE_TEXT, ACE_TRACE, ACE_ARGV_T< CHAR_TYPE >::argc_, ACE_ARGV_T< CHAR_TYPE >::argv(), and LM_DEBUG.

00040 {
00041 #if defined (ACE_HAS_DUMP)
00042   ACE_TRACE ("ACE_ARGV_T::dump");
00043 
00044   ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this));
00045   ACE_DEBUG ((LM_DEBUG,  ACE_TEXT ("argc_ = %d"), this->argc_));
00046 
00047   ACE_ARGV *this_obj = const_cast<ACE_ARGV *> (this);
00048 
00049   for (int i = 0; i < this->argc_; i++)
00050     ACE_DEBUG ((LM_DEBUG,
00051                 ACE_TEXT ("\nargv_[%i] = %s"),
00052                 i,
00053                 this_obj->argv ()[i]));
00054 
00055   ACE_DEBUG ((LM_DEBUG,  ACE_TEXT ("\nbuf = %s\n"), this->buf_));
00056   ACE_DEBUG ((LM_DEBUG,  ACE_TEXT ("\n")));
00057   ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP));
00058 #endif /* ACE_HAS_DUMP */
00059 }

template<typename CHAR_TYPE>
ACE_ARGV_T ACE_ARGV_T< CHAR_TYPE >::operator= ( const ACE_ARGV_T< CHAR_TYPE > &   )  [private]

Assignment operator not implemented.

template<typename CHAR_TYPE>
ACE_INLINE const CHAR_TYPE * ACE_ARGV_T< CHAR_TYPE >::operator[] ( size_t  index  ) 

Returns the specified element of the current argument vector.

Parameters:
index Index to the desired element.
Return values:
Pointer to the indexed string.
0 if index is out of bounds.

Definition at line 92 of file ARGV.inl.

References ACE_TRACE, and ACE_ARGV_T< CHAR_TYPE >::argv().

00093 {
00094   ACE_TRACE ("ACE_ARGV_T::operator[]");
00095 
00096   // Don't go out of bounds.
00097   if (i >= static_cast<size_t> (this->argc_))
00098     return 0;
00099 
00100   return (const CHAR_TYPE *) this->argv ()[i];
00101 }

template<typename CHAR_TYPE>
int ACE_ARGV_T< CHAR_TYPE >::string_to_argv ( void   )  [private]

Converts buf_ into the CHAR_TYPE *argv[] format.

Definition at line 68 of file ARGV.cpp.

References ACE_TRACE, and ACE_OS::string_to_argv().

00069 {
00070   ACE_TRACE ("ACE_ARGV_T::string_to_argv");
00071 
00072   return ACE_OS::string_to_argv (this->buf_,
00073                                  this->argc_,
00074                                  this->argv_,
00075                                  this->substitute_env_args_);
00076 }


Member Data Documentation

template<typename CHAR_TYPE>
ACE_ARGV_T< CHAR_TYPE >::ACE_ALLOC_HOOK_DECLARE

Definition at line 237 of file ARGV.h.

template<typename CHAR_TYPE>
int ACE_ARGV_T< CHAR_TYPE >::argc_ [private]

Number of arguments in the ARGV array.

Definition at line 297 of file ARGV.h.

Referenced by ACE_ARGV_T< CHAR_TYPE >::ACE_ARGV_T(), ACE_ARGV_T< CHAR_TYPE >::add(), ACE_ARGV_T< CHAR_TYPE >::argc(), and ACE_ARGV_T< CHAR_TYPE >::dump().

template<typename CHAR_TYPE>
CHAR_TYPE** ACE_ARGV_T< CHAR_TYPE >::argv_ [private]

The array of string arguments.

Definition at line 300 of file ARGV.h.

Referenced by ACE_ARGV_T< CHAR_TYPE >::add(), ACE_ARGV_T< CHAR_TYPE >::argv(), and ACE_ARGV_T< CHAR_TYPE >::~ACE_ARGV_T().

template<typename CHAR_TYPE>
CHAR_TYPE* ACE_ARGV_T< CHAR_TYPE >::buf_ [private]

Buffer containing the <argv> contents.

Definition at line 303 of file ARGV.h.

Referenced by ACE_ARGV_T< CHAR_TYPE >::add(), ACE_ARGV_T< CHAR_TYPE >::buf(), and ACE_ARGV_T< CHAR_TYPE >::create_buf_from_queue().

template<typename CHAR_TYPE>
bool ACE_ARGV_T< CHAR_TYPE >::iterative_ [private]

Definition at line 294 of file ARGV.h.

template<typename CHAR_TYPE>
size_t ACE_ARGV_T< CHAR_TYPE >::length_ [private]

Total length of the arguments in the queue, not counting separating spaces

Definition at line 307 of file ARGV.h.

Referenced by ACE_ARGV_T< CHAR_TYPE >::add().

template<typename CHAR_TYPE>
ACE_Unbounded_Queue<ACE_ARGV_Queue_Entry_T<CHAR_TYPE> > ACE_ARGV_T< CHAR_TYPE >::queue_ [private]

Queue which keeps user supplied arguments. This is only active in the "iterative" mode.

Definition at line 311 of file ARGV.h.

template<typename CHAR_TYPE>
bool ACE_ARGV_T< CHAR_TYPE >::substitute_env_args_ [private]

Replace args with environment variable values?

Definition at line 292 of file ARGV.h.


The documentation for this class was generated from the following files:
Generated on Tue Feb 2 17:34:54 2010 for ACE by  doxygen 1.4.7