from coda.compiler import genbase
from coda import types
import os

class TypeNameFormatter:
  def __init__(self, gen):
    self.gen = gen

  def __call__(self, struct, useActual=True):
    '''@type struct: coda.descriptors.StructType'''
    name = struct.getName()
    while struct.getEnclosingType():
      struct = struct.getEnclosingType()
      name = struct.getName() + '.' + name
    fd = struct.getFile()
    if fd and fd is not self.fd:
      package = self.gen.getFilePackage(fd)
      if package:
        name = package + '.' + name
        for fullname, localname in self.gen.localNames.items():
          if name.startswith(fullname):