Commit b317c780 by Maarten L. Hekkelman

Fixes for pre c++20

file constructor from raw data
parent 681aa3bf
......@@ -313,6 +313,12 @@ install(
COMPONENT Devel
)
install(
FILES include/cif++.hpp
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
COMPONENT Devel
)
install(FILES
${PROJECT_SOURCE_DIR}/rsrc/mmcif_ddl.dic
${PROJECT_SOURCE_DIR}/rsrc/mmcif_pdbx.dic
......
......@@ -51,6 +51,20 @@ class file : public std::list<datablock>
load(is);
}
explicit file(const char *data, size_t length)
{
struct membuf : public std::streambuf
{
membuf(char *text, size_t length)
{
this->setg(text, text, text + length);
}
} buffer(const_cast<char *>(data), length);
std::istream is(&buffer);
load(is);
}
file(const file &) = default;
file(file &&) = default;
file &operator=(const file &) = default;
......
......@@ -234,6 +234,15 @@ struct item_handle
return item_value_as<T>::compare(*this, value, true) == 0;
}
// We may not have C++20 yet...
template <typename T>
bool operator!=(const T &value) const
{
// TODO: icase or not icase?
return item_value_as<T>::compare(*this, value, true) != 0;
}
// empty means either null or unknown
bool empty() const
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment