GP-0 Expose StandAloneDataTypeManager from

DataTypeArchive.getDataTypeManager to allow architecture manipulation
This commit is contained in:
ghidra1 2025-04-08 14:57:51 -04:00
parent 694b3b46ce
commit b5ccf1f063
2 changed files with 12 additions and 22 deletions

View file

@ -4,9 +4,9 @@
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@ -26,7 +26,8 @@ import ghidra.framework.data.OpenMode;
import ghidra.framework.model.DomainFile; import ghidra.framework.model.DomainFile;
import ghidra.framework.model.DomainFolder; import ghidra.framework.model.DomainFolder;
import ghidra.framework.options.Options; import ghidra.framework.options.Options;
import ghidra.program.model.data.*; import ghidra.program.model.data.PointerDataType;
import ghidra.program.model.data.StandAloneDataTypeManager;
import ghidra.program.model.listing.DataTypeArchive; import ghidra.program.model.listing.DataTypeArchive;
import ghidra.program.model.listing.Program; import ghidra.program.model.listing.Program;
import ghidra.program.util.ProgramChangeRecord; import ghidra.program.util.ProgramChangeRecord;
@ -255,26 +256,17 @@ public class DataTypeArchiveDB extends DomainObjectAdapterDB implements DataType
return pointerSize > 0 && pointerSize <= PointerDataType.MAX_POINTER_SIZE_BYTES; return pointerSize > 0 && pointerSize <= PointerDataType.MAX_POINTER_SIZE_BYTES;
} }
/**
* @see ghidra.program.model.listing.Program#getDataTypeManager()
*/
@Override @Override
public DataTypeManager getDataTypeManager() { public ProjectDataTypeManager getDataTypeManager() {
return dataTypeManager; return dataTypeManager;
} }
/**
* @see ghidra.program.model.listing.Program#getCreationDate()
*/
@Override @Override
public Date getCreationDate() { public Date getCreationDate() {
Options pl = getOptions(ARCHIVE_INFO); Options pl = getOptions(ARCHIVE_INFO);
return pl.getDate(DATE_CREATED, new Date(0)); return pl.getDate(DATE_CREATED, new Date(0));
} }
/**
* @see ghidra.program.model.listing.Program#getDefaultPointerSize()
*/
@Override @Override
public int getDefaultPointerSize() { public int getDefaultPointerSize() {
// Not sure what size this should be so use 4 for now. // Not sure what size this should be so use 4 for now.
@ -283,9 +275,6 @@ public class DataTypeArchiveDB extends DomainObjectAdapterDB implements DataType
return pl.getInt(DEFAULT_POINTER_SIZE, 4); return pl.getInt(DEFAULT_POINTER_SIZE, 4);
} }
/**
* @see ghidra.program.model.listing.Program#getChanges()
*/
@Override @Override
public DataTypeArchiveDBChangeSet getChanges() { public DataTypeArchiveDBChangeSet getChanges() {
return (DataTypeArchiveDBChangeSet) changeSet; return (DataTypeArchiveDBChangeSet) changeSet;

View file

@ -4,9 +4,9 @@
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@ -18,6 +18,7 @@ package ghidra.program.model.listing;
import java.util.Date; import java.util.Date;
import ghidra.program.model.data.DataTypeManagerDomainObject; import ghidra.program.model.data.DataTypeManagerDomainObject;
import ghidra.program.model.data.StandAloneDataTypeManager;
/** /**
* This interface represents the main entry point into an object which * This interface represents the main entry point into an object which
@ -37,11 +38,11 @@ public interface DataTypeArchive extends DataTypeManagerDomainObject {
public static final Date JANUARY_1_1970 = new Date(0); public static final Date JANUARY_1_1970 = new Date(0);
/** /**
* Determine if this archive has exclusive-write access which may be neccessary for some * Gets the associated standalone data type manager.
* operations. * @return the data type manager.
* @return true if archive has exclusive-write access
*/ */
public boolean hasExclusiveAccess(); @Override
public StandAloneDataTypeManager getDataTypeManager();
/** /**
* Gets the default pointer size as it may be stored within the data type archive. * Gets the default pointer size as it may be stored within the data type archive.