Beispiel #1
0
class OrderedMapPrinter(BaseMapPrinter):
    """Pretty-print Ada.Containers.Ordered_Maps.Map values."""

    name = "Ordered_Map"

    type_pattern = Match.TypeName(
        suffix=".map",
        pattern=Match.Struct(
            Match.Field("_parent"),
            Match.Field(
                "tree",
                get_rbtree_pattern(
                    Match.Struct(
                        Match.Field("parent", Match.Pointer()),
                        Match.Field("left", Match.Pointer()),
                        Match.Field("right", Match.Pointer()),
                        Match.Field("color", Match.Enum()),
                        Match.Field("key"),
                        Match.Field("element"),
                    )),
            ),
        ),
    )

    @property
    def length(self):
        return self.value["tree"]["length"]

    def get_node_iterator(self):
        return dfs(self.value["tree"])
Beispiel #2
0
class OrderedMapPrinter(BaseMapPrinter):
    """Pretty-print Ada.Containers.Ordered_Maps.Map values."""

    name = 'Ordered_Map'

    type_pattern = Match.TypeName(
        suffix='.map',
        pattern=Match.Struct(
            Match.Field('_parent'),
            Match.Field(
                'tree',
                get_rbtree_pattern(
                    Match.Struct(
                        Match.Field('parent', Match.Pointer()),
                        Match.Field('left', Match.Pointer()),
                        Match.Field('right', Match.Pointer()),
                        Match.Field('color', Match.Enum()),
                        Match.Field('key'),
                        Match.Field('element'),
                    ))),
        ))

    @property
    def length(self):
        return self.value['tree']['length']

    def get_node_iterator(self):
        return dfs(self.value['tree'])