summaryrefslogtreecommitdiff
path: root/cppe/src/IceE/BasicStream.cpp
diff options
context:
space:
mode:
authorDwayne Boone <dwayne@zeroc.com>2007-03-26 14:49:01 +0000
committerDwayne Boone <dwayne@zeroc.com>2007-03-26 14:49:01 +0000
commit737b4f7ae612af1d35b17c50dc2ed20aa7e62f25 (patch)
tree4fed4b1451ec87ac5b3fae5df5c5454a814190f9 /cppe/src/IceE/BasicStream.cpp
parentTemporary fix (diff)
downloadice-737b4f7ae612af1d35b17c50dc2ed20aa7e62f25.tar.bz2
ice-737b4f7ae612af1d35b17c50dc2ed20aa7e62f25.tar.xz
ice-737b4f7ae612af1d35b17c50dc2ed20aa7e62f25.zip
Removed StringConverter
Diffstat (limited to 'cppe/src/IceE/BasicStream.cpp')
-rw-r--r--cppe/src/IceE/BasicStream.cpp134
1 files changed, 6 insertions, 128 deletions
diff --git a/cppe/src/IceE/BasicStream.cpp b/cppe/src/IceE/BasicStream.cpp
index 52a91cf632e..534a438d220 100644
--- a/cppe/src/IceE/BasicStream.cpp
+++ b/cppe/src/IceE/BasicStream.cpp
@@ -1298,65 +1298,7 @@ IceInternal::BasicStream::write(const char*)
*/
void
-IceInternal::BasicStream::writeConverted(const string& v)
-{
- //
- // What is the size of the resulting UTF-8 encoded string?
- // Impossible to tell, so we guess. If we don't guess correctly,
- // we'll have to fix the mistake afterwards
- //
-
- Int guessedSize = static_cast<Int>(v.size());
- writeSize(guessedSize); // writeSize() only writes the size; it does not reserve any buffer space.
-
- size_t firstIndex = b.size();
- StreamUTF8BufferI buffer(*this);
-
- Byte* lastByte = _stringConverter->toUTF8(v.data(), v.data() + v.size(), buffer);
- if(lastByte != b.end())
- {
- b.resize(lastByte - b.begin());
- }
- size_t lastIndex = b.size();
-
- Int actualSize = static_cast<Int>(lastIndex - firstIndex);
-
- //
- // Check against the guess
- //
- if(guessedSize != actualSize)
- {
- if(guessedSize <= 254 && actualSize > 254)
- {
- //
- // Move the UTF-8 sequence 4 bytes further
- // Use memmove instead of memcpy since the source and destination typically overlap.
- //
- resize(b.size() + 4);
- memmove(b.begin() + firstIndex + 4, b.begin() + firstIndex, actualSize);
- }
- else if(guessedSize > 254 && actualSize <= 254)
- {
- //
- // Move the UTF-8 sequence 4 bytes back
- //
- memmove(b.begin() + firstIndex - 4, b.begin() + firstIndex, actualSize);
- resize(b.size() - 4);
- }
-
- if(guessedSize <= 254)
- {
- rewriteSize(actualSize, b.begin() + firstIndex - 1);
- }
- else
- {
- rewriteSize(actualSize, b.begin() + firstIndex - 1 - 4);
- }
- }
-}
-
-void
-IceInternal::BasicStream::write(const string* begin, const string* end, bool convert)
+IceInternal::BasicStream::write(const string* begin, const string* end)
{
Int sz = static_cast<Int>(end - begin);
writeSize(sz);
@@ -1364,13 +1306,13 @@ IceInternal::BasicStream::write(const string* begin, const string* end, bool con
{
for(int i = 0; i < sz; ++i)
{
- write(begin[i], convert);
+ write(begin[i]);
}
}
}
void
-IceInternal::BasicStream::read(vector<string>& v, bool convert)
+IceInternal::BasicStream::read(vector<string>& v)
{
Int sz;
readSize(sz);
@@ -1380,7 +1322,7 @@ IceInternal::BasicStream::read(vector<string>& v, bool convert)
v.resize(sz);
for(int i = 0; i < sz; ++i)
{
- read(v[i], convert);
+ read(v[i]);
checkSeq();
endElement();
}
@@ -1393,70 +1335,6 @@ IceInternal::BasicStream::read(vector<string>& v, bool convert)
}
void
-IceInternal::BasicStream::write(const wstring& v)
-{
- if(v.size() == 0)
- {
- writeSize(0);
- return;
- }
-
- //
- // What is the size of the resulting UTF-8 encoded string?
- // Impossible to tell, so we guess. If we don't guess correctly,
- // we'll have to fix the mistake afterwards
- //
-
- Int guessedSize = static_cast<Int>(v.size());
- writeSize(guessedSize); // writeSize() only writes the size; it does not reserve any buffer space.
-
- size_t firstIndex = b.size();
- StreamUTF8BufferI buffer(*this);
-
- Byte* lastByte = _wstringConverter->toUTF8(v.data(), v.data() + v.size(), buffer);
- if(lastByte != b.end())
- {
- b.resize(lastByte - b.begin());
- }
- size_t lastIndex = b.size();
-
- Int actualSize = static_cast<Int>(lastIndex - firstIndex);
-
- //
- // Check against the guess
- //
- if(guessedSize != actualSize)
- {
- if(guessedSize <= 254 && actualSize > 254)
- {
- //
- // Move the UTF-8 sequence 4 bytes further
- // Use memmove instead of memcpy since the source and destination typically overlap.
- //
- resize(b.size() + 4);
- memmove(b.begin() + firstIndex + 4, b.begin() + firstIndex, actualSize);
- }
- else if(guessedSize > 254 && actualSize <= 254)
- {
- //
- // Move the UTF-8 sequence 4 bytes back
- //
- memmove(b.begin() + firstIndex - 4, b.begin() + firstIndex, actualSize);
- resize(b.size() - 4);
- }
-
- if(guessedSize <= 254)
- {
- rewriteSize(actualSize, b.begin() + firstIndex - 1);
- }
- else
- {
- rewriteSize(actualSize, b.begin() + firstIndex - 1 - 4);
- }
- }
-}
-
-void
IceInternal::BasicStream::write(const wstring* begin, const wstring* end)
{
Int sz = static_cast<Int>(end - begin);
@@ -1519,7 +1397,7 @@ IceInternal::BasicStream::throwException()
read(usesClasses);
string id;
- read(id, false);
+ read(id);
for(;;)
{
//
@@ -1547,7 +1425,7 @@ IceInternal::BasicStream::throwException()
else
{
skipSlice(); // Slice off what we don't understand.
- read(id, false); // Read type id for next slice.
+ read(id); // Read type id for next slice.
}
}