mirror of
https://github.com/mangosfour/server.git
synced 2025-12-13 22:37:03 +00:00
[10643] Update the ACE part we use to 5.8.2
Signed-off-by: Neo2003 <Neo.2003@Hotmail.fr>
This commit is contained in:
parent
8f71d95c0d
commit
23c920ca4b
739 changed files with 22031 additions and 40373 deletions
|
|
@ -1,10 +1,7 @@
|
|||
// $Id: SString.cpp 80826 2008-03-04 14:51:23Z wotte $
|
||||
// $Id: SString.cpp 91368 2010-08-16 13:03:34Z mhengstmengel $
|
||||
|
||||
#include "ace/Malloc_T.h"
|
||||
#include "ace/OS_Memory.h"
|
||||
#if !defined (ACE_HAS_WINCE)
|
||||
//# include "ace/Service_Config.h"
|
||||
#endif /* !ACE_HAS_WINCE */
|
||||
#include "ace/SString.h"
|
||||
#include "ace/Auto_Ptr.h"
|
||||
#include "ace/OS_NS_string.h"
|
||||
|
|
@ -20,11 +17,6 @@
|
|||
#endif /* __ACE_INLINE__ */
|
||||
|
||||
|
||||
ACE_RCSID (ace,
|
||||
SString,
|
||||
"SString.cpp,v 4.61 2001/03/04 00:55:30 brunsch Exp")
|
||||
|
||||
|
||||
// ************************************************************
|
||||
|
||||
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
|
||||
|
|
@ -336,212 +328,6 @@ ACE_SString::substring (size_type offset,
|
|||
|
||||
// ************************************************************
|
||||
|
||||
ACE_Tokenizer::ACE_Tokenizer (ACE_TCHAR *buffer)
|
||||
: buffer_ (buffer),
|
||||
index_ (0),
|
||||
preserves_index_ (0),
|
||||
delimiter_index_ (0)
|
||||
{
|
||||
}
|
||||
|
||||
int
|
||||
ACE_Tokenizer::delimiter (ACE_TCHAR d)
|
||||
{
|
||||
if (delimiter_index_ == MAX_DELIMITERS)
|
||||
return -1;
|
||||
|
||||
delimiters_[delimiter_index_].delimiter_ = d;
|
||||
delimiters_[delimiter_index_].replace_ = 0;
|
||||
delimiter_index_++;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
ACE_Tokenizer::delimiter_replace (ACE_TCHAR d,
|
||||
ACE_TCHAR replacement)
|
||||
{
|
||||
// Make it possible to replace delimiters on-the-fly, e.g., parse
|
||||
// string until certain token count and then copy rest of the
|
||||
// original string.
|
||||
for (int i = 0; i < delimiter_index_; i++)
|
||||
if (delimiters_[i].delimiter_ == d)
|
||||
{
|
||||
delimiters_[i].replacement_ = replacement;
|
||||
delimiters_[i].replace_ = 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (delimiter_index_ >= MAX_DELIMITERS)
|
||||
return -1;
|
||||
|
||||
delimiters_[delimiter_index_].delimiter_ = d;
|
||||
delimiters_[delimiter_index_].replacement_ = replacement;
|
||||
delimiters_[delimiter_index_].replace_ = 1;
|
||||
delimiter_index_++;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
ACE_Tokenizer::preserve_designators (ACE_TCHAR start,
|
||||
ACE_TCHAR stop,
|
||||
int strip)
|
||||
{
|
||||
if (preserves_index_ == MAX_PRESERVES)
|
||||
return -1;
|
||||
|
||||
preserves_[preserves_index_].start_ = start;
|
||||
preserves_[preserves_index_].stop_ = stop;
|
||||
preserves_[preserves_index_].strip_ = strip;
|
||||
preserves_index_++;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
ACE_Tokenizer::is_delimiter (ACE_TCHAR d,
|
||||
int &replace,
|
||||
ACE_TCHAR &r)
|
||||
{
|
||||
replace = 0;
|
||||
|
||||
for (int x = 0; x < delimiter_index_; x++)
|
||||
if (delimiters_[x].delimiter_ == d)
|
||||
{
|
||||
if (delimiters_[x].replace_)
|
||||
{
|
||||
r = delimiters_[x].replacement_;
|
||||
replace = 1;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
ACE_Tokenizer::is_preserve_designator (ACE_TCHAR start,
|
||||
ACE_TCHAR &stop,
|
||||
int &strip)
|
||||
{
|
||||
for (int x = 0; x < preserves_index_; x++)
|
||||
if (preserves_[x].start_ == start)
|
||||
{
|
||||
stop = preserves_[x].stop_;
|
||||
strip = preserves_[x].strip_;
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
ACE_TCHAR *
|
||||
ACE_Tokenizer::next (void)
|
||||
{
|
||||
// Check if the previous pass was the last one in the buffer.
|
||||
if (index_ == -1)
|
||||
{
|
||||
index_ = 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
ACE_TCHAR replacement = 0;
|
||||
int replace;
|
||||
ACE_TCHAR *next_token;
|
||||
|
||||
// Skip all leading delimiters.
|
||||
for (;;)
|
||||
{
|
||||
// Check for end of string.
|
||||
if (buffer_[index_] == '\0')
|
||||
{
|
||||
// If we hit EOS at the start, return 0.
|
||||
index_ = 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (this->is_delimiter (buffer_[index_],
|
||||
replace,
|
||||
replacement))
|
||||
index_++;
|
||||
else
|
||||
break;
|
||||
}
|
||||
|
||||
// When we reach this point, buffer_[index_] is a non-delimiter and
|
||||
// not EOS - the start of our next_token.
|
||||
next_token = buffer_ + index_;
|
||||
|
||||
// A preserved region is it's own token.
|
||||
ACE_TCHAR stop;
|
||||
int strip;
|
||||
if (this->is_preserve_designator (buffer_[index_],
|
||||
stop,
|
||||
strip))
|
||||
{
|
||||
while (++index_)
|
||||
{
|
||||
if (buffer_[index_] == '\0')
|
||||
{
|
||||
index_ = -1;
|
||||
goto EXIT_LABEL;
|
||||
}
|
||||
|
||||
if (buffer_[index_] == stop)
|
||||
break;
|
||||
}
|
||||
|
||||
if (strip)
|
||||
{
|
||||
// Skip start preserve designator.
|
||||
next_token += 1;
|
||||
// Zap the stop preserve designator.
|
||||
buffer_[index_] = '\0';
|
||||
// Increment to the next token.
|
||||
index_++;
|
||||
}
|
||||
|
||||
goto EXIT_LABEL;
|
||||
}
|
||||
|
||||
// Step through finding the next delimiter or EOS.
|
||||
for (;;)
|
||||
{
|
||||
// Advance pointer.
|
||||
index_++;
|
||||
|
||||
// Check for delimiter.
|
||||
if (this->is_delimiter (buffer_[index_],
|
||||
replace,
|
||||
replacement))
|
||||
{
|
||||
// Replace the delimiter.
|
||||
if (replace != 0)
|
||||
buffer_[index_] = replacement;
|
||||
|
||||
// Move the pointer up and return.
|
||||
index_++;
|
||||
goto EXIT_LABEL;
|
||||
}
|
||||
|
||||
// A preserve designator signifies the end of this token.
|
||||
if (this->is_preserve_designator (buffer_[index_],
|
||||
stop,
|
||||
strip))
|
||||
goto EXIT_LABEL;
|
||||
|
||||
// Check for end of string.
|
||||
if (buffer_[index_] == '\0')
|
||||
{
|
||||
index_ = -1;
|
||||
goto EXIT_LABEL;
|
||||
}
|
||||
}
|
||||
|
||||
EXIT_LABEL:
|
||||
return next_token;
|
||||
}
|
||||
|
||||
// *************************************************************
|
||||
|
||||
#if defined (ACE_HAS_EXPLICIT_STATIC_TEMPLATE_MEMBER_INSTANTIATION)
|
||||
template char ACE_String_Base<char>::NULL_String_;
|
||||
template ACE_WSTRING_TYPE ACE_String_Base<ACE_WSTRING_TYPE>::NULL_String_;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue