diff --git a/hs-bindgen-libclang/cbits/doxygen_wrappers.h b/hs-bindgen-libclang/cbits/doxygen_wrappers.h index 5899504b..8d20187b 100644 --- a/hs-bindgen-libclang/cbits/doxygen_wrappers.h +++ b/hs-bindgen-libclang/cbits/doxygen_wrappers.h @@ -63,6 +63,34 @@ static inline void wrap_InlineCommandComment_getArgText(const CXComment* Comment *result = clang_InlineCommandComment_getArgText(*Comment, argIdx); } +/** + * Comment type 'CXComment_HTMLStartTag' and 'CXComment_HTMLEndTag' + */ + +static inline void wrap_HTMLTagComment_getTagName(const CXComment* Comment, CXString* result) { + *result = clang_HTMLTagComment_getTagName(*Comment); +} + +static inline unsigned wrap_HTMLStartTagComment_isSelfClosing(const CXComment* Comment) { + return clang_HTMLStartTagComment_isSelfClosing(*Comment); +} + +static inline unsigned wrap_HTMLStartTag_getNumAttrs(const CXComment* Comment) { + return clang_HTMLStartTag_getNumAttrs(*Comment); +} + +static inline void wrap_HTMLStartTag_getAttrName(const CXComment* Comment, unsigned attrIdx, CXString* result) { + *result = clang_HTMLStartTag_getAttrName(*Comment, attrIdx); +} + +static inline void wrap_HTMLStartTag_getAttrValue(const CXComment* Comment, unsigned attrIdx, CXString* result) { + *result = clang_HTMLStartTag_getAttrValue(*Comment, attrIdx); +} + +static inline void wrap_HTMLTagComment_getAsString(const CXComment* Comment, CXString* result) { + *result = clang_HTMLTagComment_getAsString(*Comment); +} + /** * Comment type 'CXComment_BlockCommand' */ diff --git a/hs-bindgen-libclang/src/HsBindgen/Clang/Doxygen.hs b/hs-bindgen-libclang/src/HsBindgen/Clang/Doxygen.hs index 798229ba..eff4a118 100644 --- a/hs-bindgen-libclang/src/HsBindgen/Clang/Doxygen.hs +++ b/hs-bindgen-libclang/src/HsBindgen/Clang/Doxygen.hs @@ -24,6 +24,13 @@ module HsBindgen.Clang.Doxygen ( , clang_InlineCommandComment_getRenderKind , clang_InlineCommandComment_getNumArgs , clang_InlineCommandComment_getArgText + -- * Comment type 'CXComment_HTMLStartTag' and 'CXComment_HTMLEndTag' + , clang_HTMLTagComment_getTagName + , clang_HTMLStartTagComment_isSelfClosing + , clang_HTMLStartTag_getNumAttrs + , clang_HTMLStartTag_getAttrName + , clang_HTMLStartTag_getAttrValue + , clang_HTMLTagComment_getAsString -- * Comment type 'CXComment_BlockCommand' , clang_BlockCommandComment_getCommandName , clang_BlockCommandComment_getNumArgs @@ -231,6 +238,98 @@ clang_InlineCommandComment_getArgText comment argIdx = onHaskellHeap comment $ \comment' -> preallocate_ $ wrap_InlineCommandComment_getArgText comment' argIdx +{------------------------------------------------------------------------------- + Comment type 'CXComment_HTMLStartTag' and 'CXComment_HTMLEndTag' +-------------------------------------------------------------------------------} + +foreign import capi unsafe "doxygen_wrappers.h wrap_HTMLTagComment_getTagName" + wrap_HTMLTagComment_getTagName :: R CXComment_ -> W CXString_ -> IO () + +foreign import capi unsafe "doxygen_wrappers.h wrap_HTMLStartTagComment_isSelfClosing" + wrap_HTMLStartTagComment_isSelfClosing :: R CXComment_ -> IO CUInt + +foreign import capi unsafe "doxygen_wrappers.h wrap_HTMLStartTag_getNumAttrs" + wrap_HTMLStartTag_getNumAttrs :: R CXComment_ -> IO CUInt + +foreign import capi unsafe "doxygen_wrappers.h wrap_HTMLStartTag_getAttrName" + wrap_HTMLStartTag_getAttrName :: R CXComment_ -> CUInt -> W CXString_ -> IO () + +foreign import capi unsafe "doxygen_wrappers.h wrap_HTMLStartTag_getAttrValue" + wrap_HTMLStartTag_getAttrValue :: + R CXComment_ + -> CUInt + -> W CXString_ + -> IO () + +foreign import capi unsafe "doxygen_wrappers.h wrap_HTMLTagComment_getAsString" + wrap_HTMLTagComment_getAsString :: R CXComment_ -> W CXString_ -> IO () + +-- | Get the HTML tag name. +-- +-- +clang_HTMLTagComment_getTagName :: + CXComment + -- ^ a 'CXComment_HTMLStartTag' or 'CXComment_HTMLEndTag' AST node + -> IO Text +clang_HTMLTagComment_getTagName comment = + onHaskellHeap comment $ \comment' -> + preallocate_ $ wrap_HTMLTagComment_getTagName comment' + +-- | Determine whether the tag is self-closing. +-- +-- Example: @
@ is self-closing +-- +-- +clang_HTMLStartTagComment_isSelfClosing :: + CXComment -- ^ a 'CXComment_HTMLStartTag' AST node + -> IO Bool +clang_HTMLStartTagComment_isSelfClosing comment = + onHaskellHeap comment $ \comment' -> + cToBool <$> wrap_HTMLStartTagComment_isSelfClosing comment' + +-- | Get the number of attributes (name-value pairs) attached to the start tag. +-- +-- +clang_HTMLStartTag_getNumAttrs :: + CXComment -- ^ a 'CXComment_HTMLStartTag' AST node + -> IO CUInt +clang_HTMLStartTag_getNumAttrs comment = + onHaskellHeap comment $ \comment' -> + wrap_HTMLStartTag_getNumAttrs comment' + +-- | Get the name of the specified attribute. +-- +-- +clang_HTMLStartTag_getAttrName :: + CXComment -- ^ a 'CXComment_HTMLStartTag' AST node + -> CUInt -- ^ attribute index (zero-based) + -> IO Text +clang_HTMLStartTag_getAttrName comment attrIdx = + onHaskellHeap comment $ \comment' -> + preallocate_ $ wrap_HTMLStartTag_getAttrName comment' attrIdx + +-- | Get the value of the specified attribute. +-- +-- +clang_HTMLStartTag_getAttrValue :: + CXComment -- ^ a 'CXComment_HTMLStartTag' AST node + -> CUInt -- ^ attribute index (zero-based) + -> IO Text +clang_HTMLStartTag_getAttrValue comment attrIdx = + onHaskellHeap comment $ \comment' -> + preallocate_ $ wrap_HTMLStartTag_getAttrValue comment' attrIdx + +-- | Convert an HTML tag AST node to string. +-- +-- +clang_HTMLTagComment_getAsString :: + CXComment + -- ^ a 'CXComment_HTMLStartTag' or 'CXComment_HTMLEndTag' AST node + -> IO Text +clang_HTMLTagComment_getAsString comment = + onHaskellHeap comment $ \comment' -> + preallocate_ $ wrap_HTMLTagComment_getAsString comment' + {------------------------------------------------------------------------------- Comment type 'CXComment_BlockCommand' -------------------------------------------------------------------------------}