Author: damjan Date: Thu Feb 25 03:43:00 2016 New Revision: 1732245 URL: http://svn.apache.org/viewvc?rev=1732245&view=rev Log: Merge r1409457 from branches/gbuild: TagLogger: new method toTree
BUILDS Modified: openoffice/branches/gbuild-reintegration/ (props changed) openoffice/branches/gbuild-reintegration/main/writerfilter/inc/resourcemodel/TagLogger.hxx openoffice/branches/gbuild-reintegration/main/writerfilter/source/resourcemodel/TagLogger.cxx Propchange: openoffice/branches/gbuild-reintegration/ ------------------------------------------------------------------------------ --- svn:mergeinfo (original) +++ svn:mergeinfo Thu Feb 25 03:43:00 2016 @@ -1,4 +1,4 @@ -/incubator/ooo/branches/gbuild:1409313-1409425,1409427-1409428,1409430,1409432-1409436,1409438,1409440,1409442,1409444-1409446,1409452,1409454,1409470 +/incubator/ooo/branches/gbuild:1409313-1409425,1409427-1409428,1409430,1409432-1409436,1409438,1409440,1409442,1409444-1409446,1409452,1409454,1409457,1409470 /openoffice/branches/AOO400:1503684 /openoffice/branches/AOO410:1572480,1573601,1583349,1583635,1583666 /openoffice/branches/alg_writerframes:1556289-1579189 Modified: openoffice/branches/gbuild-reintegration/main/writerfilter/inc/resourcemodel/TagLogger.hxx URL: http://svn.apache.org/viewvc/openoffice/branches/gbuild-reintegration/main/writerfilter/inc/resourcemodel/TagLogger.hxx?rev=1732245&r1=1732244&r2=1732245&view=diff ============================================================================== --- openoffice/branches/gbuild-reintegration/main/writerfilter/inc/resourcemodel/TagLogger.hxx (original) +++ openoffice/branches/gbuild-reintegration/main/writerfilter/inc/resourcemodel/TagLogger.hxx Thu Feb 25 03:43:00 2016 @@ -78,7 +78,8 @@ namespace writerfilter void chars(const string & rChars); void chars(const ::rtl::OUString & rChars); const string & getTag() const; - string toString() const; + string toString() const; + string toTree(const string & sIndent = "") const; ostream & output(ostream & o, const string & sIndent = "") const; }; Modified: openoffice/branches/gbuild-reintegration/main/writerfilter/source/resourcemodel/TagLogger.cxx URL: http://svn.apache.org/viewvc/openoffice/branches/gbuild-reintegration/main/writerfilter/source/resourcemodel/TagLogger.cxx?rev=1732245&r1=1732244&r2=1732245&view=diff ============================================================================== --- openoffice/branches/gbuild-reintegration/main/writerfilter/source/resourcemodel/TagLogger.cxx (original) +++ openoffice/branches/gbuild-reintegration/main/writerfilter/source/resourcemodel/TagLogger.cxx Thu Feb 25 03:43:00 2016 @@ -171,6 +171,75 @@ string XMLTag::toString() const return sResult; } +string XMLTag::toTree(const string & sIndent) const +{ + if (mChars.length() > 0) + return sIndent + mChars; + + string sResult; + + size_t nSize = sIndent.size(); + if (nSize > 1) + { + sResult += sIndent.substr(0, nSize - 2) + "+-\\" + mTag; + } + else + { + sResult += "\\" + mTag; + } + + XMLAttributes_t::const_iterator aIt = mAttrs.begin(); + while (aIt != mAttrs.end()) + { + if (aIt == mAttrs.begin()) + { + sResult += "("; + } + else + { + sResult += sIndent + ", "; + } + + sResult += aIt->mName; + sResult += "="; + sResult += aIt->mValue; + + aIt++; + + if (aIt == mAttrs.end()) + { + sResult += ")"; + } + } + + sResult += "\n"; + + if (mTags.size() > 0) + { + XMLTags_t::const_iterator aItTags = mTags.begin(); + size_t nSize = mTags.size(); + while (aItTags != mTags.end()) + { + if ((*aItTags).get() != NULL) + { + if (nSize == 1) + { + sResult += (*aItTags)->toTree(sIndent + " "); + } + else + { + sResult += (*aItTags)->toTree(sIndent + "| "); + } + } + + aItTags++; + nSize--; + } + } + + return sResult; +} + ostream & XMLTag::output(ostream & o, const string & sIndent) const { bool bHasContent = mChars.size() > 0 || mTags.size() > 0;