Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for doc-stability gir element #151

Merged
merged 1 commit into from
Nov 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
/* Java-GI - Java language bindings for GObject-Introspection-based libraries
* Copyright (C) 2022-2024 the Java-GI developers
*
* SPDX-License-Identifier: LGPL-2.1-or-later
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, see <http://www.gnu.org/licenses/>.
*/

package io.github.jwharm.javagi.gir;

public final class DocStability extends GirElement implements Documentation {

private final String text;

public DocStability(String text) {
this.text = text;
}

public String text() {
return text;
}

@Override
public boolean equals(Object obj) {
if (obj == this)
return true;
return obj != null && obj.getClass() == this.getClass();
}

@Override
public int hashCode() {
return 1;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

public sealed interface Documentation
extends Node
permits Doc, DocDeprecated, DocVersion {
permits Doc, DocDeprecated, DocVersion, DocStability {

String text();
Namespace namespace();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,8 @@ public CallableAttrs callableAttrs() {

public InfoElements infoElements() {
return new InfoElements(
attr("doc-version"),
attr("doc-stability"),
findAny(children, DocVersion.class),
findAny(children, DocStability.class),
findAny(children, Doc.class),
findAny(children, DocDeprecated.class),
findAny(children, SourcePosition.class),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,7 @@ && qname(event.asEndElement().getName()).equals(elemName)) {
case "doc" -> new Doc(attributes, contents.toString().trim());
case "docsection" -> new Docsection(attributes, children);
case "doc-deprecated" -> new DocDeprecated(contents.toString().trim());
case "doc-stability" -> new DocStability(contents.toString().trim());
case "doc-version" -> new DocVersion(contents.toString().trim());
case "enumeration" -> new Enumeration(attributes, children, platform);
case "field" -> new Field(attributes, children);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
import java.util.List;

public record InfoElements(
String docVersion,
String docStability,
DocVersion docVersion,
DocStability docStability,
Doc doc,
DocDeprecated docDeprecated,
SourcePosition sourcePosition,
Expand Down