tdf#96099 Reduce number of trivial typedefs
Change-Id: I39e9fcfdf2203239ac56d1c8195ca7ac07054817 Reviewed-on: https://gerrit.libreoffice.org/22898 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
This commit is contained in:
parent
eb07740320
commit
cbbeb771ba
@ -57,8 +57,6 @@ private:
|
||||
double mfStartTime;
|
||||
};
|
||||
|
||||
typedef std::vector<int> values_type;
|
||||
typedef std::vector<size_t> indices_type;
|
||||
|
||||
#if 1
|
||||
size_t val_count = 6000000;
|
||||
@ -72,9 +70,9 @@ bool dump_values = true;
|
||||
|
||||
struct field : boost::noncopyable
|
||||
{
|
||||
values_type items; /// unique values
|
||||
indices_type data; /// original value series as indices into unique values.
|
||||
indices_type order; /// ascending order of the values as indices.
|
||||
std::vector<int> items; /// unique values
|
||||
std::vector<size_t> data; /// original value series as indices into unique values.
|
||||
std::vector<size_t> order; /// ascending order of the values as indices.
|
||||
};
|
||||
|
||||
long compare(int left, int right)
|
||||
@ -86,7 +84,7 @@ long compare(int left, int right)
|
||||
return 1;
|
||||
}
|
||||
|
||||
bool has_item(const values_type& items, const indices_type& order, int val, long& index)
|
||||
bool has_item(const std::vector<int>& items, const std::vector<size_t>& order, int val, long& index)
|
||||
{
|
||||
index = items.size();
|
||||
bool found = false;
|
||||
@ -112,19 +110,19 @@ bool has_item(const values_type& items, const indices_type& order, int val, long
|
||||
return found;
|
||||
}
|
||||
|
||||
bool check_items(const values_type& items)
|
||||
bool check_items(const std::vector<int>& items)
|
||||
{
|
||||
if (items.empty())
|
||||
return false;
|
||||
|
||||
// Items are supposed to be all unique values.
|
||||
values_type copied(items);
|
||||
std::vector<int> copied(items);
|
||||
sort(copied.begin(), copied.end());
|
||||
copied.erase(unique(copied.begin(), copied.end()), copied.end());
|
||||
return copied.size() == items.size();
|
||||
}
|
||||
|
||||
bool check_order(const values_type& items, const indices_type& order)
|
||||
bool check_order(const std::vector<int>& items, const std::vector<size_t>& order)
|
||||
{
|
||||
// Ensure that the order is truly in ascending order.
|
||||
if (items.size() != order.size())
|
||||
@ -133,11 +131,11 @@ bool check_order(const values_type& items, const indices_type& order)
|
||||
if (items.empty())
|
||||
return false;
|
||||
|
||||
indices_type::const_iterator it = order.begin();
|
||||
values_type::value_type prev = items[*it];
|
||||
auto it = order.cbegin();
|
||||
std::vector<int>::value_type prev = items[*it];
|
||||
for (++it; it != order.end(); ++it)
|
||||
{
|
||||
values_type::value_type val = items[*it];
|
||||
std::vector<int>::value_type val = items[*it];
|
||||
if (prev >= val)
|
||||
return false;
|
||||
|
||||
@ -147,7 +145,7 @@ bool check_order(const values_type& items, const indices_type& order)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool check_data(const values_type& items, const indices_type& data, const values_type& original)
|
||||
bool check_data(const std::vector<int>& items, const std::vector<size_t>& data, const std::vector<int>& original)
|
||||
{
|
||||
if (items.empty() || data.empty() || original.empty())
|
||||
return false;
|
||||
@ -164,7 +162,7 @@ bool check_data(const values_type& items, const indices_type& data, const values
|
||||
return true;
|
||||
}
|
||||
|
||||
bool dump_and_check(const field& fld, const values_type& original, bool dump_values)
|
||||
bool dump_and_check(const field& fld, const std::vector<int>& original, bool dump_values)
|
||||
{
|
||||
cout << "unique item count: " << fld.items.size() << endl;
|
||||
cout << "original data count: " << fld.data.size() << endl;
|
||||
@ -175,7 +173,7 @@ bool dump_and_check(const field& fld, const values_type& original, bool dump_val
|
||||
copy(fld.items.begin(), fld.items.end(), ostream_iterator<int>(cout, "\n"));
|
||||
cout << "--- sorted items" << endl;
|
||||
{
|
||||
indices_type::const_iterator it = fld.order.begin(), it_end = fld.order.end();
|
||||
auto it = fld.order.cbegin(), it_end = fld.order.cend();
|
||||
for (; it != it_end; ++it)
|
||||
{
|
||||
cout << fld.items[*it] << endl;
|
||||
@ -204,12 +202,12 @@ bool dump_and_check(const field& fld, const values_type& original, bool dump_val
|
||||
return true;
|
||||
}
|
||||
|
||||
void run1(const values_type& vals, bool dump_values)
|
||||
void run1(const std::vector<int>& vals, bool dump_values)
|
||||
{
|
||||
field fld;
|
||||
{
|
||||
stack_printer __stack_printer__("::run1 (existing algorithm)");
|
||||
values_type::const_iterator it = vals.begin(), it_end = vals.end();
|
||||
auto it = vals.cbegin(), it_end = vals.cend();
|
||||
for (; it != it_end; ++it)
|
||||
{
|
||||
long index = 0;
|
||||
@ -281,9 +279,9 @@ struct equal_by_value : std::binary_function<bucket, bucket, bool>
|
||||
|
||||
class push_back_value : std::unary_function<bucket, void>
|
||||
{
|
||||
values_type& items;
|
||||
std::vector<int>& items;
|
||||
public:
|
||||
explicit push_back_value(values_type& _items) : items(_items) {}
|
||||
explicit push_back_value(std::vector<int>& _items) : items(_items) {}
|
||||
void operator() (const bucket& v)
|
||||
{
|
||||
items.push_back(v.value);
|
||||
@ -292,16 +290,16 @@ public:
|
||||
|
||||
class push_back_order_index : std::unary_function<bucket, void>
|
||||
{
|
||||
indices_type& data_indices;
|
||||
std::vector<size_t>& data_indices;
|
||||
public:
|
||||
explicit push_back_order_index(indices_type& _items) : data_indices(_items) {}
|
||||
explicit push_back_order_index(std::vector<size_t>& _items) : data_indices(_items) {}
|
||||
void operator() (const bucket& v)
|
||||
{
|
||||
data_indices.push_back(v.order_index);
|
||||
}
|
||||
};
|
||||
|
||||
void run2(const values_type& vals, bool dump_values)
|
||||
void run2(const std::vector<int>& vals, bool dump_values)
|
||||
{
|
||||
field fld;
|
||||
{
|
||||
@ -310,7 +308,7 @@ void run2(const values_type& vals, bool dump_values)
|
||||
buckets.reserve(vals.size());
|
||||
{
|
||||
// Push back all original values.
|
||||
values_type::const_iterator it = vals.begin(), it_end = vals.end();
|
||||
auto it = vals.cbegin(), it_end = vals.cend();
|
||||
for (size_t i = 0; it != it_end; ++it, ++i)
|
||||
buckets.push_back(bucket(*it, 0, i));
|
||||
}
|
||||
@ -384,7 +382,7 @@ void run2(const values_type& vals, bool dump_values)
|
||||
|
||||
int main()
|
||||
{
|
||||
values_type vals;
|
||||
std::vector<int> vals;
|
||||
vals.reserve(val_count);
|
||||
|
||||
if (dump_values)
|
||||
@ -395,7 +393,7 @@ int main()
|
||||
double v = rand();
|
||||
v /= RAND_MAX;
|
||||
v *= multiplier;
|
||||
values_type::value_type v2 = v;
|
||||
std::vector<int>::value_type v2 = v;
|
||||
vals.push_back(v2);
|
||||
|
||||
if (dump_values)
|
||||
|
@ -54,8 +54,6 @@ using css::system::XSimpleMailMessage2;
|
||||
using css::system::SimpleMailClientFlags::NO_USER_INTERFACE;
|
||||
using css::system::SimpleMailClientFlags::NO_LOGON_DIALOG;
|
||||
|
||||
typedef std::vector<OUString> StringList_t;
|
||||
|
||||
const OUString TO("--to");
|
||||
const OUString CC("--cc");
|
||||
const OUString BCC("--bcc");
|
||||
@ -118,7 +116,7 @@ namespace /* private */
|
||||
@returns
|
||||
<TRUE/> on success.
|
||||
*/
|
||||
bool executeSenddoc(const StringList_t& rCommandArgs)
|
||||
bool executeSenddoc(const std::vector<OUString>& rCommandArgs)
|
||||
{
|
||||
OUString senddocUrl = getSenddocUrl();
|
||||
if (senddocUrl.getLength() == 0)
|
||||
@ -176,7 +174,7 @@ Reference<XSimpleMailMessage> SAL_CALL CSmplMailClient::createSimpleMailMessage(
|
||||
*/
|
||||
void CSmplMailClient::assembleCommandLine(
|
||||
const Reference<XSimpleMailMessage>& xSimpleMailMessage,
|
||||
sal_Int32 aFlag, StringList_t& rCommandArgs)
|
||||
sal_Int32 aFlag, std::vector<OUString>& rCommandArgs)
|
||||
{
|
||||
OSL_ENSURE(rCommandArgs.empty(), "Provided command argument buffer not empty");
|
||||
|
||||
@ -254,7 +252,7 @@ void SAL_CALL CSmplMailClient::sendSimpleMailMessage(
|
||||
{
|
||||
validateParameter(xSimpleMailMessage, aFlag);
|
||||
|
||||
StringList_t senddocParams;
|
||||
std::vector<OUString> senddocParams;
|
||||
assembleCommandLine(xSimpleMailMessage, aFlag, senddocParams);
|
||||
|
||||
if (!executeSenddoc(senddocParams))
|
||||
|
@ -69,7 +69,6 @@ namespace svt
|
||||
using namespace ::comphelper;
|
||||
using namespace ::utl;
|
||||
|
||||
typedef std::vector<OUString> StringArray;
|
||||
typedef std::set<OUString> StringBag;
|
||||
typedef std::map<OUString, OUString> MapString2String;
|
||||
|
||||
@ -455,11 +454,11 @@ void AssignmentPersistentData::ImplCommit()
|
||||
bool bWorkingPersistent : 1;
|
||||
|
||||
/// the strings to use as labels for the field selection listboxes
|
||||
StringArray aFieldLabels;
|
||||
std::vector<OUString> aFieldLabels;
|
||||
// the current field assignment
|
||||
StringArray aFieldAssignments;
|
||||
std::vector<OUString> aFieldAssignments;
|
||||
/// the logical field names
|
||||
StringArray aLogicalFieldNames;
|
||||
std::vector<OUString> aLogicalFieldNames;
|
||||
|
||||
IAssigmentData* pConfigData;
|
||||
|
||||
@ -591,7 +590,7 @@ void AssignmentPersistentData::ImplCommit()
|
||||
|
||||
long nLabelWidth = 0;
|
||||
long nListBoxWidth = m_pImpl->pFields[0]->approximate_char_width() * 20;
|
||||
for (StringArray::const_iterator aI = m_pImpl->aFieldLabels.begin(), aEnd = m_pImpl->aFieldLabels.end(); aI != aEnd; ++aI)
|
||||
for (auto aI = m_pImpl->aFieldLabels.cbegin(), aEnd = m_pImpl->aFieldLabels.cend(); aI != aEnd; ++aI)
|
||||
{
|
||||
nLabelWidth = std::max(nLabelWidth, FixedText::getTextDimensions(m_pImpl->pFieldLabels[0], *aI, 0x7FFFFFFF).Width());
|
||||
}
|
||||
@ -676,8 +675,8 @@ void AssignmentPersistentData::ImplCommit()
|
||||
AliasProgrammaticPair* pPair = _rMapping.getArray();
|
||||
|
||||
OUString sCurrent;
|
||||
for ( StringArray::const_iterator aProgrammatic = m_pImpl->aLogicalFieldNames.begin();
|
||||
aProgrammatic != m_pImpl->aLogicalFieldNames.end();
|
||||
for ( auto aProgrammatic = m_pImpl->aLogicalFieldNames.cbegin();
|
||||
aProgrammatic != m_pImpl->aLogicalFieldNames.cend();
|
||||
++aProgrammatic
|
||||
)
|
||||
{
|
||||
@ -713,8 +712,8 @@ void AssignmentPersistentData::ImplCommit()
|
||||
// AddressBookSourceDialog::loadConfiguration: inconsistence between field names and field assignments!
|
||||
assert(m_pImpl->aLogicalFieldNames.size() == m_pImpl->aFieldAssignments.size());
|
||||
|
||||
StringArray::const_iterator aLogical = m_pImpl->aLogicalFieldNames.begin();
|
||||
StringArray::iterator aAssignment = m_pImpl->aFieldAssignments.begin();
|
||||
auto aLogical = m_pImpl->aLogicalFieldNames.cbegin();
|
||||
auto aAssignment = m_pImpl->aFieldAssignments.begin();
|
||||
for ( ;
|
||||
aLogical != m_pImpl->aLogicalFieldNames.end();
|
||||
++aLogical, ++aAssignment
|
||||
@ -963,7 +962,7 @@ void AssignmentPersistentData::ImplCommit()
|
||||
}
|
||||
|
||||
// adjust m_pImpl->aFieldAssignments
|
||||
for ( StringArray::iterator aAdjust = m_pImpl->aFieldAssignments.begin();
|
||||
for ( auto aAdjust = m_pImpl->aFieldAssignments.begin();
|
||||
aAdjust != m_pImpl->aFieldAssignments.end();
|
||||
++aAdjust
|
||||
)
|
||||
@ -1000,8 +999,8 @@ void AssignmentPersistentData::ImplCommit()
|
||||
// for the new texts
|
||||
VclPtr<FixedText>* pLeftLabelControl = m_pImpl->pFieldLabels;
|
||||
VclPtr<FixedText>* pRightLabelControl = pLeftLabelControl + 1;
|
||||
StringArray::const_iterator pLeftColumnLabel = m_pImpl->aFieldLabels.begin() + 2 * _nPos;
|
||||
StringArray::const_iterator pRightColumnLabel = pLeftColumnLabel + 1;
|
||||
auto pLeftColumnLabel = m_pImpl->aFieldLabels.cbegin() + 2 * _nPos;
|
||||
auto pRightColumnLabel = pLeftColumnLabel + 1;
|
||||
|
||||
// for the focus movement and the selection scroll
|
||||
VclPtr<ListBox>* pLeftListControl = m_pImpl->pFields;
|
||||
@ -1012,8 +1011,8 @@ void AssignmentPersistentData::ImplCommit()
|
||||
sal_Int32 nOldFocusColumn = 0;
|
||||
|
||||
// for the selection scroll
|
||||
StringArray::const_iterator pLeftAssignment = m_pImpl->aFieldAssignments.begin() + 2 * _nPos;
|
||||
StringArray::const_iterator pRightAssignment = pLeftAssignment + 1;
|
||||
auto pLeftAssignment = m_pImpl->aFieldAssignments.cbegin() + 2 * _nPos;
|
||||
auto pRightAssignment = pLeftAssignment + 1;
|
||||
|
||||
m_pImpl->nLastVisibleListIndex = -1;
|
||||
// loop
|
||||
@ -1153,8 +1152,8 @@ void AssignmentPersistentData::ImplCommit()
|
||||
assert(m_pImpl->aLogicalFieldNames.size() == m_pImpl->aFieldAssignments.size());
|
||||
|
||||
// set the field assignments
|
||||
StringArray::const_iterator aLogical = m_pImpl->aLogicalFieldNames.begin();
|
||||
StringArray::const_iterator aAssignment = m_pImpl->aFieldAssignments.begin();
|
||||
auto aLogical = m_pImpl->aLogicalFieldNames.cbegin();
|
||||
auto aAssignment = m_pImpl->aFieldAssignments.cbegin();
|
||||
for ( ;
|
||||
aLogical != m_pImpl->aLogicalFieldNames.end();
|
||||
++aLogical, ++aAssignment
|
||||
|
@ -549,8 +549,7 @@ bool ImplLayoutArgs::PrepareFallback()
|
||||
int nMin, nEnd;
|
||||
|
||||
// get the individual fallback requests
|
||||
typedef std::vector<int> IntVector;
|
||||
IntVector aPosVector;
|
||||
std::vector<int> aPosVector;
|
||||
aPosVector.reserve(mrStr.getLength());
|
||||
maFallbackRuns.ResetPos();
|
||||
for(; maFallbackRuns.GetRun( &nMin, &nEnd, &bRTL ); maFallbackRuns.NextRun() )
|
||||
@ -567,11 +566,11 @@ bool ImplLayoutArgs::PrepareFallback()
|
||||
for(; maRuns.GetRun( &nMin, &nEnd, &bRTL ); maRuns.NextRun() )
|
||||
{
|
||||
if( !bRTL) {
|
||||
IntVector::const_iterator it = std::lower_bound( aPosVector.begin(), aPosVector.end(), nMin );
|
||||
auto it = std::lower_bound( aPosVector.begin(), aPosVector.end(), nMin );
|
||||
for(; (it != aPosVector.end()) && (*it < nEnd); ++it )
|
||||
aNewRuns.AddPos( *it, bRTL );
|
||||
} else {
|
||||
IntVector::const_iterator it = std::upper_bound( aPosVector.begin(), aPosVector.end(), nEnd );
|
||||
auto it = std::upper_bound( aPosVector.begin(), aPosVector.end(), nEnd );
|
||||
while( (it != aPosVector.begin()) && (*--it >= nMin) )
|
||||
aNewRuns.AddPos( *it, bRTL );
|
||||
}
|
||||
|
@ -1661,8 +1661,7 @@ bool UniscribeLayout::LayoutText( ImplLayoutArgs& rArgs )
|
||||
|
||||
// for a base layout only the context glyphs have to be dropped
|
||||
// => when the whole string is involved there is no extra context
|
||||
typedef std::vector<int> TIntVector;
|
||||
TIntVector aDropChars;
|
||||
std::vector<int> aDropChars;
|
||||
if( rArgs.mnFlags & SalLayoutFlags::ForFallback )
|
||||
{
|
||||
// calculate superfluous context char positions
|
||||
@ -2003,8 +2002,8 @@ bool UniscribeLayout::LayoutText( ImplLayoutArgs& rArgs )
|
||||
//pVI->mnEndGlyphPos = nEndGlyphPos;
|
||||
|
||||
// drop the superfluous context glyphs
|
||||
TIntVector::const_iterator it = aDropChars.begin();
|
||||
while( it != aDropChars.end() )
|
||||
auto it = aDropChars.cbegin();
|
||||
while( it != aDropChars.cend() )
|
||||
{
|
||||
// find matching "drop range"
|
||||
int nMinDropPos = *(it++); // begin of drop range
|
||||
|
Loading…
x
Reference in New Issue
Block a user