ACE_Tokenizer Class ReferenceTokenizer. More...
Collaboration diagram for ACE_Tokenizer:
![]()
Detailed DescriptionTokenizer.Tokenizes a buffer. Allows application to set delimiters and preserve designators. Does not allow special characters, yet (e.g., printf ("\"like a quoted string\"")). Member Enumeration Documentation
Constructor & Destructor Documentation
buffer will be parsed. Notice that ACE_Tokenizer will modify buffer if you use
Member Function Documentation
d is a delimiter.
char buf[30]; ACE_OS::strcpy(buf, "William/Joseph/Hagins"); ACE_Tokenizer tok (buf); tok.delimiter ('/'); for (char *p = tok.next (); p; p = tok.next ()) cout << p << endl; This will print out: William/Joseph/Hagins Joseph/Hagins Hagins d is a delimiter and, when found, will be replaced by replacement.
char buf[30]; ACE_OS::strcpy(buf, "William/Joseph/Hagins"); ACE_Tokenizer tok (buf); tok.delimiter_replace ('/', 0); for (char *p = tok.next (); p; p = tok.next ()) cout << p << endl; This will print out: William Joseph Hagins Extract string between a pair of designator characters. For instance, quotes, or '(' and ')'. start specifies the begin designator. stop specifies the end designator. strip If strip == 1, then the preserve designators will be stripped from the tokens returned by next.
char buf[30]; ACE_OS::strcpy(buf, "William(Joseph)Hagins"); ACE_Tokenizer tok (buf); tok.preserve_designators ('(', ')', 0); for (char *p = tok.next (); p; p = tok.next ()) cout << p << endl; This will print out: William(Joseph)Hagins (Joseph)Hagins )Hagins Example with strip = 1: char buf[30]; ACE_OS::strcpy(buf, "William(Joseph)Hagins"); ACE_Tokenizer tok (buf); tok.preserve_designators ('(', ')', 1); for (char *p = tok.next (); p; p = tok.next ()) cout << p << endl; This will print out: William Joseph Hagins
Returns the next token.
Returns 1 if <d> is a delimiter, 0 otherwise. If <d> should be replaced with r, <replace> is set to 1, otherwise 0.
If <start> is a start preserve designator, returns 1 and sets <stop> to the stop designator. Returns 0 if <start> is not a preserve designator.
Member Data Documentation
The application can specify MAX_PRESERVES preserve designators.
Pointer to the next free spot in preserves_.
The tokenizer allows MAX_DELIMITERS number of delimiters.
Pointer to the next free space in delimiters_.
The documentation for this class was generated from the following files: Generated on Mon Sep 15 07:17:58 2008 for ACE by ![]() |