Skip to content

Commit 75cd2dd

Browse files
committed
chore: dom and asciidoc work
1 parent ef5af06 commit 75cd2dd

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+1792
-702
lines changed

addons/generator/asciidoc/layouts/function.adoc.hbs

-17
This file was deleted.

addons/generator/asciidoc/layouts/namespace.adoc.hbs

-10
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
== Reference
2+
:mrdox:
3+
{{>symbol}}

addons/generator/asciidoc/layouts/record.adoc.hbs

-25
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
2+
Created with MrDox
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
= Reference
2+
:mrdox:
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{{>symbol symbol=symbol}}
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,21 @@
1-
{{!-- Declare the signature of a function --}}
21
[source,cpp,subs=+macros]
32
----
3+
{{#if (eq specs.storageClass "static")}}
4+
static
5+
{{/if}}
46
{{>type-name return}}
57
68
{{#if params}}
79
{{name}}(
810
{{#each params}}
911
{{>type-name type~}}
1012
{{#if name}} {{name}}{{/if}}
11-
{{~#if @last}});{{else}},{{/if}}
12-
{{/each}}
13-
{{else}}
14-
{{name}}();
15-
{{/if}}
13+
{{~#if @last}}){{else}},
14+
{{/if}}
15+
{{~/each}}
16+
{{~else~}}
17+
{{name}}()
18+
{{~/if~}}
19+
{{#if (eq specs.exceptionSpec "noexcept")}} noexcept{{/if~}}
20+
;
1621
----
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{{!-- function --}}
2+
[#{{symbol.id}}]
3+
== {{symbol.name}}
4+
5+
{{symbol.doc.brief}}
6+
7+
=== Synopsis
8+
9+
{{>function-sig symbol}}
10+
11+
{{>source symbol.loc}}
12+
13+
{{#if symbol.doc.description}}
14+
=== Description
15+
16+
{{symbol.doc.description}}
17+
18+
{{/if}}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{{!-- namespace --}}
2+
[#{{symbol.id}}]
3+
== Namespace {{symbol.name}}
4+
5+
[,cols=2]
6+
|===
7+
|Name |Description
8+
{{#each symbol.members}}
9+
|xref:{{id}}[`{{name}}`] |{{doc.brief}}
10+
{{/each}}
11+
|===
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{{#if (eq kind "function")}}
2+
{{#if (eq specs.storageClass "static")}}static {{/if~}}
3+
{{>type-name return}} {{name}}(
4+
{{~#each params}}
5+
{{>type-name type}}
6+
{{#if name}} {{name}}{{/if}}
7+
{{~#unless @last}}, {{/unless}}
8+
{{~/each}})
9+
{{~#if (eq specs.exceptionSpec "noexcept")}} noexcept{{/if~}}
10+
;
11+
{{~else~}}
12+
{{/if}}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
{{!-- record --}}
2+
[#{{symbol.id}}]
3+
== {{symbol.name}}
4+
5+
{{symbol.doc.brief}}
6+
7+
=== Synopsis
8+
9+
[source,cpp,subs=+macros]
10+
----
11+
{{symbol.tag}} {{symbol.name}}
12+
{
13+
{{#each symbol.members}}
14+
{{>record-member}}
15+
16+
{{/each}}
17+
};
18+
----
19+
20+
{{>source symbol.loc}}
21+
22+
{{#if symbol.doc.description}}
23+
=== Description
24+
25+
{{symbol.doc.description}}
26+
27+
{{/if}}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{{#if def}}
2+
Declared in file <{{def.file}}>
3+
{{else if decl}}
4+
{{#each decl}}
5+
Declared in file <{{file}}>
6+
{{/each}}
7+
{{else}}
8+
{{/if}}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{{#if (eq symbol.kind "namespace")}}
2+
{{>namespace}}
3+
{{else if (eq symbol.kind "function")}}
4+
{{>function}}
5+
{{else if (eq symbol.kind "class")}}
6+
{{>record}}
7+
{{else if (eq symbol.kind "struct")}}
8+
{{>record}}
9+
{{else if (eq symbol.kind "union")}}
10+
{{>record}}
11+
{{/if}}
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
{{!-- render TypeInfo --}}
21
{{#if symbol}}
3-
xref:{{id}}.adoc[{{name}}]{{else~}}
2+
xref:{{id}}[{{name}}]{{else~}}
43
{{name~}}
54
{{/if~}}

include/mrdox/Config.hpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -69,9 +69,9 @@ class MRDOX_VISIBLE
6969
*/
7070
bool ignoreFailures = false;
7171

72-
/** `true` if everything should be output to a single page.
72+
/** `true` if output should consist of multiple files.
7373
*/
74-
bool singlePage = false;
74+
bool multiPage = false;
7575

7676
/** `true` if tool output should be verbose.
7777

include/mrdox/Dom/DomArray.hpp

+55
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
//
2+
// Licensed under the Apache License v2.0 with LLVM Exceptions.
3+
// See https://llvm.org/LICENSE.txt for license information.
4+
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
5+
//
6+
// Copyright (c) 2023 Vinnie Falco ([email protected])
7+
//
8+
// Official repository: https://github.com/cppalliance/mrdox
9+
//
10+
11+
#ifndef MRDOX_API_DOM_DOMARRAY_HPP
12+
#define MRDOX_API_DOM_DOMARRAY_HPP
13+
14+
#include <mrdox/Platform.hpp>
15+
#include <mrdox/Corpus.hpp>
16+
#include <mrdox/Support/Dom.hpp>
17+
18+
namespace clang {
19+
namespace mrdox {
20+
21+
template<class T, class U>
22+
class MRDOX_DECL
23+
DomArray : public dom::Array
24+
{
25+
std::vector<T> list_;
26+
Corpus const& corpus_;
27+
28+
public:
29+
DomArray(
30+
std::vector<T> const& list,
31+
Corpus const& corpus) noexcept
32+
: list_(list)
33+
, corpus_(corpus)
34+
{
35+
}
36+
37+
std::size_t
38+
length() const noexcept override
39+
{
40+
return list_.size();
41+
}
42+
43+
dom::Value
44+
get(std::size_t index) const override
45+
{
46+
if(index >= list_.size())
47+
return nullptr;
48+
return dom::makePointer<U>(list_[index], corpus_);
49+
}
50+
};
51+
52+
} // mrdox
53+
} // clang
54+
55+
#endif

include/mrdox/Dom/DomBase.hpp

+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
//
2+
// Licensed under the Apache License v2.0 with LLVM Exceptions.
3+
// See https://llvm.org/LICENSE.txt for license information.
4+
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
5+
//
6+
// Copyright (c) 2023 Vinnie Falco ([email protected])
7+
//
8+
// Official repository: https://github.com/cppalliance/mrdox
9+
//
10+
11+
#ifndef MRDOX_API_DOM_DOMBASE_HPP
12+
#define MRDOX_API_DOM_DOMBASE_HPP
13+
14+
#include <mrdox/Platform.hpp>
15+
#include <mrdox/Corpus.hpp>
16+
#include <mrdox/Dom/DomSymbol.hpp>
17+
18+
namespace clang {
19+
namespace mrdox {
20+
21+
/** A base class record
22+
*/
23+
class MRDOX_DECL
24+
DomBase : public DomSymbol<RecordInfo>
25+
{
26+
BaseInfo const* B_;
27+
28+
public:
29+
DomBase(
30+
RecordInfo const& I,
31+
BaseInfo const& B,
32+
Corpus const& corpus) noexcept;
33+
34+
dom::Value get(std::string_view key) const override;
35+
std::vector<std::string_view> props() const override;
36+
};
37+
38+
} // mrdox
39+
} // clang
40+
41+
#endif

include/mrdox/Dom/DomBaseArray.hpp

+42
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
//
2+
// Licensed under the Apache License v2.0 with LLVM Exceptions.
3+
// See https://llvm.org/LICENSE.txt for license information.
4+
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
5+
//
6+
// Copyright (c) 2023 Vinnie Falco ([email protected])
7+
//
8+
// Official repository: https://github.com/cppalliance/mrdox
9+
//
10+
11+
#ifndef MRDOX_API_DOM_DOMBASEARRAY_HPP
12+
#define MRDOX_API_DOM_DOMBASEARRAY_HPP
13+
14+
#include <mrdox/Platform.hpp>
15+
#include <mrdox/Corpus.hpp>
16+
#include <mrdox/Support/Dom.hpp>
17+
#include <vector>
18+
19+
namespace clang {
20+
namespace mrdox {
21+
22+
/** A vector of BaseInfo.
23+
*/
24+
class MRDOX_DECL
25+
DomBaseArray : public dom::Array
26+
{
27+
std::vector<BaseInfo> const& list_;
28+
Corpus const& corpus_;
29+
30+
public:
31+
DomBaseArray(
32+
std::vector<BaseInfo> const& list,
33+
Corpus const& corpus) noexcept;
34+
35+
std::size_t length() const noexcept override;
36+
dom::Value get(std::size_t index) const override;
37+
};
38+
39+
} // mrdox
40+
} // clang
41+
42+
#endif

include/mrdox/Dom/DomContext.hpp

+48
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
//
2+
// Licensed under the Apache License v2.0 with LLVM Exceptions.
3+
// See https://llvm.org/LICENSE.txt for license information.
4+
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
5+
//
6+
// Copyright (c) 2023 Vinnie Falco ([email protected])
7+
//
8+
// Official repository: https://github.com/cppalliance/mrdox
9+
//
10+
11+
#ifndef MRDOX_API_DOM_DOMCONTEXT_HPP
12+
#define MRDOX_API_DOM_DOMCONTEXT_HPP
13+
14+
#include <mrdox/Platform.hpp>
15+
#include <mrdox/Support/Dom.hpp>
16+
#include <string>
17+
#include <unordered_map>
18+
19+
namespace clang {
20+
namespace mrdox {
21+
22+
/** Top-level object passed to templating engine.
23+
24+
This is often called the "context."
25+
*/
26+
class MRDOX_DECL
27+
DomContext : public dom::Object
28+
{
29+
public:
30+
// VFALCO I am using string_view instead of
31+
// string because heterogeneous comparison does
32+
// not seem to be working.
33+
using Hash = std::unordered_map<
34+
std::string_view, dom::Value>;
35+
36+
explicit DomContext(Hash hash);
37+
bool empty() const noexcept override { return false; }
38+
dom::Value get(std::string_view key) const override;
39+
std::vector<std::string_view> props() const override;
40+
41+
private:
42+
Hash hash_;
43+
};
44+
45+
} // mrdox
46+
} // clang
47+
48+
#endif

0 commit comments

Comments
 (0)