aboutsummaryrefslogtreecommitdiff
path: root/dep/ACE_wrappers/ace/SString.h
diff options
context:
space:
mode:
authormaximius <none@none>2009-10-17 15:35:07 -0700
committermaximius <none@none>2009-10-17 15:35:07 -0700
commit26b5e033ffde3d161382fc9addbfa99738379641 (patch)
treea344f369ca32945f787a02dee35c3dbe342bed7e /dep/ACE_wrappers/ace/SString.h
parentf21f47005dcb6b76e1abc9f35fbcd03eed191bff (diff)
*Massive cleanup (\n\n -> \n, *\n -> \n, cleanup for(...) to for (...), and some other cleanups by hand)
*Fix a possible crash in Spell::DoAllEffectOnTarget --HG-- branch : trunk
Diffstat (limited to 'dep/ACE_wrappers/ace/SString.h')
-rw-r--r--dep/ACE_wrappers/ace/SString.h87
1 files changed, 0 insertions, 87 deletions
diff --git a/dep/ACE_wrappers/ace/SString.h b/dep/ACE_wrappers/ace/SString.h
index b888521ba86..d6187b3481f 100644
--- a/dep/ACE_wrappers/ace/SString.h
+++ b/dep/ACE_wrappers/ace/SString.h
@@ -1,5 +1,4 @@
// -*- C++ -*-
-
//=============================================================================
/**
* @file SString.h
@@ -9,23 +8,17 @@
* @author Douglas C. Schmidt (schmidt@cs.wustl.edu)
*/
//=============================================================================
-
#ifndef ACE_SSTRING_H
#define ACE_SSTRING_H
#include /**/ "ace/pre.h"
-
#include "ace/SStringfwd.h"
-
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
-
#include "ace/String_Base.h"
-
#if !defined (ACE_DEFAULT_GROWSIZE)
#define ACE_DEFAULT_GROWSIZE 32
#endif /* ACE_DEFAULT_GROWSIZE */
-
#if !defined (ACE_LACKS_IOSTREAM_TOTALLY)
#include "ace/iosfwd.h"
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
@@ -33,14 +26,11 @@ ACE_Export ACE_OSTREAM_TYPE &operator << (ACE_OSTREAM_TYPE &, const ACE_CString
ACE_Export ACE_OSTREAM_TYPE &operator << (ACE_OSTREAM_TYPE &, const ACE_WString &);
ACE_END_VERSIONED_NAMESPACE_DECL
#endif /* ! ACE_LACKS_IOSTREAM_TOTALLY */
-
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>;
#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION_EXPORT */
-
/**
* @class ACE_NS_WString
*
@@ -52,20 +42,15 @@ template class ACE_Export ACE_String_Base<ACE_WSTRING_TYPE>;
class ACE_Export ACE_NS_WString : public ACE_WString
{
public:
-
using ACE_WString::size_type;
-
/// Default constructor.
ACE_NS_WString (ACE_Allocator *alloc = 0);
-
/// Constructor that copies @a s into dynamically allocated memory.
ACE_NS_WString (const char *s,
ACE_Allocator *alloc = 0);
-
/// Constructor that copies @a s into dynamically allocated memory.
ACE_NS_WString (const ACE_WSTRING_TYPE *s,
ACE_Allocator *alloc = 0);
-
#if defined (ACE_WSTRING_HAS_USHORT_SUPPORT)
/// Constructor that takes in a ushort16 string (mainly used by the
/// ACE Name_Space classes)
@@ -73,38 +58,29 @@ public:
size_type len,
ACE_Allocator *alloc = 0);
#endif /* ACE_WSTRING_HAS_USHORT_SUPPORT */
-
/// Constructor that copies @a len ACE_WSTRING_TYPE's of @a s into dynamically
/// allocated memory (will NUL terminate the result).
ACE_NS_WString (const ACE_WSTRING_TYPE *s,
size_type len,
ACE_Allocator *alloc = 0);
-
/// Constructor that dynamically allocates memory for @a len + 1
/// ACE_WSTRING_TYPE characters. The newly created memory is set memset to 0.
ACE_NS_WString (size_type len, ACE_Allocator *alloc = 0);
-
/// Copy constructor.
ACE_NS_WString (const ACE_NS_WString &s);
-
/// Constructor that copies @a c into dynamically allocated memory.
ACE_NS_WString (ACE_WSTRING_TYPE c, ACE_Allocator *alloc = 0);
-
/// Transform into a copy of the ASCII character representation.
/// (caller must delete)
char *char_rep (void) const;
-
/// Transform into a copy of a USHORT16 representation (caller must
/// delete). Note, behavior is undefined when sizeof (wchar_t) != 2.
ACE_USHORT16 *ushort_rep (void) const;
};
-
ACE_Export
ACE_NS_WString operator + (const ACE_NS_WString &,
const ACE_NS_WString &);
-
// -----------------------------------------------------------------
-
/**
* @class ACE_SString
*
@@ -127,127 +103,91 @@ ACE_NS_WString operator + (const ACE_NS_WString &,
class ACE_Export ACE_SString
{
public:
-
typedef ACE_Allocator::size_type size_type;
-
/// No position constant
static const size_type npos;
-
/// Default constructor.
ACE_SString (ACE_Allocator *alloc = 0);
-
/// Constructor that copies @a s into dynamically allocated memory.
ACE_SString (const char *s, ACE_Allocator *alloc = 0);
-
/// Constructor that copies @a len chars of @s into dynamically
/// allocated memory (will NUL terminate the result).
ACE_SString (const char *s, size_type len, ACE_Allocator *alloc = 0);
-
/// Copy constructor.
ACE_SString (const ACE_SString &);
-
/// Constructor that copies @a c into dynamically allocated memory.
ACE_SString (char c, ACE_Allocator *alloc = 0);
-
/// Default destructor.
~ACE_SString (void);
-
/// Return the <slot'th> character in the string (doesn't perform
/// bounds checking).
char operator [] (size_type slot) const;
-
/// Return the <slot'th> character by reference in the string
/// (doesn't perform bounds checking).
char &operator [] (size_type slot);
-
/// Assignment operator (does copy memory).
ACE_SString &operator = (const ACE_SString &);
-
/**
* Return a substring given an offset and length, if length == npos
* use rest of str return empty substring if offset or offset/length
* are invalid
*/
ACE_SString substring (size_type offset, size_type length = npos) const;
-
/// Same as substring
ACE_SString substr (size_type offset, size_type length = npos) const;
-
/// Returns a hash value for this string.
u_long hash (void) const;
-
/// Return the length of the string.
size_type length (void) const;
-
/// Set the underlying pointer. Since this does not copy memory or
/// delete existing memory use with extreme caution!!!
void rep (char *s);
-
/// Get the underlying pointer.
const char *rep (void) const;
-
/// Get the underlying pointer.
const char *fast_rep (void) const;
-
/// Same as STL String's <c_str> and <fast_rep>.
const char *c_str (void) const;
-
/// Comparison operator that will match substrings. Returns the
/// 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
/// location that matches (will be >= pos), else npos.
size_type find (const ACE_SString &str, size_type pos = 0) const;
-
/// Find <s> starting at pos. Returns the slot of the first
/// 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
/// 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
/// slot of the first location that matches, else npos.
size_type rfind (char c, size_type pos = npos) const;
-
/// Equality comparison operator (must match entire string).
bool operator == (const ACE_SString &s) const;
-
/// Less than comparison operator.
bool operator < (const ACE_SString &s) const;
-
/// Greater than comparison operator.
bool operator > (const ACE_SString &s) const;
-
/// Inequality comparison operator.
bool operator != (const ACE_SString &s) const;
-
/// Performs a <strcmp>-style comparison.
int compare (const ACE_SString &s) const;
-
/// Dump the state of an object.
void dump (void) const;
-
/// Declare the dynamic allocation hooks.
ACE_ALLOC_HOOK_DECLARE;
-
private:
/// Pointer to a memory allocator.
ACE_Allocator *allocator_;
-
/// Length of the ACE_SString (not counting the trailing '\0').
size_type len_;
-
/// Pointer to data.
char *rep_;
};
-
#if !defined (ACE_LACKS_IOSTREAM_TOTALLY)
ACE_Export ACE_OSTREAM_TYPE &operator << (ACE_OSTREAM_TYPE &, const ACE_SString &);
#endif /* ! ACE_LACKS_IOSTREAM_TOTALLY */
-
// This allows one to use W or C String based on the Unicode
// setting
#if defined (ACE_USES_WCHAR)
@@ -256,9 +196,7 @@ typedef ACE_WString ACE_TString;
typedef ACE_CString ACE_TString;
#endif /* ACE_USES_WCHAR */
-
// ************************************************************
-
/**
* @class ACE_Tokenizer
*
@@ -282,7 +220,6 @@ public:
* \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.
@@ -291,7 +228,6 @@ public:
* \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 ())
@@ -305,7 +241,6 @@ public:
Hagins \endverbatim
*/
int delimiter (ACE_TCHAR d);
-
/**
* \a d is a delimiter and, when found, will be replaced by
* \a replacement.
@@ -315,7 +250,6 @@ public:
* \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 ())
@@ -329,7 +263,6 @@ public:
Hagins \endverbatim
*/
int delimiter_replace (ACE_TCHAR d, ACE_TCHAR replacement);
-
/**
* Extract string between a pair of designator characters.
* For instance, quotes, or '(' and ')'.
@@ -343,7 +276,6 @@ public:
* \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 ())
@@ -360,7 +292,6 @@ public:
* \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 ())
@@ -374,30 +305,24 @@ public:
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
*
@@ -422,13 +347,10 @@ protected:
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
*
@@ -450,16 +372,12 @@ protected:
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_;
};
-
// ****************************************************************
-
/**
* @class ACE_Auto_String_Free
*
@@ -478,23 +396,18 @@ public:
ACE_Auto_String_Free (ACE_Auto_String_Free &rhs);
ACE_Auto_String_Free& operator= (ACE_Auto_String_Free &rhs);
~ACE_Auto_String_Free (void);
-
char* operator* () const;
char operator[] (size_t i) const;
char* get (void) const;
char* release (void);
void reset (char* p = 0);
-
private:
char* p_;
};
-
ACE_END_VERSIONED_NAMESPACE_DECL
-
#if defined (__ACE_INLINE__)
#include "ace/SString.inl"
#endif /* __ACE_INLINE__ */
-
#include /**/ "ace/post.h"
#endif /* ACE_SSTRING_H */