mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2026-05-30 02:50:06 +08:00
GP-5436: Move AsyncComm remains into Generic
This commit is contained in:
@@ -0,0 +1 @@
|
||||
MODULE FILE LICENSE: lib/protobuf-java-3.21.8.jar BSD-3-GOOGLE
|
||||
|
||||
@@ -24,6 +24,7 @@ eclipse.project.name = 'Debug ProposedUtils'
|
||||
// val autoServiceVersion = "1.0-rc5"
|
||||
|
||||
dependencies {
|
||||
api 'com.google.protobuf:protobuf-java:3.21.8'
|
||||
api project(':DB')
|
||||
api project(':Project')
|
||||
api project(':SoftwareModeling')
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
##VERSION: 2.0
|
||||
##MODULE IP: BSD-3-GOOGLE
|
||||
Module.manifest||GHIDRA||||END|
|
||||
README.md||GHIDRA||||END|
|
||||
build.gradle||GHIDRA||||END|
|
||||
|
||||
+33
-2
@@ -4,9 +4,9 @@
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
@@ -24,6 +24,7 @@ import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.*;
|
||||
|
||||
import ghidra.async.AsyncReference;
|
||||
import ghidra.framework.options.SaveState;
|
||||
import ghidra.framework.plugintool.annotation.AutoConfigStateField;
|
||||
import ghidra.framework.plugintool.annotation.AutoConfigStateField.DefaultConfigFieldCodec;
|
||||
@@ -372,6 +373,36 @@ public interface AutoConfigState {
|
||||
}
|
||||
}
|
||||
|
||||
static class GenericAsyncConfigFieldCodec<T>
|
||||
implements ConfigFieldCodec<AsyncReference<T, ?>> {
|
||||
private ConfigFieldCodec<T> codec;
|
||||
|
||||
public GenericAsyncConfigFieldCodec(ConfigFieldCodec<T> codec) {
|
||||
this.codec = codec;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AsyncReference<T, ?> read(SaveState state, String name,
|
||||
AsyncReference<T, ?> current) {
|
||||
current.set(codec.read(state, name, current.get()), null);
|
||||
return current;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(SaveState state, String name, AsyncReference<T, ?> value) {
|
||||
codec.write(state, name, value.get());
|
||||
}
|
||||
}
|
||||
|
||||
static class BooleanAsyncConfigFieldCodec
|
||||
extends GenericAsyncConfigFieldCodec<Boolean> {
|
||||
public BooleanAsyncConfigFieldCodec() {
|
||||
super(BooleanConfigFieldCodec.INSTANCE);
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: Other async types as needed
|
||||
|
||||
class ConfigStateField<T> {
|
||||
private static final Map<Class<?>, ConfigFieldCodec<?>> CODECS_BY_TYPE = new HashMap<>();
|
||||
private static final Map<Class<?>, ConfigFieldCodec<?>> CODECS_BY_SPEC = new HashMap<>();
|
||||
|
||||
Reference in New Issue
Block a user