A type decoder for Objective-C types
Project description
objc-types-decoder
A type decoder for Objective-C types.
It translates the encoded Objective-C type notation, the notation that the @encode
function returns, into a readable
form that tries to be as close as possible to the original type definition.
For example, lets look at the following @encode
:
NSLog(@"%s", @encode(float **)); // "^^f" will be printed.
Using our decoder, we can "reverse" the process:
from objc_types_decoder.decode import decode
print(decode('^^f')) # 'float * *' will be printed.
Installation
In order to install this package, just use a regular pip
installation:
pip install objc_types_decoder
Usage
In order to use the decoder, just run the main with your desired encoded type:
>> py -m objc_types_decoder ^f
float *
You can also decode by importing it in your python code:
>> from objc_types_decoder.decode import decode
>> decode('{NSObject=#}')
'struct NSObject { Class x0; }'
Sometimes, you might want to keep the tail of the parsed data. For this case, you can use decode_with_tail
.
>> from objc_types_decoder.decode import decode_with_tail
>> decode_with_tail('fyour boat')
('float', 'your boat')
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file objc_types_decoder-0.0.5.tar.gz
.
File metadata
- Download URL: objc_types_decoder-0.0.5.tar.gz
- Upload date:
- Size: 5.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2a48bfe9814ad8b3a1cc45bd1b243c3dbc641b53982b22625265ba1eaa2c746b |
|
MD5 | dae117dc22e07c2a48a392495abbc0f9 |
|
BLAKE2b-256 | 5cd15eee97966da549b0fd48504ddedc8fb26a647e7d5bedde43769a512e58c2 |
File details
Details for the file objc_types_decoder-0.0.5-py3-none-any.whl
.
File metadata
- Download URL: objc_types_decoder-0.0.5-py3-none-any.whl
- Upload date:
- Size: 6.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f675954ae1851b8e6cab36cfa6a540eb328ce523d5b8b8109800f16594965980 |
|
MD5 | 21b879d322343065820a83387c75afc0 |
|
BLAKE2b-256 | 032437a4d150edaa22259c199a550ea8764ed94ebdecb28492507f200b616aeb |