def test_insertion_filter__compound__filter_members(cpp_class):
    insertion_filter = InsertionFilter(members={"kind": "variable"})

    member_names = [
        member.name for member in insertion_filter.members(cpp_class)
    ]
    assert sorted(member_names) == sorted([
        "PublicVariable",
        "ProtectedVariable",
        "PrivateVariable",
    ])
def test_insertion_filter__compound__no_filters(cpp_class):
    insertion_filter = InsertionFilter()

    member_names = [
        member.name for member in insertion_filter.members(cpp_class)
    ]
    assert sorted(member_names) == sorted([
        "PublicVariable", "PublicEnum", "PublicClass", "PublicTypedef",
        "PublicStruct", "PublicTrash", "PublicEnumvalue", "MyClass", "MyClass",
        "MyClass", "MyClass", "MyClass", "MyClass", "MyClass", "operator++",
        "PublicMethod", "PublicStaticMethod", "ProtectedVariable",
        "ProtectedEnum", "ProtectedClass", "ProtectedTypedef",
        "ProtectedStruct", "ProtectedTrash", "ProtectedEnumvalue", "MyClass",
        "operator++", "ProtectedMethod", "ProtectedStaticMethod",
        "PrivateVariable", "PrivateEnum", "PrivateClass", "PrivateTypedef",
        "PrivateStruct", "PrivateTrash", "PrivateEnumvalue", "MyClass",
        "operator++", "PrivateMethod", "PrivateStaticMethod", "operator=",
        "operator=", "operator=", "operator=", "operator=", "operator=",
        "~MyClass", "~MyClass", "~MyClass"
    ])
Exemple #3
0
def public_variables(element, insert_filter: InsertionFilter):
    return (m for m in insert_filter.members(element)
            if m.kind == "variable" and not m.name.startswith("_"))
Exemple #4
0
def public_constructors(element, insert_filter: InsertionFilter):
    return (m for m in insert_filter.members(element)
            if m.kind == "function" and m.name == "__init__")
Exemple #5
0
def public_methods(element, insert_filter: InsertionFilter):
    return (m for m in insert_filter.members(element)
            if (m.kind == "function" and m.returns
                and not m.name.startswith("_") and not m.static))
Exemple #6
0
def enums(element, insert_filter: InsertionFilter):
    # enum types generated by SWIG contain other members that do not need to be documented.
    # We want to filter and document only enum fields.
    return (m for m in insert_filter.members(element)
            if (m.kind == "variable" and m.prot == "public"))
Exemple #7
0
def public_constants(element, insert_filter: InsertionFilter):
    return (m for m in insert_filter.members(element)
            if (m.kind == "variable" and m.prot == "public" and m.returns
                and m.returns.type and m.returns.type.prefix
                and "final" in m.returns.type.prefix))
Exemple #8
0
def public_constructors(element, insert_filter: InsertionFilter):
    constructor_name = element.name
    return (m for m in insert_filter.members(element) if m.kind == "function"
            and m.name == constructor_name and m.prot == "public")
Exemple #9
0
def public_static_methods(element, insert_filter: InsertionFilter):
    return (m for m in insert_filter.members(element)
            if (m.kind == "function" and m.returns and m.prot == "public"
                and m.static))
Exemple #10
0
def public_variables(element, insert_filter: InsertionFilter):
    return (m for m in insert_filter.members(element)
            if m.kind == "variable" and m.prot == "public")
Exemple #11
0
def public_simple_enclosed_types(element, insert_filter: InsertionFilter):
    return (m for m in insert_filter.members(element)
            if m.prot in ("public", "protected",
                          None) and m.kind in ["enum", "typedef"])