xo-facet: facet template [WIP]
This commit is contained in:
parent
1eea911890
commit
73c1b54d50
2 changed files with 90 additions and 0 deletions
47
idl/Sequence.json5
Normal file
47
idl/Sequence.json5
Normal file
|
|
@ -0,0 +1,47 @@
|
|||
{
|
||||
includes: ["<xo/gc/GCObject.hpp>"],
|
||||
namespace1: "xo",
|
||||
namespace2: "scm",
|
||||
facet: "Sequence",
|
||||
brief: "an ordered collection of variants",
|
||||
doc: [
|
||||
"Elements appear in some determinstic order.",
|
||||
"Sequence is GC-aware --> elements must be GC-aware"
|
||||
],
|
||||
methods: [
|
||||
// bool is_empty() const noexcept
|
||||
{
|
||||
name: "is_empty",
|
||||
doc: ["true iff sequence is empty"],
|
||||
return_type: "bool",
|
||||
args: [],
|
||||
const: true,
|
||||
noexcept: true,
|
||||
attributes: [],
|
||||
},
|
||||
|
||||
// bool is_finite() const noexcept
|
||||
{
|
||||
name: "is_finite",
|
||||
doc: ["true iff sequence is finite"],
|
||||
return_type: "bool",
|
||||
args: [],
|
||||
const: true,
|
||||
noexcept: true,
|
||||
attributes: [],
|
||||
},
|
||||
|
||||
// obj<AGCObject> at(size_type index) const;
|
||||
{
|
||||
name: "at",
|
||||
doc: ["return element @p index of this sequence"],
|
||||
return_type: "obj<AGCObject>",
|
||||
args: [
|
||||
{type: "size_type", name: "index"},
|
||||
],
|
||||
const: true,
|
||||
noexcept: false,
|
||||
attributes: [],
|
||||
},
|
||||
],
|
||||
}
|
||||
43
include/xo/object2/ASequence.hpp
Normal file
43
include/xo/object2/ASequence.hpp
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
/** @file ASequence.hpp
|
||||
*
|
||||
* Generated automagically from ingredients:
|
||||
* 1. code generator:
|
||||
* [/home/roland/proj/xo-umbrella2/xo-object2/../xo-facet/codegen/genfacet.py]
|
||||
* arguments:
|
||||
* --input [./idl/Sequence.json5]
|
||||
* 2. jinja2 template for abstract facet .hpp file:
|
||||
* [abstract_facet.hpp.j2]
|
||||
* 3. idl for facet methods
|
||||
* [./idl/Sequence.json5]
|
||||
**/
|
||||
|
||||
#pragma once
|
||||
|
||||
// includes (via {facet_includes})
|
||||
#include <xo/gc/GCObject.hpp>
|
||||
|
||||
namespace xo {
|
||||
namespace scm {
|
||||
|
||||
/**
|
||||
Elements appear in some determinstic order.
|
||||
Sequence is GC-aware --> elements must be GC-aware
|
||||
**/
|
||||
class ASequence {
|
||||
public:
|
||||
|
||||
/** true iff sequence is empty **/
|
||||
virtual bool is_empty() const noexcept = 0;
|
||||
|
||||
|
||||
/** true iff sequence is finite **/
|
||||
virtual bool is_finite() const noexcept = 0;
|
||||
|
||||
|
||||
/** return element @p index of this sequence **/
|
||||
virtual obj<AGCObject> at(size_type index) const = 0;
|
||||
|
||||
}; /*ASequence*/
|
||||
|
||||
} /*namespace scm*/
|
||||
} /*namespace xo*/
|
||||
Loading…
Add table
Add a link
Reference in a new issue