summaryrefslogtreecommitdiff
path: root/cpp/src
diff options
context:
space:
mode:
Diffstat (limited to 'cpp/src')
-rw-r--r--cpp/src/Slice/CPlusPlusUtil.cpp17
-rw-r--r--cpp/src/slice2cppe/Gen.cpp24
-rw-r--r--cpp/src/slice2cppe/Makefile3
-rw-r--r--cpp/src/slice2cppe/Makefile.mak3
4 files changed, 39 insertions, 8 deletions
diff --git a/cpp/src/Slice/CPlusPlusUtil.cpp b/cpp/src/Slice/CPlusPlusUtil.cpp
index 39deb8bfe80..8c82abfb095 100644
--- a/cpp/src/Slice/CPlusPlusUtil.cpp
+++ b/cpp/src/Slice/CPlusPlusUtil.cpp
@@ -13,6 +13,8 @@ using namespace std;
using namespace Slice;
using namespace IceUtil;
+bool Slice::wstringDisabled = false;
+
char
Slice::ToIfdef::operator()(char c)
{
@@ -168,7 +170,7 @@ Slice::typeToString(const TypePtr& type, bool useWstring, const StringList& meta
if(builtin->kind() == Builtin::KindString)
{
string strType = findMetaData(metaData, true);
- if(strType != "string" && (useWstring || strType == "wstring"))
+ if(!wstringDisabled && strType != "string" && (useWstring || strType == "wstring"))
{
return "::std::wstring";
}
@@ -302,7 +304,7 @@ Slice::inputTypeToString(const TypePtr& type, bool useWstring, const StringList&
if(builtin->kind() == Builtin::KindString)
{
string strType = findMetaData(metaData, true);
- if(strType != "string" && (useWstring || strType == "wstring"))
+ if(!wstringDisabled && strType != "string" && (useWstring || strType == "wstring"))
{
return "const ::std::wstring&";
}
@@ -411,7 +413,7 @@ Slice::outputTypeToString(const TypePtr& type, bool useWstring, const StringList
if(builtin->kind() == Builtin::KindString)
{
string strType = findMetaData(metaData, true);
- if(strType != "string" && (useWstring || strType == "wstring"))
+ if(!wstringDisabled && strType != "string" && (useWstring || strType == "wstring"))
{
return "::std::wstring&";
}
@@ -1193,7 +1195,7 @@ Slice::writeStreamMarshalUnmarshalCode(Output& out, const TypePtr& type, const s
case Builtin::KindString:
{
string strType = findMetaData(metaData, true);
- if(strType != "string" && (useWstring || strType == "wstring"))
+ if(!wstringDisabled && strType != "string" && (useWstring || strType == "wstring"))
{
if(marshal)
{
@@ -1424,7 +1426,7 @@ Slice::writeStreamMarshalUnmarshalCode(Output& out, const TypePtr& type, const s
case Builtin::KindString:
{
string strType = findMetaData(seq->typeMetaData(), true);
- if(strType != "string" && (useWstring || strType == "wstring"))
+ if(!wstringDisabled && strType != "string" && (useWstring || strType == "wstring"))
{
if(marshal)
{
@@ -1573,6 +1575,11 @@ Slice::findMetaData(const StringList& metaData, bool inParam)
bool
Slice::inWstringModule(const SequencePtr& seq)
{
+ if(wstringDisabled)
+ {
+ return false;
+ }
+
ContainerPtr cont = seq->container();
while(cont)
{
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
diff --git a/cpp/src/slice2cppe/Makefile b/cpp/src/slice2cppe/Makefile
index fc4fd1b54c1..81187c033fb 100644
--- a/cpp/src/slice2cppe/Makefile
+++ b/cpp/src/slice2cppe/Makefile
@@ -21,6 +21,9 @@ SRCS = $(OBJS:.o=.cpp)
include $(top_srcdir)/config/Make.rules
CPPFLAGS := -I. $(CPPFLAGS)
+ifeq ($(ENABLE_WSTRING),yes)
+CPPFLAGS := -DENABLE_WSTRING $(CPPFLAGS)
+endif
$(NAME): $(OBJS)
rm -f $@
diff --git a/cpp/src/slice2cppe/Makefile.mak b/cpp/src/slice2cppe/Makefile.mak
index 8683451e02f..ffc3bde9c27 100644
--- a/cpp/src/slice2cppe/Makefile.mak
+++ b/cpp/src/slice2cppe/Makefile.mak
@@ -21,6 +21,9 @@ SRCS = $(OBJS:.obj=.cpp)
!include $(top_srcdir)/config/Make.rules.mak
CPPFLAGS = -I. $(CPPFLAGS) -DWIN32_LEAN_AND_MEAN
+!if "$(ENABLE_WSTRING)" != "yes"
+CPPFLAGS = -DENABLE_WSTRING $(CPPFLAGS)
+!endif
!if "$(CPP_COMPILER)" != "BCC2006" & "$(OPTIMIZE)" != "yes"
PDBFLAGS = /pdb:$(NAME:.exe=.pdb)