Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Related Pages  

ACE_ARGV Class Reference

Transforms a string <buf> into an style vector of strings or an style vector of string <buf>, performing environment variable substitutions if necessary. More...

#include <ARGV.h>

Collaboration diagram for ACE_ARGV:

Collaboration graph
[legend]
List of all members.

Public Types

enum  States { TO_STRING = 1, TO_PTR_ARRAY = 2, ITERATIVE = 3 }

Public Methods

 ACE_ARGV (const ACE_TCHAR buf[], int substitute_env_args = 1)
 ACE_ARGV (ACE_TCHAR *argv[], int substitute_env_args = 1)
 ACE_ARGV (ACE_TCHAR *first_argv[], ACE_TCHAR *second_argv[], int substitute_env_args =1)
 ACE_ARGV (int substitute_env_args = 1)
 ~ACE_ARGV (void)
 Destructor.

const ACE_TCHARoperator[] (size_t index)
 Returns the <index>th string in the ARGV array.

ACE_TCHAR** argv (void)
size_t argc (void) const
 Returns .

const ACE_TCHARbuf (void)
 Returns the <buf>. Caller should not delete this memory since the destructor will delete it.

void dump (void) const
 Dump the state of an object.

int add (const ACE_TCHAR *next_arg)
 Add another argument. This only works in the <ITERATIVE> state. Note that this method does not copy <next_arg>, but instead assumes ownership of it. Returns -1 on failure and 0 on success.

int add (ACE_TCHAR *argv[])
int state (void) const
 What state is this ACE_ARGV in?


Public Attributes

 ACE_ALLOC_HOOK_DECLARE
 Declare the dynamic allocation hooks.


Private Methods

int create_buf_from_queue (void)
 Creates buf_ from the queue, deletes previous buf_.

int string_to_argv (void)
 Converts buf_ into the ACE_TCHAR *argv[] format.

int argv_to_string (ACE_TCHAR **argv, ACE_TCHAR *&buf)
 Returns the string created from argv in buf and returns the number of arguments.


Private Attributes

int substitute_env_args_
 Replace args with environment variable values?

int state_
 Current state marker.

size_t argc_
 Number of arguments in the ARGV array.

ACE_TCHAR** argv_
 The array of string arguments.

ACE_TCHARbuf_
 Buffer containing the contents.

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

ACE_Unbounded_Queue<ACE_TCHAR *> queue_
 Queue which keeps user supplied arguments. This is only active in the "iterative" mode.


Detailed Description

Transforms a string <buf> into an style vector of strings or an style vector of string <buf>, performing environment variable substitutions if necessary.


Member Enumeration Documentation

enum ACE_ARGV::States
 

Enumeration values:
TO_STRING   ACE_ARGV converts buf[] to ACE_TCHAR *argv[].
TO_PTR_ARRAY   ACE_ARGV converts ACE_TCHAR *argv[] to buf[].
ITERATIVE   Builds buf[] or ACE_TCHAR *argv[] iteratively with .


Constructor & Destructor Documentation

ACE_ARGV::ACE_ARGV ( const ACE_TCHAR buf[],
int substitute_env_args = 1 )
 

Converts <buf> into an -style vector of strings. If <substitute_env_args> is enabled then we'll substitute the environment variables for each $ENV encountered in the string. The subscript and operations are not allowed on an ACE_ARGV created this way.

ACE_ARGV::ACE_ARGV ( ACE_TCHAR * argv[],
int substitute_env_args = 1 )
 

Converts into a linear string. If <substitute_env_args> is enabled then we'll substitute the environment variables for each $ENV encountered in the string. The <buf> operation is not allowed on an ACE_ARGV created this way.

ACE_ARGV::ACE_ARGV ( ACE_TCHAR * first_argv[],
ACE_TCHAR * second_argv[],
int substitute_env_args = 1 )
 

Creates an ACE_ARGV which is the concatenation of the first_argv and the second argv. The argv arguments should be null pointer terminated.

ACE_ARGV::ACE_ARGV ( int substitute_env_args = 1 )
 

Entry point for creating an ACE_TCHAR *[] command line iteratively via the method. When this constructor is used, the <ITERATIVE> state is enabled. The and <buf> methods are allowed, and the result is recreated when called multiple times. The subscript operator is not allowed.

ACE_ARGV::~ACE_ARGV ( void )
 

Destructor.


Member Function Documentation

int ACE_ARGV::add ( ACE_TCHAR * argv[] )
 

Add another array. The parameter must be NULL terminated. This only works in the <ITERATIVE> state. Returns -1 on failure and 0 on success.

int ACE_ARGV::add ( const ACE_TCHAR * next_arg )
 

Add another argument. This only works in the <ITERATIVE> state. Note that this method does not copy <next_arg>, but instead assumes ownership of it. Returns -1 on failure and 0 on success.

ACE_INLINE size_t ACE_ARGV::argc ( void ) const
 

Returns .

ACE_INLINE ACE_TCHAR ** ACE_ARGV::argv ( void )
 

Returns the array. Caller should not delete this memory since the destructor will delete it. If the caller modifies the array in the iterative mode, the changes are not saved to the queue.

int ACE_ARGV::argv_to_string ( ACE_TCHAR ** argv,
ACE_TCHAR *& buf ) [private]
 

Returns the string created from argv in buf and returns the number of arguments.

ACE_INLINE const ACE_TCHAR * ACE_ARGV::buf ( void )
 

Returns the <buf>. Caller should not delete this memory since the destructor will delete it.

int ACE_ARGV::create_buf_from_queue ( void ) [private]
 

Creates buf_ from the queue, deletes previous buf_.

void ACE_ARGV::dump ( void ) const
 

Dump the state of an object.

ACE_INLINE const ACE_TCHAR * ACE_ARGV::operator[] ( size_t i )
 

Returns the <index>th string in the ARGV array.

ACE_INLINE int ACE_ARGV::state ( void ) const
 

What state is this ACE_ARGV in?

int ACE_ARGV::string_to_argv ( void ) [private]
 

Converts buf_ into the ACE_TCHAR *argv[] format.


Member Data Documentation

ACE_ARGV::ACE_ALLOC_HOOK_DECLARE
 

Declare the dynamic allocation hooks.

size_t ACE_ARGV::argc_ [private]
 

Number of arguments in the ARGV array.

ACE_TCHAR ** ACE_ARGV::argv_ [private]
 

The array of string arguments.

ACE_TCHAR * ACE_ARGV::buf_ [private]
 

Buffer containing the contents.

size_t ACE_ARGV::length_ [private]
 

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

ACE_Unbounded_Queue< ACE_TCHAR *> ACE_ARGV::queue_ [private]
 

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

int ACE_ARGV::state_ [private]
 

Current state marker.

int ACE_ARGV::substitute_env_args_ [private]
 

Replace args with environment variable values?


The documentation for this class was generated from the following files:
Generated at Sat Dec 1 11:00:39 2001 for ACE by doxygen1.2.3 written by Dimitri van Heesch, © 1997-2000