#include <ARGV.h>
Collaboration diagram for ACE_ARGV_T< CHAR_TYPE >:
Public Member Functions | |
ACE_ARGV_T (const CHAR_TYPE buf[], bool substitute_env_args=true) | |
ACE_ARGV_T (CHAR_TYPE *argv[], bool substitute_env_args=true) | |
ACE_ARGV_T (CHAR_TYPE *first_argv[], CHAR_TYPE *second_argv[], bool substitute_env_args=true) | |
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) |
int | add (CHAR_TYPE *argv[]) |
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. | |
int | argv_to_string (CHAR_TYPE **argv, CHAR_TYPE *&buf) |
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< CHAR_TYPE * > | queue_ |
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.
ACE_ARGV_T< CHAR_TYPE >::ACE_ARGV_T | ( | const CHAR_TYPE | buf[], | |
bool | substitute_env_args = true | |||
) |
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 (").
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. |
ACE_ARGV_T< CHAR_TYPE >::ACE_ARGV_T | ( | CHAR_TYPE * | argv[], | |
bool | substitute_env_args = true | |||
) |
Initializes the argument vector from a set of arguments. Any environment variable references are translated (if applicable) during execution of this method.
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. |
ACE_ARGV_T< CHAR_TYPE >::ACE_ARGV_T | ( | CHAR_TYPE * | first_argv[], | |
CHAR_TYPE * | second_argv[], | |||
bool | substitute_env_args = true | |||
) |
Initializes the argument vector from two combined argument vectors.
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. |
ACE_ARGV_T< CHAR_TYPE >::ACE_ARGV_T | ( | bool | substitute_env_args = true |
) |
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.
ACE_ARGV_T< CHAR_TYPE >::~ACE_ARGV_T | ( | void | ) |
Destructor.
ACE_ARGV_T< CHAR_TYPE >::ACE_ARGV_T | ( | const ACE_ARGV_T< CHAR_TYPE > & | ) | [private] |
Copy constructor not implemented.
int ACE_ARGV_T< CHAR_TYPE >::add | ( | CHAR_TYPE * | argv[] | ) |
Add an array of arguments. This only works in the iterative mode.
argv | Pointers to the arguments to add to the vector. argv must be terminated by a 0 pointer. |
0 | on success; -1 on failure. Most likely errno values are:
|
int ACE_ARGV_T< CHAR_TYPE >::add | ( | const CHAR_TYPE * | next_arg | ) |
Add another argument. This only works in the iterative mode.
next_arg | Pointer to the next argument to add to the vector. |
0 | on success; -1 on failure. Most likely errno values are:
|
ACE_BEGIN_VERSIONED_NAMESPACE_DECL ACE_INLINE int ACE_ARGV_T< CHAR_TYPE >::argc | ( | void | ) | const |
Returns the current number of arguments.
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.
int ACE_ARGV_T< CHAR_TYPE >::argv_to_string | ( | CHAR_TYPE ** | argv, | |
CHAR_TYPE *& | buf | |||
) | [private] |
Returns the string created from argv in buf and returns the number of arguments.
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.
int ACE_ARGV_T< CHAR_TYPE >::create_buf_from_queue | ( | void | ) | [private] |
Creates buf_ from the queue of added args, deletes previous buf_.
ACE_BEGIN_VERSIONED_NAMESPACE_DECL void ACE_ARGV_T< CHAR_TYPE >::dump | ( | void | ) | const |
Dump the state of this object.
ACE_ARGV_T ACE_ARGV_T< CHAR_TYPE >::operator= | ( | const ACE_ARGV_T< CHAR_TYPE > & | ) | [private] |
Assignment operator not implemented.
ACE_INLINE const CHAR_TYPE * ACE_ARGV_T< CHAR_TYPE >::operator[] | ( | size_t | index | ) |
Returns the specified element of the current argument vector.
index | Index to the desired element. |
Pointer | to the indexed string. | |
0 | if index is out of bounds. |
int ACE_ARGV_T< CHAR_TYPE >::string_to_argv | ( | void | ) | [private] |
Converts buf_ into the CHAR_TYPE *argv[] format.
ACE_ARGV_T< CHAR_TYPE >::ACE_ALLOC_HOOK_DECLARE |
int ACE_ARGV_T< CHAR_TYPE >::argc_ [private] |
Number of arguments in the ARGV array.
CHAR_TYPE** ACE_ARGV_T< CHAR_TYPE >::argv_ [private] |
The array of string arguments.
CHAR_TYPE* ACE_ARGV_T< CHAR_TYPE >::buf_ [private] |
Buffer containing the <argv> contents.
bool ACE_ARGV_T< CHAR_TYPE >::iterative_ [private] |
size_t ACE_ARGV_T< CHAR_TYPE >::length_ [private] |
Total length of the arguments in the queue, not counting separating spaces
ACE_Unbounded_Queue<CHAR_TYPE *> ACE_ARGV_T< CHAR_TYPE >::queue_ [private] |
Queue which keeps user supplied arguments. This is only active in the "iterative" mode.
bool ACE_ARGV_T< CHAR_TYPE >::substitute_env_args_ [private] |
Replace args with environment variable values?