2 #include "ace/Global_Macros.h"
4 // Open versioned namespace, if enabled by the user.
5 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
7 template <typename CHAR_TYPE> ACE_INLINE
8 ACE_ARGV_Queue_Entry_T<CHAR_TYPE>::ACE_ARGV_Queue_Entry_T ()
15 template <typename CHAR_TYPE> ACE_INLINE
16 ACE_ARGV_Queue_Entry_T<CHAR_TYPE>::ACE_ARGV_Queue_Entry_T (const CHAR_TYPE *arg,
24 template <typename CHAR_TYPE> ACE_INLINE
25 ACE_ARGV_Queue_Entry_T<CHAR_TYPE>::ACE_ARGV_Queue_Entry_T (const ACE_ARGV_Queue_Entry_T<CHAR_TYPE> &entry)
27 quote_arg_(entry.quote_arg_)
32 // Return the number of args
33 template <typename CHAR_TYPE>
35 ACE_ARGV_T<CHAR_TYPE>::argc () const
37 ACE_TRACE ("ACE_ARGV_T::argc");
38 // Try to create the argv_ if it isn't there
39 ACE_ARGV_T<CHAR_TYPE> *nonconst_this =
40 const_cast <ACE_ARGV_T<CHAR_TYPE> *> (this);
41 (void) nonconst_this->argv ();
45 // Return the arguments in a space-separated string
46 template <typename CHAR_TYPE>
47 ACE_INLINE const CHAR_TYPE *
48 ACE_ARGV_T<CHAR_TYPE>::buf ()
50 ACE_TRACE ("ACE_ARGV_T::buf");
52 if (this->buf_ == 0 && this->iterative_)
53 this->create_buf_from_queue ();
55 return (const CHAR_TYPE *) this->buf_;
58 // Return the arguments in an entry-per-argument array
60 template <typename CHAR_TYPE>
61 ACE_INLINE CHAR_TYPE **
62 ACE_ARGV_T<CHAR_TYPE>::argv ()
64 ACE_TRACE ("ACE_ARGV_T::argv");
66 // Try to create the argv_ if it isn't there
69 if (this->iterative_ && this->buf_ == 0)
70 this->create_buf_from_queue ();
72 // Convert buf_ to argv_
73 if (this->string_to_argv () == -1)
74 return (CHAR_TYPE **) 0;
77 return (CHAR_TYPE **) this->argv_;
80 // Subscript operator.
82 template <typename CHAR_TYPE>
83 ACE_INLINE const CHAR_TYPE *
84 ACE_ARGV_T<CHAR_TYPE>::operator[] (size_t i)
86 ACE_TRACE ("ACE_ARGV_T::operator[]");
88 // Don't go out of bounds.
89 if (i >= static_cast<size_t> (this->argc_))
92 return (const CHAR_TYPE *) this->argv ()[i];
95 // Close versioned namespace, if enabled by the user.
96 ACE_END_VERSIONED_NAMESPACE_DECL