Skip to content

Commit

Permalink
Merge pull request #151 from jwharm/doc-stability
Browse files Browse the repository at this point in the history
Add support for doc-stability gir element
  • Loading branch information
jwharm authored Nov 14, 2024
2 parents 804f3e8 + 9ecde79 commit 912ba18
Show file tree
Hide file tree
Showing 5 changed files with 51 additions and 5 deletions.
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

0 comments on commit 912ba18

Please sign in to comment.