diff options
author | Matthew Newhook <matthew@zeroc.com> | 2002-03-11 22:02:55 +0000 |
---|---|---|
committer | Matthew Newhook <matthew@zeroc.com> | 2002-03-11 22:02:55 +0000 |
commit | 3484c4950e009ed88ece455eae23c64914d7d405 (patch) | |
tree | c6e1e11fdb1f568312ebb6b2be1aa5e428312f37 /cpp/src/slice2freeze/Main.cpp | |
parent | fixes for MemoryLimitException (diff) | |
download | ice-3484c4950e009ed88ece455eae23c64914d7d405.tar.bz2 ice-3484c4950e009ed88ece455eae23c64914d7d405.tar.xz ice-3484c4950e009ed88ece455eae23c64914d7d405.zip |
Backout XML stuff from Freeze - this change belonged in the FreezeXML
branch - not the mainline.
Diffstat (limited to 'cpp/src/slice2freeze/Main.cpp')
-rw-r--r-- | cpp/src/slice2freeze/Main.cpp | 36 |
1 files changed, 15 insertions, 21 deletions
diff --git a/cpp/src/slice2freeze/Main.cpp b/cpp/src/slice2freeze/Main.cpp index a10d7492b97..ef34ac40ed1 100644 --- a/cpp/src/slice2freeze/Main.cpp +++ b/cpp/src/slice2freeze/Main.cpp @@ -9,11 +9,12 @@ // ********************************************************************** #include <Slice/CPlusPlusUtil.h> +#include <IceUtil/OutputUtil.h> #include <fstream> using namespace std; -using namespace Slice; using namespace IceUtil; +using namespace Slice; struct Dict { @@ -87,39 +88,33 @@ writeCodecH(const TypePtr& type, const string& name, const string& freezeType, O H << sp << nl << "public:"; H << sp; H.inc(); - H << nl << "static void write(" << inputTypeToString(type) << ", Freeze::" << freezeType - << "&, const ::Ice::CommunicatorPtr&);"; - H << nl << "static void read(" << typeToString(type) << "&, const Freeze::" << freezeType << "&, " - << "const ::Ice::CommunicatorPtr&);"; + H << nl << "static void write(" << inputTypeToString(type) + << ", Freeze::" << freezeType << "& bytes, const ::Ice::CommunicatorPtr& communicator);"; + H << nl << "static void read(" << typeToString(type) << "&, const Freeze::" << freezeType << "& bytes, " + << "const ::Ice::CommunicatorPtr& communicator);"; H << eb << ';'; } void writeCodecC(const TypePtr& type, const string& name, const string& freezeType, Output& C) { - string tagName = "\""; - tagName += freezeType; - tagName += "\""; - C << sp << nl << "void" << nl << name << "::write(" << inputTypeToString(type) << " v, " << "Freeze::" << freezeType << "& bytes, const ::Ice::CommunicatorPtr& communicator)"; C << sb; - C << nl << "::std::ostringstream os;"; - C << nl << "os << \"<data>\";"; - C << nl << "::Ice::StreamPtr stream = new ::IceXML::StreamI(communicator, os);"; - writeGenericMarshalUnmarshalCode(C, type, "v", true, tagName, "stream", true); - C << nl << "os << \"\\n</data>\";"; - C << nl << "bytes.resize(os.str().size());"; - C << nl << "memcpy(&bytes[0], os.str().data(), os.str().size());"; + C << nl << "IceInternal::InstancePtr instance = IceInternal::getInstance(communicator);"; + C << nl << "IceInternal::BasicStream stream(instance);"; + writeMarshalUnmarshalCode(C, type, "v", true, "stream", false); + C << nl << "bytes = stream.b;"; C << eb; C << sp << nl << "void" << nl << name << "::read(" << typeToString(type) << "& v, " << "const Freeze::" << freezeType << "& bytes, const ::Ice::CommunicatorPtr& communicator)"; C << sb; - C << nl << "::std::string data(bytes.begin(), bytes.end());"; - C << nl << "::std::istringstream is(data);"; - C << nl << "::Ice::StreamPtr stream = new ::IceXML::StreamI(communicator, is, false);"; - writeGenericMarshalUnmarshalCode(C, type, "v", false, tagName, "stream", true); + C << nl << "IceInternal::InstancePtr instance = IceInternal::getInstance(communicator);"; + C << nl << "IceInternal::BasicStream stream(instance);"; + C << nl << "stream.b = bytes;"; + C << nl << "stream.i = stream.b.begin();"; + writeMarshalUnmarshalCode(C, type, "v", false, "stream", false); C << eb; } @@ -504,7 +499,6 @@ main(int argc, char* argv[]) } C << "\n#include <Ice/BasicStream.h>"; - C << "\n#include <IceXML/StreamI.h>"; C << "\n#include <"; if (include.size()) { |