| 18 | #include <vector> |
| 19 | |
| 20 | QString MergeEditLine::getString(const std::shared_ptr<const LineDataVector> &pLineDataA, const std::shared_ptr<const LineDataVector> &pLineDataB, const std::shared_ptr<const LineDataVector> &pLineDataC) const |
| 21 | { |
| 22 | //Triggered by resize event during early init. Ignore these calls. |
| 23 | if((mSrc == e_SrcSelector::A && pLineDataA->empty()) || (mSrc == e_SrcSelector::B && pLineDataB->empty()) || (mSrc == e_SrcSelector::C && pLineDataC->empty())) |
| 24 | return QString(); |
| 25 | |
| 26 | if(isRemoved() || (!isModified() && mSrc == e_SrcSelector::None)) |
| 27 | { |
| 28 | return QString(); |
| 29 | } |
| 30 | |
| 31 | if(!isModified()) |
| 32 | { |
| 33 | std::optional<LineData> lineData; |
| 34 | assert(mSrc == e_SrcSelector::A || mSrc == e_SrcSelector::B || mSrc == e_SrcSelector::C); |
| 35 | |
| 36 | if(mSrc == e_SrcSelector::A && m_id3l->getLineA().isValid()) |
| 37 | lineData = (*pLineDataA)[m_id3l->getLineA()]; |
| 38 | else if(mSrc == e_SrcSelector::B && m_id3l->getLineB().isValid()) |
| 39 | lineData = (*pLineDataB)[m_id3l->getLineB()]; |
| 40 | else if(mSrc == e_SrcSelector::C && m_id3l->getLineC().isValid()) |
| 41 | lineData = (*pLineDataC)[m_id3l->getLineC()]; |
| 42 | |
| 43 | //Not an error. |
| 44 | if(!lineData.has_value()) |
| 45 | { |
| 46 | return QString(); |
| 47 | } |
| 48 | |
| 49 | return lineData->getLine(); |
| 50 | } |
| 51 | |
| 52 | return mStr; |
| 53 | } |
| 54 | |
| 55 | bool MergeBlock::isSameKind(const MergeBlock &mb2) const |
| 56 | { |