def __init__(self, cls, alloc=True): if isinstance(cls, (ObjCClass)): self.name = cls.class_name.decode('utf-8') if isinstance(cls, (ObjCInstance)): self.name = cls._get_objc_classname().decode('utf-8') if isinstance(cls, (str)): self.name = cls objects = class_objects(self.name, alloc) if alloc: self.get_methods() else: self.nethods = [] self.initializers = objects['Initializers'] if bundles.bundleForClass(self.name): self.bundleID = bundles.bundleForClass(self.name).bundleID else: self.bundleID = None self.alloc = alloc
def get_classes(): classes = {} classes['No Class'] = [] for i in ObjCClass.get_names(): if bundles.bundleForClass(i): try: if classes[bundles.bundleForClass(i).bundleID]: classes[bundles.bundleForClass(i).bundleID] += [i] else: classes[bundles.bundleForClass(i).bundleID] = [i] except KeyError: classes[bundles.bundleForClass(i).bundleID] = [i] else: classes['No Class'] += [i] clist = [] for k, v in classes.items(): clist += [[k, v]] return clist
def get_classes_for_bundle(bundle, regex=True, class_imfo=True, alloc=False): results = [] if isinstance(bundle, (str)) and regex: search = re.compile(bundle) if isinstance(bundle, (type(re.compile('')))): search = bundle for i in ObjCClass.get_names(): if bundles.bundleForClass(i): if regex: if isinstance(bundles.bundleForClass(i).bundleID, (str)): if search.match(bundles.bundleForClass(i).bundleID): results += [i] else: if isinstance(bundles.bundleForClass(i).bundleID, (str)): if bundle in bundles.bundleForClass(i).bundleID: results += [i] if class_imfo: results = [ObjCClassInfo(i) for i in results] return results
def get_frameworks(): flist = [] frameworks = {} frameworks['No Framework'] = {'bundle': None, 'items': []} for i in ObjCClass.get_names(): if bundles.bundleForClass(i): try: if frameworks[bundles.bundleForClass(i).bundleID]: frameworks[bundles.bundleForClass(i).bundleID]['items'] += [i] else: frameworks[bundles.bundleForClass(i).bundleID] = {'bundle': bundles.bundleForClass(i), 'items': [i]} except KeyError: frameworks[bundles.bundleForClass(i).bundleID] = {'bundle': bundles.bundleForClass(i), 'items': [i]} else: frameworks['No Framework']['items'] += [i] flist = sorted(frameworks.keys()) return {'flist': flist, 'frameworks': frameworks}