diff options
author | Michael Stahl <mstahl@redhat.com> | 2015-07-17 23:49:54 +0200 |
---|---|---|
committer | Michael Stahl <mstahl@redhat.com> | 2015-07-18 22:51:47 +0200 |
commit | 0a0f9d71af5247d70012b7d13504bad28a26bde2 (patch) | |
tree | 9048fdd399170f2d1f35dace9364aae260bd3644 /sax | |
parent | 2842c5cfb99d41b36dba52db01ca6cd37d2ef4b0 (diff) |
sax: convert MergeMarksEnum to enum class
This should detect if a MergeMarks value is erroneously passed as tag.
Change-Id: I7b855a661f182136824cf25f2174a9bcce8ff3d1
Diffstat (limited to 'sax')
-rw-r--r-- | sax/source/tools/fastserializer.cxx | 20 | ||||
-rw-r--r-- | sax/source/tools/fastserializer.hxx | 6 | ||||
-rw-r--r-- | sax/source/tools/fshelper.cxx | 2 |
3 files changed, 14 insertions, 14 deletions
diff --git a/sax/source/tools/fastserializer.cxx b/sax/source/tools/fastserializer.cxx index 66466e9b6b90..32c0358ec618 100644 --- a/sax/source/tools/fastserializer.cxx +++ b/sax/source/tools/fastserializer.cxx @@ -402,7 +402,7 @@ namespace sax_fastparser { #endif void FastSaxSerializer::mergeTopMarks( - sal_Int32 const nTag, sax_fastparser::MergeMarksEnum const eMergeType) + sal_Int32 const nTag, sax_fastparser::MergeMarks const eMergeType) { SAL_WARN_IF(mbMarkStackEmpty, "sax", "Empty mark stack - nothing to merge"); assert(!mbMarkStackEmpty); // should never happen @@ -428,7 +428,7 @@ namespace sax_fastparser { // flush, so that we get everything in getData() maCachedOutputStream.flush(); - if ( maMarkStack.size() == 1 && eMergeType != MERGE_MARKS_IGNORE) + if (maMarkStack.size() == 1 && eMergeType != MergeMarks::IGNORE) { #ifdef DBG_UTIL while (!maMarkStack.top()->m_DebugEndedElements.empty()) @@ -460,14 +460,14 @@ namespace sax_fastparser { #ifdef DBG_UTIL switch (eMergeType) { - case MERGE_MARKS_APPEND: + case MergeMarks::APPEND: lcl_DebugMergeAppend( maMarkStack.top()->m_DebugEndedElements, maMarkStack.top()->m_DebugStartedElements, topDebugEndedElements, topDebugStartedElements); break; - case MERGE_MARKS_PREPEND: + case MergeMarks::PREPEND: if (dynamic_cast<ForSort*>(maMarkStack.top().get())) // argh... { lcl_DebugMergeAppend( @@ -485,14 +485,14 @@ namespace sax_fastparser { maMarkStack.top()->m_DebugStartedElements); } break; - case MERGE_MARKS_POSTPONE: + case MergeMarks::POSTPONE: lcl_DebugMergeAppend( maMarkStack.top()->m_DebugPostponedEndedElements, maMarkStack.top()->m_DebugPostponedStartedElements, topDebugEndedElements, topDebugStartedElements); break; - case MERGE_MARKS_IGNORE: + case MergeMarks::IGNORE: break; } #endif @@ -508,10 +508,10 @@ namespace sax_fastparser { switch ( eMergeType ) { - case MERGE_MARKS_APPEND: maMarkStack.top()->append( aMerge ); break; - case MERGE_MARKS_PREPEND: maMarkStack.top()->prepend( aMerge ); break; - case MERGE_MARKS_POSTPONE: maMarkStack.top()->postpone( aMerge ); break; - case MERGE_MARKS_IGNORE : break; + case MergeMarks::APPEND: maMarkStack.top()->append( aMerge ); break; + case MergeMarks::PREPEND: maMarkStack.top()->prepend( aMerge ); break; + case MergeMarks::POSTPONE: maMarkStack.top()->postpone( aMerge ); break; + case MergeMarks::IGNORE: break; } } diff --git a/sax/source/tools/fastserializer.hxx b/sax/source/tools/fastserializer.hxx index 5fcbef51b6df..1f30313def4d 100644 --- a/sax/source/tools/fastserializer.hxx +++ b/sax/source/tools/fastserializer.hxx @@ -125,7 +125,7 @@ public: p, r, t, [text], /t, rPr, [something], /rPr, /r, /p, simply do p, r, mark(), t, [text], /t, mark(), rPr, [something], /rPr, - mergeTopMarks( MERGE_MARKS_PREPEND ), mergeTopMarks( MERGE_MARKS_APPEND ), /r, /p + mergeTopMarks( MergeMarks::PREPEND ), mergeTopMarks( MergeMarks::APPEND ), /r, /p and you are done. @param nTag debugging aid to ensure mark and merge match in LIFO order @@ -142,7 +142,7 @@ public: Writes the result to the output stream if the mark stack becomes empty by the operation. - When the MERGE_MARKS_POSTPONE is specified, the merge happens just + When the MergeMarks::POSTPONE is specified, the merge happens just before the next merge. @param nTag debugging aid to ensure mark and merge match in LIFO order @@ -150,7 +150,7 @@ public: @see mark() */ void mergeTopMarks(sal_Int32 nTag, - sax_fastparser::MergeMarksEnum eMergeType = sax_fastparser::MERGE_MARKS_APPEND); + sax_fastparser::MergeMarks eMergeType = sax_fastparser::MergeMarks::APPEND); private: /** Helper class to cache data and write in chunks to XOutputStream or ForMerge::append. diff --git a/sax/source/tools/fshelper.cxx b/sax/source/tools/fshelper.cxx index 46d87644d471..75a6fa052d32 100644 --- a/sax/source/tools/fshelper.cxx +++ b/sax/source/tools/fshelper.cxx @@ -160,7 +160,7 @@ void FastSerializerHelper::mark( } void FastSerializerHelper::mergeTopMarks( - sal_Int32 const nTag, MergeMarksEnum const eMergeType) + sal_Int32 const nTag, MergeMarks const eMergeType) { mpSerializer->mergeTopMarks(nTag, eMergeType); } |