Package ghidra.app.util.bin.format.golang.rtti

# Class GoName

java.lang.Object
ghidra.app.util.bin.format.golang.rtti.GoName

All Implemented Interfaces:
  `StructureMarkup<GoName>`, `StructureReader<GoName>`

public class GoName extends Object implements StructureReader<GoName>, StructureMarkup<GoName>
Represents a golang "name" construct, which isn't represented in go as a normal structure since it is full of variable length and optional fields.

     struct {
            byte flag;
            varint strlen;
            char[strlen] chars;
            (optional: varint tag_strlen; char [tag_strlen];)
            (optional: int32 pkgpath)
     }

Because this type has variable length fields (@FieldOutput(isVariableLength=true)), there will be unique structure data types produced for each size combination of a GoName structure, and will be named "GoName_N_M", where N and M are the lengths of the variable fields [name, tag]

- ## Nested Class Summary

  Nested Classes
  Modifier and Type
  Class
  Description
  `static enum`
  `GoName.Flag`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `GoName()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `static GoName`
  `createFakeInstance(String fakeName)`
  Create a GoName instance that supplies a specified name.
  `int`
  `getFlags()`
  Returns the flags found in this structure.
  `Set<GoName.Flag>`
  `getFlagsSet()`
  Returns the flags found in this structure.
  `String`
  `getFullNameString()`
  Returns a descriptive string containing the full name value.
  `String`
  `getName()`
  Returns the name value.
  `GoName`
  `getPkgPath()`
  Returns the package path string, or null if not present.
  `DataType`
  `getPkgPathDataType()`
  Returns the data type needed to store the pkg path offset field, called by serialization from the fieldoutput annotation.
  `StructureContext<GoName>`
  `getStructureContext()`
  `String`
  `getStructureName()`
  Returns the name of the instance, typically retrieved from data found inside the instance.
  `String`
  `getTag()`
  Returns the tag string.
  `void`
  `readStructure()`
  Called after an instance has been created and its context has been initialized.
  `String`
  `toString()`

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

  ### Methods inherited from interface ghidra.app.util.bin.format.golang.structmapping.StructureMarkup

  `additionalMarkup, getExternalInstancesToMarkup, getStructureLabel, getStructureNamespace`

- ## Constructor Details

  - ### GoName

    public GoName()

- ## Method Details

  - ### readStructure

    public void readStructure() throws IOException
    Description copied from interface: `StructureReader`
    Called after an instance has been created and its context has been initialized.
    Specified by:
      `readStructure` in interface `StructureReader<GoName>`
    Throws:
      `IOException`

  - ### getName

    public String getName()
    Returns the name value.
    Returns:
      name string

  - ### getTag

    public String getTag()
    Returns the tag string.
    Returns:
      tag string

  - ### getPkgPath

    public GoName getPkgPath() throws IOException
    Returns the package path string, or null if not present.
    Returns:
      package path string, or null if not present
    Throws:
      `IOException` - if error reading data

  - ### getPkgPathDataType

    public DataType getPkgPathDataType()
    Returns the data type needed to store the pkg path offset field, called by serialization from the fieldoutput annotation.
    Returns:
      Ghidra data type needed to store the pkg path offset field, or null if not present

  - ### getFullNameString

    public String getFullNameString()
    Returns a descriptive string containing the full name value.
    Returns:
      descriptive string

  - ### getFlags

    public int getFlags()
    Returns the flags found in this structure.
    Returns:
      flags, as an int

  - ### getFlagsSet

    public Set<GoName.Flag> getFlagsSet()
    Returns the flags found in this structure.
    Returns:
      flags, as a set of `GoName.Flag` enum values

  - ### getStructureContext

    public StructureContext<GoName> getStructureContext()
    Specified by:
      `getStructureContext` in interface `StructureMarkup<GoName>`

  - ### getStructureName

    public String getStructureName() throws IOException
    Description copied from interface: `StructureMarkup`
    Returns the name of the instance, typically retrieved from data found inside the instance.
    Specified by:
      `getStructureName` in interface `StructureMarkup<GoName>`
    Returns:
      string name, or null if this instance does not have a name
    Throws:
      `IOException` - if error getting name

  - ### toString

    public String toString()
    Overrides:
      `toString` in class `Object`

  - ### createFakeInstance

    public static GoName createFakeInstance(String fakeName)
    Create a GoName instance that supplies a specified name.
    Parameters:
      `fakeName` - string name to return from the GoName's getName()
    Returns:
      new GoName instance that can only be used to call getName()