summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorTamás Zolnai <tamas.zolnai@collabora.com>2016-10-14 21:02:32 +0000
committerTamás Zolnai <tamas.zolnai@collabora.com>2016-10-15 14:43:59 +0000
commit6520c8f2f3271c2f36429084a6b0f737f2ad4b88 (patch)
tree5680f5ea860ead488897986d5787a46dab6b6414 /sc
parent57185b9c32b003212c8129480c388f584adc3ca3 (diff)
PivotTable cache: Remove useless mnValueSortIndex
We can use mnOrderIndex to get the same result. Change-Id: I71f68ebefe08c3664954ecdf6345cca4ed5ccafc
Diffstat (limited to 'sc')
-rw-r--r--sc/source/core/data/dpcache.cxx25
1 files changed, 5 insertions, 20 deletions
diff --git a/sc/source/core/data/dpcache.cxx b/sc/source/core/data/dpcache.cxx
index 25a500c96ff3..49b1d61452ac 100644
--- a/sc/source/core/data/dpcache.cxx
+++ b/sc/source/core/data/dpcache.cxx
@@ -153,9 +153,8 @@ struct Bucket
ScDPItemData maValue;
SCROW mnOrderIndex;
SCROW mnDataIndex;
- SCROW mnValueSortIndex;
Bucket(const ScDPItemData& rValue, SCROW nData) :
- maValue(rValue), mnOrderIndex(0), mnDataIndex(nData), mnValueSortIndex(0) {}
+ maValue(rValue), mnOrderIndex(0), mnDataIndex(nData) {}
};
#if DEBUG_PIVOT_TABLE
@@ -167,7 +166,7 @@ struct PrintBucket : std::unary_function<Bucket, void>
{
void operator() (const Bucket& v) const
{
- cout << "value: " << v.maValue.GetValue() << " order index: " << v.mnOrderIndex << " data index: " << v.mnDataIndex << " value sort index: " << v.mnValueSortIndex << endl;
+ cout << "value: " << v.maValue.GetValue() << " order index: " << v.mnOrderIndex << " data index: " << v.mnDataIndex << endl;
}
};
@@ -181,11 +180,11 @@ struct LessByValue : std::binary_function<Bucket, Bucket, bool>
}
};
-struct LessByValueSortIndex : std::binary_function<Bucket, Bucket, bool>
+struct LessByOrderIndex : std::binary_function<Bucket, Bucket, bool>
{
bool operator() (const Bucket& left, const Bucket& right) const
{
- return left.mnValueSortIndex < right.mnValueSortIndex;
+ return left.mnOrderIndex < right.mnOrderIndex;
}
};
@@ -227,17 +226,6 @@ public:
}
};
-class TagValueSortOrder : public std::unary_function<Bucket, void>
-{
- SCROW mnCurIndex;
-public:
- TagValueSortOrder() : mnCurIndex(0) {}
- void operator() (Bucket& v)
- {
- v.mnValueSortIndex = mnCurIndex++;
- }
-};
-
void processBuckets(std::vector<Bucket>& aBuckets, ScDPCache::Field& rField)
{
if (aBuckets.empty())
@@ -246,9 +234,6 @@ void processBuckets(std::vector<Bucket>& aBuckets, ScDPCache::Field& rField)
// Sort by the value.
std::sort(aBuckets.begin(), aBuckets.end(), LessByValue());
- // Remember this sort order.
- std::for_each(aBuckets.begin(), aBuckets.end(), TagValueSortOrder());
-
{
// Set order index such that unique values have identical index value.
SCROW nCurIndex = 0;
@@ -273,7 +258,7 @@ void processBuckets(std::vector<Bucket>& aBuckets, ScDPCache::Field& rField)
std::for_each(aBuckets.begin(), aBuckets.end(), PushBackOrderIndex(rField.maData));
// Sort by the value again.
- std::sort(aBuckets.begin(), aBuckets.end(), LessByValueSortIndex());
+ std::sort(aBuckets.begin(), aBuckets.end(), LessByOrderIndex());
// Unique by value.
std::vector<Bucket>::iterator itUniqueEnd =