Remove member function GenericVector<T>::contains

Signed-off-by: Stefan Weil <sw@weilnetz.de>
This commit is contained in:
Stefan Weil 2021-07-30 07:06:27 +02:00
parent 739057c586
commit 8b21e4f0b8
2 changed files with 5 additions and 12 deletions

View File

@ -103,9 +103,6 @@ public:
// Return the index of the T object.
int get_index(const T &object) const;
// Return true if T is in the array
bool contains(const T &object) const;
// Return true if the index is valid
T contains_index(int index) const;
@ -632,12 +629,6 @@ int GenericVector<T>::get_index(const T &object) const {
return -1;
}
// Return true if T is in the array
template <typename T>
bool GenericVector<T>::contains(const T &object) const {
return get_index(object) != -1;
}
// Add an element in the array
template <typename T>
int GenericVector<T>::push_back(T object) {

View File

@ -396,7 +396,8 @@ bool MasterTrainer::LoadFontInfo(const char *filename) {
}
fontinfo.properties = (italic << 0) + (bold << 1) + (fixed << 2) +
(serif << 3) + (fraktur << 4);
if (!fontinfo_table_.contains(fontinfo)) {
if (fontinfo_table_.get_index(fontinfo) < 0) {
// fontinfo not in table.
fontinfo_table_.push_back(fontinfo);
} else {
delete[] font_name;
@ -434,10 +435,11 @@ bool MasterTrainer::LoadXHeights(const char *filename) {
}
buffer[1023] = '\0';
fontinfo.name = buffer;
if (!fontinfo_table_.contains(fontinfo)) {
auto fontinfo_id = fontinfo_table_.get_index(fontinfo);
if (fontinfo_id < 0) {
// fontinfo not in table.
continue;
}
int fontinfo_id = fontinfo_table_.get_index(fontinfo);
xheights_[fontinfo_id] = xht;
total_xheight += xht;
++xheight_count;