Files
revng-revng/python/revng/api/string_map.py
Giacomo Vercesi 23286dc58f GraphQL: expose analysis options
Add an additional parameter that allows specifying options for analyses
as a serialized json string
2023-03-22 17:31:46 +01:00

21 lines
561 B
Python

#
# This file is distributed under the MIT License. See LICENSE.md for details.
#
from typing import Mapping
from ._capi import _api
from .utils import make_c_string
class StringMap:
def __init__(self, content: Mapping[str, str] | None = None):
self._string_map = _api.rp_string_map_create()
if content is not None:
for key, value in content.items():
self.add(key, value)
def add(self, key: str, value: str):
_api.rp_string_map_insert(self._string_map, make_c_string(key), make_c_string(value))