objc-types-decoder


Nameobjc-types-decoder JSON
Version 0.0.5 PyPI version JSON
download
home_page
SummaryA type decoder for Objective-C types
upload_time2023-05-12 08:26:21
maintainer
docs_urlNone
author
requires_python>=3.7
licenseMIT License Copyright (c) 2021 Matan Perelman Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
keywords ios objective-c
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # objc-types-decoder

[![Python application](https://github.com/matan1008/objc-types-decoder/workflows/Python%20application/badge.svg)](https://github.com/matan1008/objc-types-decoder/actions/workflows/python-app.yml "Python application action")
[![Pypi version](https://img.shields.io/pypi/v/objc-types-decoder.svg)](https://pypi.org/project/objc-types-decoder/ "PyPi package")
[![Downloads](https://static.pepy.tech/personalized-badge/objc-types-decoder?period=total&units=none&left_color=grey&right_color=blue&left_text=Downloads)](https://pepy.tech/project/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`:

```objective-c
NSLog(@"%s", @encode(float **)); // "^^f" will be printed.
```

Using our decoder, we can "reverse" the process:

```python
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:

```shell
pip install objc_types_decoder
```

## Usage

In order to use the decoder, just run the main with your desired encoded type:

```shell
>> py -m objc_types_decoder ^f
float *
```

You can also decode by importing it in your python code:

```python
>> 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`.

```python
>> from objc_types_decoder.decode import decode_with_tail
>> decode_with_tail('fyour boat')
('float', 'your boat')
```


            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "objc-types-decoder",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.7",
    "maintainer_email": "matan <matan1008@gmail.com>",
    "keywords": "ios,Objective-C",
    "author": "",
    "author_email": "matan <matan1008@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/5c/d1/5eee97966da549b0fd48504ddedc8fb26a647e7d5bedde43769a512e58c2/objc_types_decoder-0.0.5.tar.gz",
    "platform": null,
    "description": "# objc-types-decoder\n\n[![Python application](https://github.com/matan1008/objc-types-decoder/workflows/Python%20application/badge.svg)](https://github.com/matan1008/objc-types-decoder/actions/workflows/python-app.yml \"Python application action\")\n[![Pypi version](https://img.shields.io/pypi/v/objc-types-decoder.svg)](https://pypi.org/project/objc-types-decoder/ \"PyPi package\")\n[![Downloads](https://static.pepy.tech/personalized-badge/objc-types-decoder?period=total&units=none&left_color=grey&right_color=blue&left_text=Downloads)](https://pepy.tech/project/objc-types-decoder)\n\n\nA type decoder for Objective-C types.\n\nIt translates the encoded Objective-C type notation, the notation that the `@encode` function returns, into a readable\nform that tries to be as close as possible to the original type definition.\n\nFor example, lets look at the following `@encode`:\n\n```objective-c\nNSLog(@\"%s\", @encode(float **)); // \"^^f\" will be printed.\n```\n\nUsing our decoder, we can \"reverse\" the process:\n\n```python\nfrom objc_types_decoder.decode import decode\n\nprint(decode('^^f'))  # 'float * *' will be printed.\n```\n\n## Installation\n\nIn order to install this package, just use a regular `pip` installation:\n\n```shell\npip install objc_types_decoder\n```\n\n## Usage\n\nIn order to use the decoder, just run the main with your desired encoded type:\n\n```shell\n>> py -m objc_types_decoder ^f\nfloat *\n```\n\nYou can also decode by importing it in your python code:\n\n```python\n>> from objc_types_decoder.decode import decode\n>> decode('{NSObject=#}')\n'struct NSObject { Class x0; }'\n```\n\nSometimes, you might want to keep the tail of the parsed data. For this case, you can use `decode_with_tail`.\n\n```python\n>> from objc_types_decoder.decode import decode_with_tail\n>> decode_with_tail('fyour boat')\n('float', 'your boat')\n```\n\n",
    "bugtrack_url": null,
    "license": "MIT License  Copyright (c) 2021 Matan Perelman  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:  The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ",
    "summary": "A type decoder for Objective-C types",
    "version": "0.0.5",
    "project_urls": {
        "Bug Reports": "https://github.com/matan1008/objc-types-decoder/issues",
        "Homepage": "https://github.com/matan1008/objc-types-decoder"
    },
    "split_keywords": [
        "ios",
        "objective-c"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "032437a4d150edaa22259c199a550ea8764ed94ebdecb28492507f200b616aeb",
                "md5": "21b879d322343065820a83387c75afc0",
                "sha256": "f675954ae1851b8e6cab36cfa6a540eb328ce523d5b8b8109800f16594965980"
            },
            "downloads": -1,
            "filename": "objc_types_decoder-0.0.5-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "21b879d322343065820a83387c75afc0",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.7",
            "size": 6185,
            "upload_time": "2023-05-12T08:26:19",
            "upload_time_iso_8601": "2023-05-12T08:26:19.906040Z",
            "url": "https://files.pythonhosted.org/packages/03/24/37a4d150edaa22259c199a550ea8764ed94ebdecb28492507f200b616aeb/objc_types_decoder-0.0.5-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "5cd15eee97966da549b0fd48504ddedc8fb26a647e7d5bedde43769a512e58c2",
                "md5": "dae117dc22e07c2a48a392495abbc0f9",
                "sha256": "2a48bfe9814ad8b3a1cc45bd1b243c3dbc641b53982b22625265ba1eaa2c746b"
            },
            "downloads": -1,
            "filename": "objc_types_decoder-0.0.5.tar.gz",
            "has_sig": false,
            "md5_digest": "dae117dc22e07c2a48a392495abbc0f9",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7",
            "size": 5773,
            "upload_time": "2023-05-12T08:26:21",
            "upload_time_iso_8601": "2023-05-12T08:26:21.985983Z",
            "url": "https://files.pythonhosted.org/packages/5c/d1/5eee97966da549b0fd48504ddedc8fb26a647e7d5bedde43769a512e58c2/objc_types_decoder-0.0.5.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-05-12 08:26:21",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "matan1008",
    "github_project": "objc-types-decoder",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "objc-types-decoder"
}
        
Elapsed time: 0.27238s