pmt: Improve libpartition_map types and some functions.
- Add new operators to Map_t. - Add new flags to info function. - Move some local pmt function(s) to libhelper. - Etc...
This commit is contained in:
@@ -370,7 +370,7 @@ bool basic_partition_map_builder::doForPartitionList(
|
||||
for (const auto &partition : partitions) {
|
||||
if (!hasPartition(partition))
|
||||
throw Error("Couldn't find partition: %s", partition.data());
|
||||
if (!func(partition, {sizeOf(partition), isLogical(partition)})) {
|
||||
if (!func(partition, _current_map[partition])) {
|
||||
err = true;
|
||||
LOGN(MAP, ERROR) << "Failed progress for " << partition << " partition."
|
||||
<< std::endl;
|
||||
|
||||
@@ -185,8 +185,7 @@ std::string basic_partition_map::find_(const std::string &name) const {
|
||||
size_t basic_partition_map::size() const { return _count; }
|
||||
|
||||
bool basic_partition_map::empty() const {
|
||||
if (_count > 0) return false;
|
||||
return true;
|
||||
return _count > 0;
|
||||
}
|
||||
|
||||
void basic_partition_map::clear() {
|
||||
@@ -229,6 +228,14 @@ bool basic_partition_map::operator!=(const basic_partition_map &other) const {
|
||||
return !(*this == other);
|
||||
}
|
||||
|
||||
basic_partition_map::operator bool() const{
|
||||
return _count > 0;
|
||||
}
|
||||
|
||||
bool basic_partition_map::operator!() const{
|
||||
return _count == 0;
|
||||
}
|
||||
|
||||
Info basic_partition_map::operator[](const int index) const {
|
||||
if (_count == 0 || index >= _count) return {};
|
||||
return _data[index];
|
||||
|
||||
Reference in New Issue
Block a user