summaryrefslogtreecommitdiff
path: root/cpp/src/slice2cppe/Gen.cpp
diff options
context:
space:
mode:
authorDwayne Boone <dwayne@zeroc.com>2007-05-02 19:10:37 +0000
committerDwayne Boone <dwayne@zeroc.com>2007-05-02 19:10:37 +0000
commit86839148a2cfe69ad748cc89bb9911b7ac1762b7 (patch)
tree43b5bf2e51260241ae6860764ca97e9bf6c16c6d /cpp/src/slice2cppe/Gen.cpp
parentRemoving JDK 1.1.8 code from the makedist.py script. (diff)
downloadice-86839148a2cfe69ad748cc89bb9911b7ac1762b7.tar.bz2
ice-86839148a2cfe69ad748cc89bb9911b7ac1762b7.tar.xz
ice-86839148a2cfe69ad748cc89bb9911b7ac1762b7.zip
MAke wstring optional for IceE
Diffstat (limited to 'cpp/src/slice2cppe/Gen.cpp')
-rw-r--r--cpp/src/slice2cppe/Gen.cpp24
1 files changed, 21 insertions, 3 deletions
diff --git a/cpp/src/slice2cppe/Gen.cpp b/cpp/src/slice2cppe/Gen.cpp
index da37ebd44fb..5d367cefcfb 100644
--- a/cpp/src/slice2cppe/Gen.cpp
+++ b/cpp/src/slice2cppe/Gen.cpp
@@ -67,6 +67,10 @@ Slice::Gen::Gen(const string& name, const string& base, const string& headerExte
_impl(imp),
_ice(ice)
{
+#ifndef ENABLE_WSTRING
+ Slice::wstringDisabled = true;
+#endif
+
for(vector<string>::iterator p = _includePaths.begin(); p != _includePaths.end(); ++p)
{
if(p->length() && (*p)[p->length() - 1] != '/')
@@ -640,7 +644,7 @@ Slice::Gen::TypesVisitor::visitExceptionEnd(const ExceptionPtr& p)
H << nl << "virtual void __read(::IceInternal::BasicStream*, bool);";
C << sp << nl << "void" << nl << scoped.substr(2) << "::__write(::IceInternal::BasicStream* __os) const";
C << sb;
- C << nl << "__os->write(::std::string(\"" << p->scoped() << "\"));";
+ C << nl << "__os->write(::std::string(\"" << p->scoped() << "\"), false);";
C << nl << "__os->startWriteSlice();";
for(q = dataMembers.begin(); q != dataMembers.end(); ++q)
{
@@ -658,7 +662,7 @@ Slice::Gen::TypesVisitor::visitExceptionEnd(const ExceptionPtr& p)
C << nl << "if(__rid)";
C << sb;
C << nl << "::std::string myId;";
- C << nl << "__is->read(myId);";
+ C << nl << "__is->read(myId, false);";
C << eb;
C << nl << "__is->startReadSlice();";
for(q = dataMembers.begin(); q != dataMembers.end(); ++q)
@@ -1149,10 +1153,12 @@ Slice::Gen::TypesVisitor::visitConst(const ConstPtr& p)
"_{}[]#()<>%:;.?*+-/^&|~!=,\\\"' ";
static const set<char> charSet(basicSourceChars.begin(), basicSourceChars.end());
+#ifdef ENABLE_WSTRING
if(_useWstring || findMetaData(p->typeMetaData(), true) == "wstring")
{
H << 'L';
}
+#endif
H << "\""; // Opening "
const string val = p->value();
@@ -2908,7 +2914,11 @@ Slice::Gen::MetaDataVisitor::validate(const SyntaxTreeBasePtr& cont, const Strin
if(s.find(prefix) == 0)
{
string ss = s.substr(prefix.size());
- if(ss.find("type:wstring") == 0 || ss.find("type:string") == 0)
+ if(ss.find("type:string") == 0
+#ifdef ENABLE_WSTRING
+ || ss.find("type:wstring") == 0
+#endif
+ )
{
BuiltinPtr builtin = BuiltinPtr::dynamicCast(cont);
ModulePtr module = ModulePtr::dynamicCast(cont);
@@ -2944,6 +2954,7 @@ Slice::Gen::validateMetaData(const UnitPtr& u)
bool
Slice::Gen::setUseWstring(ContainedPtr p, list<bool>& hist, bool use)
{
+#ifdef ENABLE_WSTRING
hist.push_back(use);
StringList metaData = p->getMetaData();
if(find(metaData.begin(), metaData.end(), "cpp:type:wstring") != metaData.end())
@@ -2955,14 +2966,21 @@ Slice::Gen::setUseWstring(ContainedPtr p, list<bool>& hist, bool use)
use = false;
}
return use;
+#else
+ return false;
+#endif
}
bool
Slice::Gen::resetUseWstring(list<bool>& hist)
{
+#ifdef ENABLE_WSTRING
bool use = hist.back();
hist.pop_back();
return use;
+#else
+ return false;
+#endif
}
void