Skip to content

Commit

Permalink
Add more types to docs
Browse files Browse the repository at this point in the history
  • Loading branch information
tobiashienzsch committed Oct 18, 2023
1 parent 672da68 commit 1502096
Show file tree
Hide file tree
Showing 5 changed files with 214 additions and 15 deletions.
164 changes: 164 additions & 0 deletions tool/jml-docgen/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,11 @@
- [BigInteger](#BigInteger)
- [File](#File)
- [IPAddress](#IPAddress)
- [InputStream](#InputStream)
- [MemoryBlock](#MemoryBlock)
- [MemoryInputStream](#MemoryInputStream)
- [MemoryOutputStream](#MemoryOutputStream)
- [OutputStream](#OutputStream)
- [Random](#Random)
- [RelativeTime](#RelativeTime)
- [Result](#Result)
Expand All @@ -22,6 +26,8 @@
- [juce_data_structures](#juce_data_structures)
- [UndoManager](#UndoManager)
- [ValueTree](#ValueTree)
- [juce_events](#juce_events)
- [Timer](#Timer)
- [juce_graphics](#juce_graphics)
- [AffineTransform](#AffineTransform)
- [Colour](#Colour)
Expand All @@ -34,18 +40,23 @@
- [Path](#Path)
- [juce_gui_basics](#juce_gui_basics)
- [ArrowButton](#ArrowButton)
- [Button](#Button)
- [ComboBox](#ComboBox)
- [ComponentListener](#ComponentListener)
- [Grid](#Grid)
- [HyperlinkButton](#HyperlinkButton)
- [ImageComponent](#ImageComponent)
- [Label](#Label)
- [LookAndFeel](#LookAndFeel)
- [LookAndFeel_V4](#LookAndFeel_V4)
- [Slider](#Slider)
- [TextButton](#TextButton)
- [ToggleButton](#ToggleButton)
- [TreeView](#TreeView)
- [juce_gui_extra](#juce_gui_extra)
- [CodeDocument](#CodeDocument)


## juce_audio_basics

## MidiFile
Expand Down Expand Up @@ -364,6 +375,35 @@ juce.IPAddress.new(...)
juce.IPAddress.toString(...)
```

## InputStream

```lua
juce.InputStream.getNumBytesRemaining(...)
juce.InputStream.getPosition(...)
juce.InputStream.getTotalLength(...)
juce.InputStream.isExhausted(...)
juce.InputStream.new(...)
juce.InputStream.readBool(...)
juce.InputStream.readByte(...)
juce.InputStream.readCompressedInt(...)
juce.InputStream.readDouble(...)
juce.InputStream.readDoubleBigEndian(...)
juce.InputStream.readEntireStreamAsString(...)
juce.InputStream.readFloat(...)
juce.InputStream.readFloatBigEndian(...)
juce.InputStream.readInt(...)
juce.InputStream.readInt64(...)
juce.InputStream.readInt64BigEndian(...)
juce.InputStream.readIntBigEndian(...)
juce.InputStream.readIntoMemoryBlock(...)
juce.InputStream.readNextLine(...)
juce.InputStream.readShort(...)
juce.InputStream.readShortBigEndian(...)
juce.InputStream.readString(...)
juce.InputStream.setPosition(...)
juce.InputStream.skipNextBytes(...)
```

## MemoryBlock

```lua
Expand All @@ -390,6 +430,57 @@ juce.MemoryBlock.toBase64Encoding(...)
juce.MemoryBlock.toString(...)
```

## MemoryInputStream

```lua
juce.MemoryInputStream.getData(...)
juce.MemoryInputStream.getDataSize(...)
juce.MemoryInputStream.new(...)
```

## MemoryOutputStream

```lua
juce.MemoryOutputStream.appendUTF8Char(...)
juce.MemoryOutputStream.getData(...)
juce.MemoryOutputStream.getDataSize(...)
juce.MemoryOutputStream.getMemoryBlock(...)
juce.MemoryOutputStream.new(...)
juce.MemoryOutputStream.preallocate(...)
juce.MemoryOutputStream.reset(...)
juce.MemoryOutputStream.toString(...)
juce.MemoryOutputStream.toUTF8(...)
```

## OutputStream

```lua
juce.OutputStream.flush(...)
juce.OutputStream.getNewLineString(...)
juce.OutputStream.getPosition(...)
juce.OutputStream.new(...)
juce.OutputStream.setNewLineString(...)
juce.OutputStream.setPosition(...)
juce.OutputStream.write(...)
juce.OutputStream.writeBool(...)
juce.OutputStream.writeByte(...)
juce.OutputStream.writeCompressedInt(...)
juce.OutputStream.writeDouble(...)
juce.OutputStream.writeDoubleBigEndian(...)
juce.OutputStream.writeFloat(...)
juce.OutputStream.writeFloatBigEndian(...)
juce.OutputStream.writeFromInputStream(...)
juce.OutputStream.writeInt(...)
juce.OutputStream.writeInt64(...)
juce.OutputStream.writeInt64BigEndian(...)
juce.OutputStream.writeIntBigEndian(...)
juce.OutputStream.writeRepeatedByte(...)
juce.OutputStream.writeShort(...)
juce.OutputStream.writeShortBigEndian(...)
juce.OutputStream.writeString(...)
juce.OutputStream.writeText(...)
```

## Random

```lua
Expand Down Expand Up @@ -693,6 +784,15 @@ juce.ValueTree.toXmlString(...)
juce.ValueTree.writeToStream(...)
```

## juce_events

## Timer

```lua
juce.Timer.new(...)
juce.Timer.timerCallback(...)
```

## juce_graphics

## AffineTransform
Expand Down Expand Up @@ -920,6 +1020,18 @@ juce.Path.writePathToStream(...)
juce.ArrowButton.new(...)
```

## Button

```lua
juce.Button.getBounds(...)
juce.Button.getHeight(...)
juce.Button.getWidth(...)
juce.Button.getX(...)
juce.Button.getY(...)
juce.Button.new(...)
juce.Button.onClick(...)
```

## ComboBox

```lua
Expand Down Expand Up @@ -972,6 +1084,29 @@ juce.ComponentListener.componentVisibilityChanged(...)
juce.ComponentListener.new(...)
```

## Grid

```lua
juce.Grid.alignContent(...)
juce.Grid.alignItems(...)
juce.Grid.autoColumns(...)
juce.Grid.autoFlow(...)
juce.Grid.autoRows(...)
juce.Grid.columnGap(...)
juce.Grid.getNumberOfColumns(...)
juce.Grid.getNumberOfRows(...)
juce.Grid.items(...)
juce.Grid.justifyContent(...)
juce.Grid.justifyItems(...)
juce.Grid.new(...)
juce.Grid.performLayout(...)
juce.Grid.rowGap(...)
juce.Grid.setGap(...)
juce.Grid.templateAreas(...)
juce.Grid.templateColumns(...)
juce.Grid.templateRows(...)
```

## HyperlinkButton

```lua
Expand Down Expand Up @@ -1026,6 +1161,35 @@ juce.Label.setText(...)
juce.Label.showEditor(...)
```

## LookAndFeel

```lua
juce.LookAndFeel.createDropShadowerForComponent(...)
juce.LookAndFeel.createGraphicsContext(...)
juce.LookAndFeel.drawSpinningWaitAnimation(...)
juce.LookAndFeel.findColour(...)
juce.LookAndFeel.getCrossShape(...)
juce.LookAndFeel.getMouseCursorFor(...)
juce.LookAndFeel.getTickShape(...)
juce.LookAndFeel.isColourSpecified(...)
juce.LookAndFeel.isUsingNativeAlertWindows(...)
juce.LookAndFeel.new(...)
juce.LookAndFeel.playAlertSound(...)
juce.LookAndFeel.setColour(...)
juce.LookAndFeel.setDefaultSansSerifTypeface(...)
juce.LookAndFeel.setDefaultSansSerifTypefaceName(...)
juce.LookAndFeel.setUsingNativeAlertWindows(...)
```

## LookAndFeel_V4

```lua
juce.LookAndFeel_V4.drawButtonBackground(...)
juce.LookAndFeel_V4.drawToggleButton(...)
juce.LookAndFeel_V4.getTextButtonFont(...)
juce.LookAndFeel_V4.new(...)
```

## Slider

```lua
Expand Down
5 changes: 4 additions & 1 deletion tool/jml-docgen/doxygen.lua
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ json = require("json")
local doxygen = {}

local function select_xml_file(entity)
entity = entity:gsub('_', '__')
local juce_root = "~/Developer/tobiashienzsch/JUCE"
local xml = string.format("%s/docs/doxygen/xml", juce_root)

Expand Down Expand Up @@ -68,6 +69,7 @@ end
function doxygen.parse_xml(entity_name)
-- Xml file
local xml_file = select_xml_file(entity_name)
assert(xml_file:existsAsFile())
local xml_doc = juce.XmlDocument.parse(xml_file)
if xml_doc == nil then
print("error loading xml from " .. tostring(xml_file:getFullPathName()))
Expand Down Expand Up @@ -95,7 +97,8 @@ function doxygen.parse_xml(entity_name)
elseif tag == "sectiondef" then
-- Get sections
local section = child:getStringAttribute(juce.StringRef.new(kind_tag))
if tostring(section) == "public-func" then
section = tostring(section)
if (section == "public-func" or section == "public-static-func") then
-- Public functions
for j = 0, child:getNumChildElements() - 1 do
local members = child:getChildElement(j)
Expand Down
24 changes: 18 additions & 6 deletions tool/jml-docgen/main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,14 @@ local function format_usertype_docs_as_lua_stubs(doc)
return str
end

local function write_usertype_docs_as_lua_stubs(dir, modules)
local function write_usertype_as_lua_stubs(dir, modules)
local docs, _ = sol2.parse_juce_types(modules)
for module_name, juce_module in pairs(docs) do
for entity_name, entity in pairs(juce_module[2]) do
local doxygen_spec = doxygen.parse_xml(entity_name)
if doxygen_spec == nil then
doxygen_spec = {brief = entity_name, members = {}}
end

-- Create lua file
local file = io.open(dir .. "/" .. entity_name .. ".lua", "w")
Expand Down Expand Up @@ -60,7 +63,7 @@ local function write_usertype_docs_as_lua_stubs(dir, modules)

file:write(string.format("--- %s\n", doxygen_member.brief))
if doxygen_member.detail ~= "" then
file:write(string.format("-- %s\n", doxygen_member.detail))
file:write(string.format("--\n-- %s\n", doxygen_member.detail))
end

local seperator = nil
Expand Down Expand Up @@ -99,7 +102,7 @@ local function write_usertype_docs_as_lua_stubs(dir, modules)
end
end

local function write_usertype_docs_as_markdown(file, modules)
local function write_usertype_as_markdown(file, modules)
local docs, sorted_modules_names = sol2.parse_juce_types(modules)

-- Write header
Expand All @@ -125,6 +128,7 @@ local function write_usertype_docs_as_markdown(file, modules)
for i = 1, #sorted_modules_names do
local module_name = sorted_modules_names[i]
local module_docs = docs[module_name]

-- Header
file:write(string.format("## %s\n\n", module_name))

Expand All @@ -141,20 +145,25 @@ local classes = {
juce_core = {
juce.BigInteger.new(),
juce.File.new(),
dummyInputStream,
dummyMemoryInputStream,
juce.IPAddress.new(),
juce.MemoryBlock.new(),
-- juce.NormalisableRangeDouble.new(),
juce.Random.new(),
-- juce.RangeDouble.new(0.0, 1.0),
juce.Result.ok(),
-- juce.StatisticsAccumulatorDouble.new(),
dummyOutputStream,
dummyMemoryOutputStream,
juce.String.new(),
juce.StringArray.new(),
juce.Uuid.new(),
juce.RelativeTime.seconds(1.0),
juce.Time.new(),
juce.XmlElement.new("TAG"),
},
juce_events = {juce.Timer.new()},
juce_audio_basics = {
juce.MidiFile.new(),
juce.MidiMessage.new(),
Expand All @@ -175,10 +184,13 @@ local classes = {
juce.Path.new(),
},
juce_gui_basics = {
dummyButton,
juce.ComponentListener.new(),
juce.ComboBox.new(juce.String.new("")),
juce.Grid.new(),
juce.Label.new(juce.String.new(""), juce.String.new("")),
-- juce.LookAndFeel_V4.new(),
dummyLNF,
juce.LookAndFeel_V4.new(),
juce.ImageComponent.new(juce.String.new("")),
juce.Slider.new(),
juce.ArrowButton.new(juce.String.new(""), 1.0, juce.Colours.black),
Expand All @@ -191,7 +203,7 @@ local classes = {
}

local readme = io.open("README.md", "w")
write_usertype_docs_as_markdown(readme, classes)
write_usertype_as_markdown(readme, classes)
readme:close()

write_usertype_docs_as_lua_stubs("out/lua", classes)
write_usertype_as_lua_stubs("out/lua", classes)
Loading

0 comments on commit 1502096

Please sign in to comment.