More cleaning up

This commit is contained in:
Maarten L. Hekkelman
2026-02-17 13:50:08 +01:00
parent 43999dfade
commit b7680dcb92
5 changed files with 26 additions and 22 deletions

View File

@@ -30,7 +30,6 @@
#include <algorithm>
#include <cassert>
#include <charconv>
#include <cstdint>
#include <cstring>
#include <iostream>
@@ -238,7 +237,7 @@ class item_value
explicit operator bool() const noexcept
{
bool result;
bool result = false;
switch (m_data.m_type)
{
case item_value_type::INT: result = m_data.m_value.m_integer != 0; break;
@@ -592,15 +591,15 @@ struct item_handle
[[nodiscard]] item_value &value();
[[nodiscard]] const item_value &value() const;
[[nodiscard]] constexpr bool is_inapplicable() const noexcept { return value().type() == item_value_type::INAPPLICABLE; }
[[nodiscard]] constexpr bool is_missing() const noexcept { return value().type() == item_value_type::MISSING; }
[[nodiscard]] constexpr bool is_null() const noexcept { return is_inapplicable() or is_missing(); }
[[nodiscard]] bool is_inapplicable() const noexcept { return value().type() == item_value_type::INAPPLICABLE; }
[[nodiscard]] bool is_missing() const noexcept { return value().type() == item_value_type::MISSING; }
[[nodiscard]] bool is_null() const noexcept { return is_inapplicable() or is_missing(); }
[[nodiscard]] constexpr bool is_string() const noexcept { return value().type() == item_value_type::TEXT; }
[[nodiscard]] bool is_string() const noexcept { return value().type() == item_value_type::TEXT; }
[[nodiscard]] constexpr bool is_number_int() const noexcept { return value().type() == item_value_type::INT; }
[[nodiscard]] constexpr bool is_number_float() const noexcept { return value().type() == item_value_type::FLOAT; }
[[nodiscard]] constexpr bool is_number() const noexcept { return is_number_int() or is_number_float(); }
[[nodiscard]] bool is_number_int() const noexcept { return value().type() == item_value_type::INT; }
[[nodiscard]] bool is_number_float() const noexcept { return value().type() == item_value_type::FLOAT; }
[[nodiscard]] bool is_number() const noexcept { return is_number_int() or is_number_float(); }
[[nodiscard]] auto type() const { return value().type(); }
@@ -731,15 +730,15 @@ struct const_item_handle
[[nodiscard]] const item_value &value() const;
[[nodiscard]] constexpr bool is_inapplicable() const noexcept { return value().type() == item_value_type::INAPPLICABLE; }
[[nodiscard]] constexpr bool is_missing() const noexcept { return value().type() == item_value_type::MISSING; }
[[nodiscard]] constexpr bool is_null() const noexcept { return is_inapplicable() or is_missing(); }
[[nodiscard]] bool is_inapplicable() const noexcept { return value().type() == item_value_type::INAPPLICABLE; }
[[nodiscard]] bool is_missing() const noexcept { return value().type() == item_value_type::MISSING; }
[[nodiscard]] bool is_null() const noexcept { return is_inapplicable() or is_missing(); }
[[nodiscard]] constexpr bool is_string() const noexcept { return value().type() == item_value_type::TEXT; }
[[nodiscard]] bool is_string() const noexcept { return value().type() == item_value_type::TEXT; }
[[nodiscard]] constexpr bool is_number_int() const noexcept { return value().type() == item_value_type::INT; }
[[nodiscard]] constexpr bool is_number_float() const noexcept { return value().type() == item_value_type::FLOAT; }
[[nodiscard]] constexpr bool is_number() const noexcept { return is_number_int() or is_number_float(); }
[[nodiscard]] bool is_number_int() const noexcept { return value().type() == item_value_type::INT; }
[[nodiscard]] bool is_number_float() const noexcept { return value().type() == item_value_type::FLOAT; }
[[nodiscard]] bool is_number() const noexcept { return is_number_int() or is_number_float(); }
[[nodiscard]] auto type() const { return value().type(); }

View File

@@ -946,10 +946,10 @@ class spherical_dots
const point operator[](uint32_t inIx) const { return m_points[inIx]; }
/// \brief iterator pointing to the first point
iterator begin() const { return m_points.begin(); }
[[nodiscard]] iterator begin() const { return m_points.begin(); }
/// \brief iterator pointing past the last point
iterator end() const { return m_points.end(); }
[[nodiscard]] iterator end() const { return m_points.end(); }
/// \brief return the *weight*,
[[nodiscard]] double weight() const { return W; }

View File

@@ -32,6 +32,7 @@
#include <cmath>
#include <compare>
#include <ostream>
#include <stdexcept>
#include <string>
#include <string_view>
#include <system_error>
@@ -189,6 +190,9 @@ std::string item_value::str() const
return r.ec == std::errc{} ? std::string{ s, r.ptr } : "*****";
}
default:
throw std::runtime_error("invalid data type");
}
}

View File

@@ -1121,8 +1121,8 @@ void createPdbxPolySeqScheme(datablock &db)
auto &atom_site = db["atom_site"];
auto &entity_poly = db["entity_poly"];
auto &entity_poly_seq = db["entity_poly_seq"];
auto &struct_asym = db["struct_asym"];
// auto &entity_poly_seq = db["entity_poly_seq"];
// auto &struct_asym = db["struct_asym"];
auto &pdbx_poly_seq_scheme = db["pdbx_poly_seq_scheme"];
// Find the mapping between asym_id and pdb_strand_id first

View File

@@ -169,8 +169,6 @@ type_validator::type_validator(std::string_view name, DDL_PrimitiveType type, st
int type_validator::compare(const item_value &a, const item_value &b) const
{
int result = 0;
switch (m_primitive_type)
{
case DDL_PrimitiveType::Numb:
@@ -199,6 +197,9 @@ int type_validator::compare(const item_value &a, const item_value &b) const
return a.compare(b, false);
return a.str().compare(b.str());
default:
throw std::runtime_error("invalid primitive type");
}
}