diff options
author | Bernard Normier <bernard@zeroc.com> | 2016-11-02 17:56:08 -0400 |
---|---|---|
committer | Bernard Normier <bernard@zeroc.com> | 2016-11-02 17:56:08 -0400 |
commit | 91fa99c34d1211d426b24bf68001fc27a87b3f00 (patch) | |
tree | 15af995f00414098b678b4cff09a9f0c29830fa8 /cpp/src/Slice/CPlusPlusUtil.cpp | |
parent | Add C# code sign support (diff) | |
download | ice-91fa99c34d1211d426b24bf68001fc27a87b3f00.tar.bz2 ice-91fa99c34d1211d426b24bf68001fc27a87b3f00.tar.xz ice-91fa99c34d1211d426b24bf68001fc27a87b3f00.zip |
Replaced double and triple underscores in C++ by ice-prefixed names
Diffstat (limited to 'cpp/src/Slice/CPlusPlusUtil.cpp')
-rw-r--r-- | cpp/src/Slice/CPlusPlusUtil.cpp | 54 |
1 files changed, 29 insertions, 25 deletions
diff --git a/cpp/src/Slice/CPlusPlusUtil.cpp b/cpp/src/Slice/CPlusPlusUtil.cpp index 4ae02b9372f..bbdff8765af 100644 --- a/cpp/src/Slice/CPlusPlusUtil.cpp +++ b/cpp/src/Slice/CPlusPlusUtil.cpp @@ -217,7 +217,7 @@ writeParamAllocateCode(Output& out, const TypePtr& type, bool optional, const st { s = toOptional(s, typeCtx); } - out << nl << s << " ___" << fixedName << ";"; + out << nl << s << " iceP_" << fixedName << ";"; } } } @@ -228,7 +228,7 @@ writeParamEndCode(Output& out, const TypePtr& type, bool optional, const string& { string objPrefix = obj.empty() ? obj : obj + "."; string paramName = objPrefix + fixedName; - string escapedParamName = objPrefix + "___" + fixedName; + string escapedParamName = objPrefix + "iceP_" + fixedName; SequencePtr seq = SequencePtr::dynamicCast(type); if(seq) @@ -269,7 +269,7 @@ writeParamEndCode(Output& out, const TypePtr& type, bool optional, const string& { out << nl << "if(" << escapedParamName << ")"; out << sb; - out << nl << paramName << ".__setIsSet();"; + out << nl << paramName << ".iceSetIsSet();"; out << nl << "if(!" << escapedParamName << "->empty())"; out << sb; out << nl << paramName << "->first" << " = &(*" << escapedParamName << ")[0];"; @@ -301,7 +301,7 @@ writeParamEndCode(Output& out, const TypePtr& type, bool optional, const string& { out << nl << "if(" << escapedParamName << ")"; out << sb; - out << nl << paramName << ".__setIsSet();"; + out << nl << paramName << ".iceSetIsSet();"; out << nl << paramName << "->first = (*" << escapedParamName << ").begin();"; out << nl << paramName << "->second = (*" << escapedParamName << ").end();"; out << eb; @@ -317,10 +317,12 @@ writeParamEndCode(Output& out, const TypePtr& type, bool optional, const string& void writeMarshalUnmarshalParams(Output& out, const ParamDeclList& params, const OperationPtr& op, bool marshal, - bool prepend, int typeCtx, const string& retP = "", const string& obj = "") + bool prepend, int typeCtx, const string& retP = "", const string& obj = "", + const string& stream = "") { string prefix = prepend ? paramPrefix : ""; - string returnValueS = retP.empty() ? string("__ret") : retP; + string returnValueS = retP.empty() ? string("iceRet") : retP; + string streamTarget = stream.empty() ? (marshal ? "iceOs" : "iceIs") : stream; string objPrefix = obj.empty() ? obj : obj + "."; @@ -351,11 +353,11 @@ writeMarshalUnmarshalParams(Output& out, const ParamDeclList& params, const Oper out << nl; if(marshal) { - out << "__os->writeAll"; + out << streamTarget << "->writeAll"; } else { - out << "__is->readAll"; + out << streamTarget << "->readAll"; } out << spar; for(ParamDeclList::const_iterator p = requiredParams.begin(); p != requiredParams.end(); ++p) @@ -407,11 +409,11 @@ writeMarshalUnmarshalParams(Output& out, const ParamDeclList& params, const Oper out << nl; if(marshal) { - out << "__os->writeAll"; + out << streamTarget << "->writeAll"; } else { - out << "__is->readAll"; + out << streamTarget << "->readAll"; } out << spar; @@ -494,7 +496,7 @@ writeMarshalUnmarshalParams(Output& out, const ParamDeclList& params, const Oper } Slice::FeatureProfile Slice::featureProfile = Slice::Ice; -string Slice::paramPrefix = "__p_"; +string Slice::paramPrefix = "iceP_"; char Slice::ToIfdef::operator()(char c) @@ -1255,7 +1257,7 @@ Slice::writeMarshalUnmarshalCode(Output& out, const TypePtr& type, bool optional ostringstream os; if(str.empty()) { - os << (marshal ? "__os" : "__is"); + os << (marshal ? "iceOs" : "iceIs"); } else { @@ -1302,13 +1304,13 @@ Slice::writeMarshalUnmarshalCode(Output& out, const TypePtr& type, bool optional return; } - out << nl << func << objPrefix << "___" << param << ");"; + out << nl << func << objPrefix << "iceP_" << param << ");"; writeParamEndCode(out, seq, optional, param, metaData, obj); return; } else if(seqType.find("%range") == 0) { - out << nl << func << objPrefix << "___" << param << ");"; + out << nl << func << objPrefix << "iceP_" << param << ");"; writeParamEndCode(out, seq, optional, param, metaData, obj); return; } @@ -1319,9 +1321,10 @@ Slice::writeMarshalUnmarshalCode(Output& out, const TypePtr& type, bool optional } void -Slice::writeMarshalCode(Output& out, const ParamDeclList& params, const OperationPtr& op, bool prepend, int typeCtx) +Slice::writeMarshalCode(Output& out, const ParamDeclList& params, const OperationPtr& op, bool prepend, int typeCtx, + const string& streamTarget) { - writeMarshalUnmarshalParams(out, params, op, true, prepend, typeCtx); + writeMarshalUnmarshalParams(out, params, op, true, prepend, typeCtx, "", "", streamTarget); } void @@ -1335,7 +1338,7 @@ void Slice::writeAllocateCode(Output& out, const ParamDeclList& params, const OperationPtr& op, bool prepend, int typeCtx) { string prefix = prepend ? paramPrefix : ""; - string returnValueS = "__ret"; + string returnValueS = "iceRet"; for(ParamDeclList::const_iterator p = params.begin(); p != params.end(); ++p) { @@ -1373,11 +1376,11 @@ Slice::getEndArg(const TypePtr& type, const StringList& metaData, const string& builtin->kind() != Builtin::KindObject && builtin->kind() != Builtin::KindObjectProxy) { - endArg = "___" + endArg; + endArg = "iceP_" + endArg; } else if(!builtin || builtin->kind() != Builtin::KindByte) { - endArg = "___" + endArg; + endArg = "iceP_" + endArg; } } else if(seqType.find("%range") == 0) @@ -1387,7 +1390,7 @@ Slice::getEndArg(const TypePtr& type, const StringList& metaData, const string& { md.push_back("cpp:type:" + seqType.substr(strlen("%range:"))); } - endArg = "___" + endArg; + endArg = "iceP_" + endArg; } } return endArg; @@ -1403,7 +1406,7 @@ Slice::writeEndCode(Output& out, const ParamDeclList& params, const OperationPtr } if(op && op->returnType()) { - writeParamEndCode(out, op->returnType(), op->returnIsOptional(), "__ret", op->getMetaData()); + writeParamEndCode(out, op->returnType(), op->returnIsOptional(), "iceRet", op->getMetaData()); } } @@ -1429,7 +1432,7 @@ Slice::writeMarshalUnmarshalAllInHolder(IceUtilInternal::Output& out, return; } - string stream = marshal ? "__os" : "__is"; + string stream = marshal ? "iceOs" : "iceIs"; string streamOp = marshal ? "writeAll" : "readAll"; out << nl << stream << "->" << streamOp; @@ -1519,15 +1522,15 @@ Slice::writeStreamHelpers(Output& out, out << nl << "template<typename S>"; out << nl << "struct StreamWriter" << (cpp11 ? "<" : "< ") << fullName << ", S>"; out << sb; + if(requiredMembers.empty() && optionalMembers.empty()) { out << nl << "static void write(S*, const " << fullName << "&)"; } else { - out << nl << "static void write(S* __os, const " << fullName << "& v)"; + out << nl << "static void write(S* iceOs, const " << fullName << "& v)"; } - out << sb; if(cpp11) @@ -1558,13 +1561,14 @@ Slice::writeStreamHelpers(Output& out, out << nl << "template<typename S>"; out << nl << "struct StreamReader" << (cpp11 ? "<" : "< ") << fullName << ", S>"; out << sb; + if (requiredMembers.empty() && optionalMembers.empty()) { out << nl << "static void read(S*, " << fullName << "&)"; } else { - out << nl << "static void read(S* __is, " << fullName << "& v)"; + out << nl << "static void read(S* iceIs, " << fullName << "& v)"; } out << sb; |