diff options
Diffstat (limited to 'cpp/src')
-rw-r--r-- | cpp/src/Slice/OutputUtil.cpp | 92 | ||||
-rw-r--r-- | cpp/src/Slice/OutputUtil.h | 20 | ||||
-rw-r--r-- | cpp/src/slice2cpp/Gen.cpp | 100 |
3 files changed, 106 insertions, 106 deletions
diff --git a/cpp/src/Slice/OutputUtil.cpp b/cpp/src/Slice/OutputUtil.cpp index 5a34d525bfc..63fe83d2c90 100644 --- a/cpp/src/Slice/OutputUtil.cpp +++ b/cpp/src/Slice/OutputUtil.cpp @@ -31,21 +31,21 @@ Separator sp; Slice::Output::Output() : _pos(0), _indent(0), - _separator(true),
- _blockStart("{"),
- _blockEnd("}"),
- _useTab(true),
- _indentSize(4)
+ _separator(true), + _blockStart("{"), + _blockEnd("}"), + _useTab(true), + _indentSize(4) { } Slice::Output::Output(const char* s) : _pos(0), _indent(0), - _separator(true),
- _blockStart("{"),
- _blockEnd("}"),
- _useTab(true),
+ _separator(true), + _blockStart("{"), + _blockEnd("}"), + _useTab(true), _indentSize(4) { open(s); @@ -107,30 +107,30 @@ Slice::Output::restoreIndent() _indent = _indentSave.top(); _indentSave.pop(); } -
-void
-Slice::Output::setBeginBlock(const char *bb)
-{
- _blockStart = bb;
-}
-
-void
-Slice::Output::setEndBlock(const char *eb)
-{
- _blockEnd = eb;
-}
-
-void
-Slice::Output::setIndent(int indentSize)
-{
- _indentSize = indentSize;
-}
-
-void
-Slice::Output::setUseTab(bool useTab)
-{
- _useTab = useTab;
-}
+ +void +Slice::Output::setBeginBlock(const char *bb) +{ + _blockStart = bb; +} + +void +Slice::Output::setEndBlock(const char *eb) +{ + _blockEnd = eb; +} + +void +Slice::Output::setIndent(int indentSize) +{ + _indentSize = indentSize; +} + +void +Slice::Output::setUseTab(bool useTab) +{ + _useTab = useTab; +} void Slice::Output::nl() @@ -140,25 +140,25 @@ Slice::Output::nl() _separator = true; int indent = _indent; -
- if (_useTab)
- {
- while (indent >= 8)
- {
- indent -= 8;
- _out << '\t';
- _pos += 8;
- }
- }
- else
- {
+ + if (_useTab) + { + while (indent >= 8) + { + indent -= 8; + _out << '\t'; + _pos += 8; + } + } + else + { while (indent >= _indentSize) { indent -= _indentSize; _out << " "; _pos += _indentSize; } - }
+ } while (indent > 0) { diff --git a/cpp/src/Slice/OutputUtil.h b/cpp/src/Slice/OutputUtil.h index 1d0c477fc4d..866b50e3681 100644 --- a/cpp/src/Slice/OutputUtil.h +++ b/cpp/src/Slice/OutputUtil.h @@ -37,11 +37,11 @@ class ICE_API Output : ::IceInternal::noncopyable public: Output(); - Output(const char*);
-
- void setBeginBlock(const char *); // what do we use at block starts?
- void setEndBlock(const char *); // what do we use the block end?
- void setIndent(int); // what is the indent level?
+ Output(const char*); + + void setBeginBlock(const char *); // what do we use at block starts? + void setEndBlock(const char *); // what do we use the block end? + void setIndent(int); // what is the indent level? void setUseTab(bool); // should we output tabs? void open(const char*); // Open output stream @@ -68,11 +68,11 @@ private: int _pos; int _indent; std::stack<int> _indentSave; - bool _separator;
-
- std::string _blockStart;
- std::string _blockEnd;
- bool _useTab;
+ bool _separator; + + std::string _blockStart; + std::string _blockEnd; + bool _useTab; int _indentSize; }; diff --git a/cpp/src/slice2cpp/Gen.cpp b/cpp/src/slice2cpp/Gen.cpp index e4de966a3c8..8b86828b5f3 100644 --- a/cpp/src/slice2cpp/Gen.cpp +++ b/cpp/src/slice2cpp/Gen.cpp @@ -1341,58 +1341,58 @@ Slice::Gen::ObjectVisitor::visitClassDefEnd(const ClassDefPtr& p) C << nl << "return ::IceInternal::DispatchOperationNotExist;"; C << eb; } + H << sp; + H << nl << "virtual void __write(::IceInternal::Stream*);"; + H << nl << "virtual void __read(::IceInternal::Stream*);"; + TypeStringList memberList; + DataMemberList dataMembers = p->dataMembers(); + DataMemberList::const_iterator q; + for (q = dataMembers.begin(); q != dataMembers.end(); ++q) + memberList.push_back(make_pair((*q)->type(), (*q)->name())); + C << sp; + C << nl << "void" << nl << scoped.substr(2) << "::__write(::IceInternal::Stream* __os)"; + C << sb; + C << nl << "__os->startWriteEncaps();"; + writeMarshalCode(C, memberList, 0); + C << nl << "__os->endWriteEncaps();"; + if (base) + { + C.zeroIndent(); + C << nl << "#ifdef WIN32"; // COMPILERBUG + C.restoreIndent(); + C << nl << base->name() << "::__write(__os);"; + C.zeroIndent(); + C << nl << "#else"; + C.restoreIndent(); + C << nl << base->scoped() << "::__write(__os);"; + C.zeroIndent(); + C << nl << "#endif"; + C.restoreIndent(); + } + C << eb; + C << sp; + C << nl << "void" << nl << scoped.substr(2) << "::__read(::IceInternal::Stream* __is)"; + C << sb; + C << nl << "__is->startReadEncaps();"; + writeUnmarshalCode(C, memberList, 0); + C << nl << "__is->endReadEncaps();"; + if (base) + { + C.zeroIndent(); + C << nl << "#ifdef WIN32"; // COMPILERBUG + C.restoreIndent(); + C << nl << base->name() << "::__read(__is);"; + C.zeroIndent(); + C << nl << "#else"; + C.restoreIndent(); + C << nl << base->scoped() << "::__read(__is);"; + C.zeroIndent(); + C << nl << "#endif"; + C.restoreIndent(); + } + C << eb; } - H << sp; - H << nl << "virtual void __write(::IceInternal::Stream*);"; - H << nl << "virtual void __read(::IceInternal::Stream*);"; H << eb << ';'; - TypeStringList memberList; - DataMemberList dataMembers = p->dataMembers(); - DataMemberList::const_iterator q; - for (q = dataMembers.begin(); q != dataMembers.end(); ++q) - memberList.push_back(make_pair((*q)->type(), (*q)->name())); - C << sp; - C << nl << "void" << nl << scoped.substr(2) << "::__write(::IceInternal::Stream* __os)"; - C << sb; - C << nl << "__os->startWriteEncaps();"; - writeMarshalCode(C, memberList, 0); - C << nl << "__os->endWriteEncaps();"; - if (base) - { - C.zeroIndent(); - C << nl << "#ifdef WIN32"; // COMPILERBUG - C.restoreIndent(); - C << nl << base->name() << "::__write(__os);"; - C.zeroIndent(); - C << nl << "#else"; - C.restoreIndent(); - C << nl << base->scoped() << "::__write(__os);"; - C.zeroIndent(); - C << nl << "#endif"; - C.restoreIndent(); - } - C << eb; - C << sp; - C << nl << "void" << nl << scoped.substr(2) << "::__read(::IceInternal::Stream* __is)"; - C << sb; - C << nl << "__is->startReadEncaps();"; - writeUnmarshalCode(C, memberList, 0); - C << nl << "__is->endReadEncaps();"; - if (base) - { - C.zeroIndent(); - C << nl << "#ifdef WIN32"; // COMPILERBUG - C.restoreIndent(); - C << nl << base->name() << "::__read(__is);"; - C.zeroIndent(); - C << nl << "#else"; - C.restoreIndent(); - C << nl << base->scoped() << "::__read(__is);"; - C.zeroIndent(); - C << nl << "#endif"; - C.restoreIndent(); - } - C << eb; } void |