Sha256: 6884ab4afa8d58c38bb316f2d22b54b0bee8d479267f77e4e5035722b896b069

Contents?: true

Size: 1.17 KB

Versions: 17

Compression:

Stored size: 1.17 KB

Contents

#include "ruby_libxml.h"
#include "ruby_xml_schema_facet.h"

#include <libxml/schemasInternals.h>
#include <libxml/xmlschemas.h>
#include <libxml/xmlschemastypes.h>

VALUE cXMLSchemaFacet;

static void rxml_schema_facet_free(xmlSchemaFacetPtr xschema_type)
{
  xschema_type = NULL;
  xmlFree(xschema_type);
}

VALUE rxml_wrap_schema_facet(xmlSchemaFacetPtr facet)
{
  VALUE result;

  if (!facet)
    rb_raise(rb_eArgError, "XML::Schema::Facet required!");

  result = Data_Wrap_Struct(cXMLSchemaFacet, NULL, rxml_schema_facet_free, facet);

  rb_iv_set(result, "@kind", INT2NUM(facet->type));
  rb_iv_set(result, "@value", QNIL_OR_STRING(facet->value));

  return result;

}

/* START FACET*/

static VALUE rxml_schema_facet_node(VALUE self)
{
  xmlSchemaFacetPtr facet;

  Data_Get_Struct(self, xmlSchemaFacet, facet);

  return rxml_node_wrap(facet->node);
}

void rxml_init_schema_facet(void)
{
  cXMLSchemaFacet = rb_define_class_under(cXMLSchema, "Facet", rb_cObject);
  rb_define_attr(cXMLSchemaFacet, "kind", 1, 0);
  rb_define_attr(cXMLSchemaFacet, "value", 1, 0);

  rb_define_method(cXMLSchemaFacet, "node", rxml_schema_facet_node, 0);
}

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
libxml-ruby-5.0.3-x64-mingw-ucrt ext/libxml/ruby_xml_schema_facet.c
libxml-ruby-5.0.3 ext/libxml/ruby_xml_schema_facet.c
libxml-ruby-5.0.2-x64-mingw-ucrt ext/libxml/ruby_xml_schema_facet.c
libxml-ruby-5.0.2 ext/libxml/ruby_xml_schema_facet.c
libxml-ruby-5.0.1-x64-mingw-ucrt ext/libxml/ruby_xml_schema_facet.c
libxml-ruby-5.0.1 ext/libxml/ruby_xml_schema_facet.c
libxml-ruby-5.0.0-x64-mingw-ucrt ext/libxml/ruby_xml_schema_facet.c
libxml-ruby-5.0.0 ext/libxml/ruby_xml_schema_facet.c
libxml-ruby-4.1.2-x64-mingw-ucrt ext/libxml/ruby_xml_schema_facet.c
libxml-ruby-4.1.2 ext/libxml/ruby_xml_schema_facet.c
libxml-ruby-4.1.1-x64-mingw-ucrt ext/libxml/ruby_xml_schema_facet.c
libxml-ruby-4.1.1 ext/libxml/ruby_xml_schema_facet.c
libxml-ruby-4.1.0 ext/libxml/ruby_xml_schema_facet.c
libxml-ruby-4.0.0-x64-mingw-ucrt ext/libxml/ruby_xml_schema_facet.c
libxml-ruby-4.0.0 ext/libxml/ruby_xml_schema_facet.c
libxml-ruby-3.2.4-x64-mingw-ucrt ext/libxml/ruby_xml_schema_facet.c
libxml-ruby-3.2.4 ext/libxml/ruby_xml_schema_facet.c