mirror of
https://github.com/loot/libloot.git
synced 2026-07-27 14:16:01 -07:00
Update CXX to v1.0.192
This commit is contained in:
+14
-17
@@ -164,7 +164,7 @@ loot::Vertex convert(const loot::rust::Vertex& vertex) {
|
||||
std::string(file.GetName()),
|
||||
file.GetDisplayName(),
|
||||
file.GetCondition(),
|
||||
::rust::Slice(convert<loot::rust::MessageContent>(file.GetDetail())),
|
||||
convert<loot::rust::MessageContent>(file.GetDetail()),
|
||||
file.GetConstraint());
|
||||
} catch (const ::rust::Error& e) {
|
||||
std::rethrow_exception(mapError(e));
|
||||
@@ -194,8 +194,7 @@ loot::rust::MessageType convert(loot::MessageType messageType) {
|
||||
try {
|
||||
return loot::rust::multilingual_message(
|
||||
convert(message.GetType()),
|
||||
::rust::Slice(
|
||||
convert<loot::rust::MessageContent>(message.GetContent())),
|
||||
convert<loot::rust::MessageContent>(message.GetContent()),
|
||||
message.GetCondition());
|
||||
} catch (const ::rust::Error& e) {
|
||||
std::rethrow_exception(mapError(e));
|
||||
@@ -219,7 +218,7 @@ loot::rust::MessageType convert(loot::MessageType messageType) {
|
||||
return loot::rust::new_plugin_cleaning_data(
|
||||
data.GetCRC(),
|
||||
data.GetCleaningUtility(),
|
||||
::rust::Slice(convert<loot::rust::MessageContent>(data.GetDetail())),
|
||||
convert<loot::rust::MessageContent>(data.GetDetail()),
|
||||
data.GetITMCount(),
|
||||
data.GetDeletedReferenceCount(),
|
||||
data.GetDeletedNavmeshCount());
|
||||
@@ -242,21 +241,19 @@ loot::rust::MessageType convert(loot::MessageType messageType) {
|
||||
}
|
||||
|
||||
output->set_load_after_files(
|
||||
::rust::Slice(convert<loot::rust::File>(metadata.GetLoadAfterFiles())));
|
||||
convert<loot::rust::File>(metadata.GetLoadAfterFiles()));
|
||||
output->set_requirements(
|
||||
::rust::Slice(convert<loot::rust::File>(metadata.GetRequirements())));
|
||||
output->set_incompatibilities(::rust::Slice(
|
||||
convert<loot::rust::File>(metadata.GetIncompatibilities())));
|
||||
output->set_messages(
|
||||
::rust::Slice(convert<loot::rust::Message>(metadata.GetMessages())));
|
||||
output->set_tags(
|
||||
::rust::Slice(convert<loot::rust::Tag>(metadata.GetTags())));
|
||||
output->set_dirty_info(::rust::Slice(
|
||||
convert<loot::rust::PluginCleaningData>(metadata.GetDirtyInfo())));
|
||||
output->set_clean_info(::rust::Slice(
|
||||
convert<loot::rust::PluginCleaningData>(metadata.GetCleanInfo())));
|
||||
convert<loot::rust::File>(metadata.GetRequirements()));
|
||||
output->set_incompatibilities(
|
||||
convert<loot::rust::File>(metadata.GetIncompatibilities()));
|
||||
output->set_messages(convert<loot::rust::Message>(metadata.GetMessages()));
|
||||
output->set_tags(convert<loot::rust::Tag>(metadata.GetTags()));
|
||||
output->set_dirty_info(
|
||||
convert<loot::rust::PluginCleaningData>(metadata.GetDirtyInfo()));
|
||||
output->set_clean_info(
|
||||
convert<loot::rust::PluginCleaningData>(metadata.GetCleanInfo()));
|
||||
output->set_locations(
|
||||
::rust::Slice(convert<loot::rust::Location>(metadata.GetLocations())));
|
||||
convert<loot::rust::Location>(metadata.GetLocations()));
|
||||
|
||||
return output;
|
||||
} catch (const ::rust::Error& e) {
|
||||
|
||||
@@ -83,8 +83,13 @@ std::vector<T> convert(const ::rust::Vec<U>& vec) {
|
||||
}
|
||||
|
||||
template<typename T, typename U>
|
||||
const std::vector<::rust::Box<T>> convert(const std::vector<U>& vec) {
|
||||
return convert<::rust::Box<T>, U>(::rust::Slice(vec));
|
||||
const ::rust::Vec<::rust::Box<T>> convert(const std::vector<U>& vec) {
|
||||
::rust::Vec<::rust::Box<T>> output;
|
||||
for (const auto& element : vec) {
|
||||
output.push_back(convert(element));
|
||||
}
|
||||
|
||||
return output;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -87,8 +87,7 @@ std::vector<Group> Database::GetUserGroups() const {
|
||||
|
||||
void Database::SetUserGroups(const std::vector<Group>& groups) {
|
||||
try {
|
||||
database_->set_user_groups(
|
||||
::rust::Slice(convert<loot::rust::Group>(groups)));
|
||||
database_->set_user_groups(convert<loot::rust::Group>(groups));
|
||||
} catch (const ::rust::Error& e) {
|
||||
std::rethrow_exception(mapError(e));
|
||||
}
|
||||
|
||||
+5
-2
@@ -138,8 +138,11 @@ impl Database {
|
||||
.collect())
|
||||
}
|
||||
|
||||
// This is ugly, but Group can't be held as a value in C++ and CXX doesn't support Vec<Box<Group>> as a parameter, so this can't take ownership of the input groups.
|
||||
pub fn set_user_groups(&self, groups: &[Box<Group>]) -> Result<(), VerboseError> {
|
||||
#[expect(
|
||||
clippy::vec_box,
|
||||
reason = "Group is an opaque type to C++ so needs to be held in a Box."
|
||||
)]
|
||||
pub fn set_user_groups(&self, groups: Vec<Box<Group>>) -> Result<(), VerboseError> {
|
||||
let groups = to_vec_of_unwrapped(groups);
|
||||
self.0
|
||||
.write()
|
||||
|
||||
+13
-12
@@ -118,6 +118,7 @@ impl TryFrom<ffi::LogLevel> for libloot::LogLevel {
|
||||
clippy::allow_attributes,
|
||||
clippy::multiple_unsafe_ops_per_block,
|
||||
clippy::needless_lifetimes,
|
||||
clippy::vec_box,
|
||||
reason = "Required by CXX. clippy::allow_attributes is because CXX doesn't support #[expect(...)]"
|
||||
)]
|
||||
#[cxx::bridge(namespace = "loot::rust")]
|
||||
@@ -273,7 +274,7 @@ mod ffi {
|
||||
|
||||
pub fn user_groups(&self) -> Result<Vec<Group>>;
|
||||
|
||||
pub fn set_user_groups(&self, groups: &[Box<Group>]) -> Result<()>;
|
||||
pub fn set_user_groups(&self, groups: Vec<Box<Group>>) -> Result<()>;
|
||||
|
||||
pub fn groups_path(
|
||||
&self,
|
||||
@@ -315,7 +316,7 @@ mod ffi {
|
||||
|
||||
pub fn multilingual_message(
|
||||
message_type: MessageType,
|
||||
contents: &[Box<MessageContent>],
|
||||
contents: Vec<Box<MessageContent>>,
|
||||
condition: &str,
|
||||
) -> Result<Box<Message>>;
|
||||
|
||||
@@ -466,21 +467,21 @@ mod ffi {
|
||||
|
||||
pub fn unset_group(&mut self);
|
||||
|
||||
pub fn set_load_after_files(&mut self, files: &[Box<File>]);
|
||||
pub fn set_load_after_files(&mut self, files: Vec<Box<File>>);
|
||||
|
||||
pub fn set_requirements(&mut self, files: &[Box<File>]);
|
||||
pub fn set_requirements(&mut self, files: Vec<Box<File>>);
|
||||
|
||||
pub fn set_incompatibilities(&mut self, files: &[Box<File>]);
|
||||
pub fn set_incompatibilities(&mut self, files: Vec<Box<File>>);
|
||||
|
||||
pub fn set_messages(&mut self, messages: &[Box<Message>]);
|
||||
pub fn set_messages(&mut self, messages: Vec<Box<Message>>);
|
||||
|
||||
pub fn set_tags(&mut self, tags: &[Box<Tag>]);
|
||||
pub fn set_tags(&mut self, tags: Vec<Box<Tag>>);
|
||||
|
||||
pub fn set_dirty_info(&mut self, info: &[Box<PluginCleaningData>]);
|
||||
pub fn set_dirty_info(&mut self, info: Vec<Box<PluginCleaningData>>);
|
||||
|
||||
pub fn set_clean_info(&mut self, info: &[Box<PluginCleaningData>]);
|
||||
pub fn set_clean_info(&mut self, info: Vec<Box<PluginCleaningData>>);
|
||||
|
||||
pub fn set_locations(&mut self, locations: &[Box<Location>]);
|
||||
pub fn set_locations(&mut self, locations: Vec<Box<Location>>);
|
||||
|
||||
pub fn merge_metadata(&mut self, plugin: &PluginMetadata);
|
||||
|
||||
@@ -502,7 +503,7 @@ mod ffi {
|
||||
name: String,
|
||||
display_name: &str,
|
||||
condition: &str,
|
||||
detail: &[Box<MessageContent>],
|
||||
detail: Vec<Box<MessageContent>>,
|
||||
constraint: &str,
|
||||
) -> Result<Box<File>>;
|
||||
|
||||
@@ -565,7 +566,7 @@ mod ffi {
|
||||
pub fn new_plugin_cleaning_data(
|
||||
crc: u32,
|
||||
cleaning_utility: String,
|
||||
detail: &[Box<MessageContent>],
|
||||
detail: Vec<Box<MessageContent>>,
|
||||
itm_count: u32,
|
||||
deleted_reference_count: u32,
|
||||
deleted_navmesh_count: u32,
|
||||
|
||||
+57
-13
@@ -141,9 +141,13 @@ pub fn new_message(
|
||||
Ok(Box::new(Message(message)))
|
||||
}
|
||||
|
||||
#[expect(
|
||||
clippy::vec_box,
|
||||
reason = "MessageContent is an opaque type to C++ so needs to be held in a Box."
|
||||
)]
|
||||
pub fn multilingual_message(
|
||||
message_type: MessageType,
|
||||
contents: &[Box<MessageContent>],
|
||||
contents: Vec<Box<MessageContent>>,
|
||||
condition: &str,
|
||||
) -> Result<Box<Message>, VerboseError> {
|
||||
let contents = to_vec_of_unwrapped(contents);
|
||||
@@ -306,35 +310,67 @@ impl PluginMetadata {
|
||||
Location::wrap_slice(self.0.locations())
|
||||
}
|
||||
|
||||
pub fn set_load_after_files(&mut self, files: &[Box<File>]) {
|
||||
#[expect(
|
||||
clippy::vec_box,
|
||||
reason = "File is an opaque type to C++ so needs to be held in a Box."
|
||||
)]
|
||||
pub fn set_load_after_files(&mut self, files: Vec<Box<File>>) {
|
||||
self.0.set_load_after_files(to_vec_of_unwrapped(files));
|
||||
}
|
||||
|
||||
pub fn set_requirements(&mut self, files: &[Box<File>]) {
|
||||
#[expect(
|
||||
clippy::vec_box,
|
||||
reason = "File is an opaque type to C++ so needs to be held in a Box."
|
||||
)]
|
||||
pub fn set_requirements(&mut self, files: Vec<Box<File>>) {
|
||||
self.0.set_requirements(to_vec_of_unwrapped(files));
|
||||
}
|
||||
|
||||
pub fn set_incompatibilities(&mut self, files: &[Box<File>]) {
|
||||
#[expect(
|
||||
clippy::vec_box,
|
||||
reason = "File is an opaque type to C++ so needs to be held in a Box."
|
||||
)]
|
||||
pub fn set_incompatibilities(&mut self, files: Vec<Box<File>>) {
|
||||
self.0.set_incompatibilities(to_vec_of_unwrapped(files));
|
||||
}
|
||||
|
||||
pub fn set_messages(&mut self, messages: &[Box<Message>]) {
|
||||
#[expect(
|
||||
clippy::vec_box,
|
||||
reason = "Message is an opaque type to C++ so needs to be held in a Box."
|
||||
)]
|
||||
pub fn set_messages(&mut self, messages: Vec<Box<Message>>) {
|
||||
self.0.set_messages(to_vec_of_unwrapped(messages));
|
||||
}
|
||||
|
||||
pub fn set_tags(&mut self, tags: &[Box<Tag>]) {
|
||||
#[expect(
|
||||
clippy::vec_box,
|
||||
reason = "Tag is an opaque type to C++ so needs to be held in a Box."
|
||||
)]
|
||||
pub fn set_tags(&mut self, tags: Vec<Box<Tag>>) {
|
||||
self.0.set_tags(to_vec_of_unwrapped(tags));
|
||||
}
|
||||
|
||||
pub fn set_dirty_info(&mut self, info: &[Box<PluginCleaningData>]) {
|
||||
#[expect(
|
||||
clippy::vec_box,
|
||||
reason = "PluginCleaningData is an opaque type to C++ so needs to be held in a Box."
|
||||
)]
|
||||
pub fn set_dirty_info(&mut self, info: Vec<Box<PluginCleaningData>>) {
|
||||
self.0.set_dirty_info(to_vec_of_unwrapped(info));
|
||||
}
|
||||
|
||||
pub fn set_clean_info(&mut self, info: &[Box<PluginCleaningData>]) {
|
||||
#[expect(
|
||||
clippy::vec_box,
|
||||
reason = "PluginCleaningData is an opaque type to C++ so needs to be held in a Box."
|
||||
)]
|
||||
pub fn set_clean_info(&mut self, info: Vec<Box<PluginCleaningData>>) {
|
||||
self.0.set_clean_info(to_vec_of_unwrapped(info));
|
||||
}
|
||||
|
||||
pub fn set_locations(&mut self, locations: &[Box<Location>]) {
|
||||
#[expect(
|
||||
clippy::vec_box,
|
||||
reason = "Location is an opaque type to C++ so needs to be held in a Box."
|
||||
)]
|
||||
pub fn set_locations(&mut self, locations: Vec<Box<Location>>) {
|
||||
self.0.set_locations(to_vec_of_unwrapped(locations));
|
||||
}
|
||||
|
||||
@@ -381,11 +417,15 @@ impl From<Box<PluginMetadata>> for libloot::metadata::PluginMetadata {
|
||||
#[repr(transparent)]
|
||||
pub struct File(libloot::metadata::File);
|
||||
|
||||
#[expect(
|
||||
clippy::vec_box,
|
||||
reason = "File is an opaque type to C++ so needs to be held in a Box."
|
||||
)]
|
||||
pub fn new_file(
|
||||
name: String,
|
||||
display_name: &str,
|
||||
condition: &str,
|
||||
detail: &[Box<MessageContent>],
|
||||
detail: Vec<Box<MessageContent>>,
|
||||
constraint: &str,
|
||||
) -> Result<Box<File>, VerboseError> {
|
||||
let mut file = libloot::metadata::File::new(name);
|
||||
@@ -534,10 +574,14 @@ impl TryFrom<TagSuggestion> for libloot::metadata::TagSuggestion {
|
||||
#[repr(transparent)]
|
||||
pub struct PluginCleaningData(libloot::metadata::PluginCleaningData);
|
||||
|
||||
#[expect(
|
||||
clippy::vec_box,
|
||||
reason = "PluginCleaningData is an opaque type to C++ so needs to be held in a Box."
|
||||
)]
|
||||
pub fn new_plugin_cleaning_data(
|
||||
crc: u32,
|
||||
cleaning_utility: String,
|
||||
detail: &[Box<MessageContent>],
|
||||
detail: Vec<Box<MessageContent>>,
|
||||
itm_count: u32,
|
||||
deleted_reference_count: u32,
|
||||
deleted_navmesh_count: u32,
|
||||
@@ -630,6 +674,6 @@ impl From<Box<Location>> for libloot::metadata::Location {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn to_vec_of_unwrapped<T: Clone, U: From<Box<T>>>(slice: &[Box<T>]) -> Vec<U> {
|
||||
slice.iter().cloned().map(Into::into).collect()
|
||||
pub fn to_vec_of_unwrapped<T: Clone, U: From<Box<T>>>(vec: Vec<Box<T>>) -> Vec<U> {
|
||||
vec.into_iter().map(Into::into).collect()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user