diff options
author | Mark Spruiell <mes@zeroc.com> | 2003-10-20 17:15:20 +0000 |
---|---|---|
committer | Mark Spruiell <mes@zeroc.com> | 2003-10-20 17:15:20 +0000 |
commit | a2320d3f0936d0a3fb6526ca604dbe2ee5e66221 (patch) | |
tree | 1712a0b42f4918b9220ec1aa3466891aebe7d11c /cpp/src/slice2freeze/Main.cpp | |
parent | file gcC.dsp was initially added on branch gc. (diff) | |
download | ice-a2320d3f0936d0a3fb6526ca604dbe2ee5e66221.tar.bz2 ice-a2320d3f0936d0a3fb6526ca604dbe2ee5e66221.tar.xz ice-a2320d3f0936d0a3fb6526ca604dbe2ee5e66221.zip |
encapsulate database values
Diffstat (limited to 'cpp/src/slice2freeze/Main.cpp')
-rw-r--r-- | cpp/src/slice2freeze/Main.cpp | 23 |
1 files changed, 19 insertions, 4 deletions
diff --git a/cpp/src/slice2freeze/Main.cpp b/cpp/src/slice2freeze/Main.cpp index eccbe8b6fa4..8e6bfc0508c 100644 --- a/cpp/src/slice2freeze/Main.cpp +++ b/cpp/src/slice2freeze/Main.cpp @@ -104,7 +104,7 @@ writeCodecH(const TypePtr& type, const string& name, const string& freezeType, O } void -writeCodecC(const TypePtr& type, const string& name, const string& freezeType, Output& C) +writeCodecC(const TypePtr& type, const string& name, const string& freezeType, bool encaps, Output& C) { string quotedFreezeType = "\"" + freezeType + "\""; @@ -113,15 +113,22 @@ writeCodecC(const TypePtr& type, const string& name, const string& freezeType, O C << sb; C << nl << "IceInternal::InstancePtr instance = IceInternal::getInstance(communicator);"; C << nl << "IceInternal::BasicStream stream(instance.get());"; + if(encaps) + { + C << nl << "stream.startWriteEncaps();"; + } writeMarshalUnmarshalCode(C, type, "v", true, "stream", false); if(type->usesClasses()) { C << nl << "stream.writePendingObjects();"; } + if(encaps) + { + C << nl << "stream.endWriteEncaps();"; + } C << nl << "bytes.swap(stream.b);"; C << eb; - C << sp << nl << "void" << nl << name << "::read(" << typeToString(type) << "& v, " << "const Freeze::" << freezeType << "& bytes, const ::Ice::CommunicatorPtr& communicator)"; C << sb; @@ -129,11 +136,19 @@ writeCodecC(const TypePtr& type, const string& name, const string& freezeType, O C << nl << "IceInternal::BasicStream stream(instance.get());"; C << nl << "stream.b = bytes;"; C << nl << "stream.i = stream.b.begin();"; + if(encaps) + { + C << nl << "stream.startReadEncaps();"; + } writeMarshalUnmarshalCode(C, type, "v", false, "stream", false); if(type->usesClasses()) { C << nl << "stream.readPendingObjects();"; } + if(encaps) + { + C << nl << "stream.endReadEncaps();"; + } C << eb; } @@ -202,8 +217,8 @@ writeCodecs(const string& n, UnitPtr& u, const Dict& dict, Output& H, Output& C, H << nl << '}'; } - writeCodecC(keyType, absolute + "KeyCodec", "Key", C); - writeCodecC(valueType, absolute + "ValueCodec", "Value", C); + writeCodecC(keyType, absolute + "KeyCodec", "Key", false, C); + writeCodecC(valueType, absolute + "ValueCodec", "Value", true, C); return true; } |