#include <FlowSpec_Entry.h>
Collaboration diagram for TAO_Tokenizer:
Public Member Functions | |
TAO_Tokenizer (const char *string, char delimiter) | |
constructor. | |
~TAO_Tokenizer (void) | |
destructor. | |
int | parse (const char *string, char delimiter) |
parses the string and tokenizes it. | |
char * | token (void) |
Returns the next token. | |
int | num_tokens (void) |
Number of tokens. | |
const char * | operator[] (size_t index) const |
Protected Attributes | |
ACE_Array< char * > | token_array_ |
size_t | count_ |
size_t | num_tokens_ |
char | string_ [BUFSIZ] |
|
constructor.
Definition at line 4429 of file AVStreams_i.cpp. References parse().
04430 :token_array_ (10), 04431 count_ (0) 04432 { 04433 this->parse (string, delimiter); 04434 } |
|
destructor.
Definition at line 4436 of file AVStreams_i.cpp. References num_tokens_, and CORBA::string_free().
04437 { 04438 for (unsigned int i=0; i<this->num_tokens_; i++) 04439 CORBA::string_free (this->token_array_[i]); 04440 } |
|
Number of tokens.
Definition at line 4512 of file AVStreams_i.cpp. References num_tokens_. Referenced by TAO_Forward_FlowSpec_Entry::parse(), and TAO_FlowSpec_Entry::parse_address().
04513 { 04514 return static_cast<int> (this->num_tokens_); 04515 } |
|
Definition at line 4518 of file AVStreams_i.cpp. References num_tokens_, and token_array_.
04519 { 04520 if (index >= this->num_tokens_) 04521 return 0; 04522 04523 return this->token_array_[index]; 04524 } |
|
parses the string and tokenizes it.
Definition at line 4444 of file AVStreams_i.cpp. References ACE_CString, ACE_ERROR_RETURN, LM_ERROR, num_tokens_, ACE_Array_Base< T >::set(), ACE_Array_Base< T >::size(), CORBA::string_dup(), token(), and token_array_. Referenced by TAO_Tokenizer().
04445 { 04446 ACE_CString new_string (string); 04447 u_int pos =0; 04448 ACE_CString::size_type slash_pos = 0; 04449 u_int count = 0; 04450 int result; 04451 while (pos < new_string.length ()) 04452 { 04453 slash_pos = new_string.find (delimiter, pos); 04454 ACE_CString substring; 04455 if (slash_pos != new_string.npos) 04456 { 04457 substring = new_string.substring (pos, 04458 slash_pos - pos); 04459 pos = slash_pos + 1; 04460 } 04461 else 04462 { 04463 substring = new_string.substring (pos); 04464 pos = static_cast<int> (new_string.length ()); 04465 } 04466 char *token = CORBA::string_dup (substring.c_str ()); 04467 result = this->token_array_.set (token, count); 04468 if (result == -1) 04469 { 04470 this->token_array_.size (this->token_array_.size ()*2); 04471 result = this->token_array_.set (token, count); 04472 if (result == -1) 04473 ACE_ERROR_RETURN ((LM_ERROR, "TAO_Tokenizer::parse error"), -1); 04474 } 04475 count++; 04476 } 04477 04478 /* 04479 ACE_OS::strcpy (this->string_ , string); 04480 char delimiter_str [2] = {0, 0}; 04481 delimiter_str [0] = delimiter; 04482 char *token = ACE_OS::strtok (this->string_, delimiter_str); 04483 04484 while (token != 0) 04485 { 04486 result = this->token_array_.set (token, count); 04487 if (result == -1) 04488 { 04489 this->token_array_.size (this->token_array_.size ()*2); 04490 result = this->token_array_.set (token, count); 04491 if (result == -1) 04492 ACE_ERROR_RETURN ((LM_ERROR, "TAO_Tokenizer::parse error"), -1); 04493 } 04494 token = ACE_OS::strtok (0, delimiter_str); 04495 count++; 04496 } 04497 */ 04498 this->num_tokens_ = count; 04499 return 0; 04500 } |
|
Returns the next token.
Definition at line 4503 of file AVStreams_i.cpp. References num_tokens_, and CORBA::string_dup(). Referenced by parse().
04504 { 04505 if (count_ < num_tokens_) 04506 return CORBA::string_dup (this->token_array_[this->count_++]); 04507 else 04508 return 0; 04509 } |
|
Definition at line 53 of file FlowSpec_Entry.h. |
|
Definition at line 54 of file FlowSpec_Entry.h. Referenced by num_tokens(), operator[](), parse(), token(), and ~TAO_Tokenizer(). |
|
Definition at line 55 of file FlowSpec_Entry.h. |
|
Definition at line 52 of file FlowSpec_Entry.h. Referenced by operator[](), and parse(). |