summaryrefslogtreecommitdiff
path: root/ace/SString.h
diff options
context:
space:
mode:
Diffstat (limited to 'ace/SString.h')
-rw-r--r--ace/SString.h214
1 files changed, 9 insertions, 205 deletions
diff --git a/ace/SString.h b/ace/SString.h
index b52c732ef55..c9a94c7165e 100644
--- a/ace/SString.h
+++ b/ace/SString.h
@@ -39,6 +39,12 @@ ACE_BEGIN_VERSIONED_NAMESPACE_DECL
#if defined ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION_EXPORT
template class ACE_Export ACE_String_Base<char>;
template class ACE_Export ACE_String_Base<ACE_WSTRING_TYPE>;
+
+template class ACE_Export ACE_String_Base_Iterator<char>;
+template class ACE_Export ACE_String_Base_Iterator<ACE_WSTRING_TYPE>;
+
+template class ACE_Export ACE_String_Base_Const_Iterator<char>;
+template class ACE_Export ACE_String_Base_Const_Iterator<ACE_WSTRING_TYPE>;
#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION_EXPORT */
/**
@@ -196,7 +202,7 @@ public:
/// slot of the first location that matches, else @c npos.
size_type strstr (const ACE_SString &s) const;
- /// Find <str> starting at pos. Returns the slot of the first
+ /// Find @a str starting at pos. Returns the slot of the first
/// location that matches (will be >= pos), else npos.
size_type find (const ACE_SString &str, size_type pos = 0) const;
@@ -204,11 +210,11 @@ public:
/// location that matches (will be >= pos), else npos.
size_type find (const char *s, size_type pos = 0) const;
- /// Find <c> starting at pos. Returns the slot of the first
+ /// Find @a c starting at pos. Returns the slot of the first
/// location that matches (will be >= pos), else npos.
size_type find (char c, size_type pos = 0) const;
- /// Find <c> starting at pos (counting from the end). Returns the
+ /// Find @a c starting at pos (counting from the end). Returns the
/// slot of the first location that matches, else npos.
size_type rfind (char c, size_type pos = npos) const;
@@ -256,208 +262,6 @@ typedef ACE_WString ACE_TString;
typedef ACE_CString ACE_TString;
#endif /* ACE_USES_WCHAR */
-
-// ************************************************************
-
-/**
- * @class ACE_Tokenizer
- *
- * @brief Tokenizer
- *
- * Tokenizes a buffer. Allows application to set delimiters and
- * preserve designators. Does not allow special characters, yet
- * (e.g., printf ("\"like a quoted string\"")).
- */
-class ACE_Export ACE_Tokenizer
-{
-public:
- /**
- * \a buffer will be parsed. Notice that ACE_Tokenizer will modify
- * \a buffer if you use <code> delimiter_replace </code> or <code>
- * preserve_designators </code> to do character substitution.
- * @note You should NOT pass a constant string or string literal
- * to this constructor, since ACE_Tokenizer will try to modify
- * the string.
- * \sa preserve_designators
- * \sa preserve_designators
- */
- ACE_Tokenizer (ACE_TCHAR *buffer);
-
- /**
- * \a d is a delimiter.
- * \return Returns 0 on success, -1 if there is no memory left.
- *
- * <B>Example:</B>
- * \verbatim
- 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;
- \endverbatim
- *
- * This will print out:
- * \verbatim
- William/Joseph/Hagins
- Joseph/Hagins
- Hagins \endverbatim
- */
- int delimiter (ACE_TCHAR d);
-
- /**
- * \a d is a delimiter and, when found, will be replaced by
- * \a replacement.
- * \return 0 on success, -1 if there is no memory left.
- *
- * <B>Example:</B>
- * \verbatim
- 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;
- \endverbatim
- *
- * This will print out:
- * \verbatim
- William
- Joseph
- Hagins \endverbatim
- */
- int delimiter_replace (ACE_TCHAR d, ACE_TCHAR replacement);
-
- /**
- * Extract string between a pair of designator characters.
- * For instance, quotes, or '(' and ')'.
- * \a start specifies the begin designator.
- * \a stop specifies the end designator.
- * \a strip If \a strip == 1, then the preserve
- * designators will be stripped from the tokens returned by next.
- * \return 0 on success, -1 if there is no memory left.
- *
- * <B>Example with strip = 0:</B>
- * \verbatim
- 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;
- \endverbatim
- *
- * This will print out:
- * \verbatim
- William(Joseph)Hagins
- (Joseph)Hagins
- )Hagins \endverbatim
- *
- * <B>Example with strip = 1:</B>
- * \verbatim
- 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;
- \endverbatim
- *
- * This will print out:
- * \verbatim
- William
- Joseph
- Hagins \endverbatim
- */
- int preserve_designators (ACE_TCHAR start, ACE_TCHAR stop, int strip=1);
-
- /// Returns the next token.
- ACE_TCHAR *next (void);
-
- enum {
- MAX_DELIMITERS=16,
- MAX_PRESERVES=16
- };
-
-protected:
- /// Returns 1 if <d> is a delimiter, 0 otherwise. If <d> should be
- /// replaced with @a r, <replace> is set to 1, otherwise 0.
- int is_delimiter (ACE_TCHAR d, int &replace, ACE_TCHAR &r);
-
- /**
- * 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.
- */
- int is_preserve_designator (ACE_TCHAR start, ACE_TCHAR &stop, int &strip);
-
- ACE_TCHAR *buffer_;
- int index_;
-
- /**
- * @class Preserve_Entry
- *
- * @brief Preserve Entry
- *
- * Defines a set of characters that designate an area that
- * should not be parsed, but should be treated as a complete
- * token. For instance, in: (this is a preserve region), start
- * would be a left paren -(- and stop would be a right paren
- * -)-. The strip determines whether the designators should be
- * removed from the token.
- */
- class Preserve_Entry
- {
- public:
- /**
- * E.g., "(".
- * E.g., ")".
- * Whether the designators should be removed from the token.
- */
- ACE_TCHAR start_;
- ACE_TCHAR stop_;
- int strip_;
- };
-
- /// The application can specify MAX_PRESERVES preserve designators.
- Preserve_Entry preserves_[MAX_PRESERVES];
-
- /// Pointer to the next free spot in preserves_.
- int preserves_index_;
-
- /**
- * @class Delimiter_Entry
- *
- * @brief Delimiter Entry
- *
- * Describes a delimiter for the tokenizer.
- */
- class Delimiter_Entry
- {
- public:
- /**
- * Most commonly a space ' '.
- * What occurrences of delimiter_ should be replaced with.
- * Whether replacement_ should be used. This should be replaced
- * with a technique that sets replacement_ = delimiter by
- * default. I'll do that next iteration.
- */
- ACE_TCHAR delimiter_;
- ACE_TCHAR replacement_;
- int replace_;
- };
-
- /// The tokenizer allows MAX_DELIMITERS number of delimiters.
- Delimiter_Entry delimiters_[MAX_DELIMITERS];
-
- /// Pointer to the next free space in delimiters_.
- int delimiter_index_;
-};
-
// ****************************************************************
/**