Skip to content

Commit 735ef37

Browse files
committed
feat: dom::String
fix #361, fix #372
1 parent e29bd89 commit 735ef37

22 files changed

+663
-241
lines changed

include/mrdox/Metadata/Function.hpp

+2-3
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
#include <mrdox/Metadata/Source.hpp>
2020
#include <mrdox/Metadata/Symbols.hpp>
2121
#include <mrdox/Metadata/Template.hpp>
22+
#include <mrdox/Support/Dom.hpp>
2223
#include <memory>
2324
#include <string>
2425
#include <vector>
@@ -59,9 +60,7 @@ enum class FunctionClass
5960
Deduction,
6061
};
6162

62-
MRDOX_DECL
63-
std::string_view
64-
toString(FunctionClass kind);
63+
MRDOX_DECL dom::String toString(FunctionClass kind) noexcept;
6564

6665
/** Bit constants used with function specifiers.
6766
*/

include/mrdox/Metadata/Info.hpp

+2-3
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
#include <mrdox/Metadata/Javadoc.hpp>
1717
#include <mrdox/Metadata/Specifiers.hpp>
1818
#include <mrdox/Metadata/Symbols.hpp>
19+
#include <mrdox/Support/Dom.hpp>
1920
#include <mrdox/Support/TypeTraits.hpp>
2021
#include <array>
2122
#include <memory>
@@ -49,9 +50,7 @@ enum class InfoKind
4950
Specialization
5051
};
5152

52-
MRDOX_DECL
53-
std::string_view
54-
toString(InfoKind kind) noexcept;
53+
MRDOX_DECL dom::String toString(InfoKind kind) noexcept;
5554

5655
/** Common properties of all symbols
5756
*/

include/mrdox/Metadata/Javadoc.hpp

+3
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
#define MRDOX_API_METADATA_JAVADOC_HPP
1515

1616
#include <mrdox/Platform.hpp>
17+
#include <mrdox/Support/Dom.hpp>
1718
#include <mrdox/Support/Error.hpp>
1819
#include <memory>
1920
#include <string>
@@ -586,6 +587,8 @@ struct Overview
586587
std::vector<TParam const*> tparams;
587588
};
588589

590+
MRDOX_DECL dom::String toString(Style style) noexcept;
591+
589592
} // doc
590593

591594
//------------------------------------------------

include/mrdox/Metadata/Record.hpp

+2-3
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
#include <mrdox/Metadata/Template.hpp>
2323
#include <mrdox/Metadata/Typedef.hpp>
2424
#include <mrdox/Metadata/Variable.hpp>
25+
#include <mrdox/Support/Dom.hpp>
2526
#include <memory>
2627
#include <string>
2728
#include <string_view>
@@ -68,9 +69,7 @@ enum class RecordKeyKind
6869
Union
6970
};
7071

71-
MRDOX_DECL
72-
std::string_view
73-
toString(RecordKeyKind kind) noexcept;
72+
MRDOX_DECL dom::String toString(RecordKeyKind kind) noexcept;
7473

7574
/** Metadata for struct, class, or union.
7675
*/

include/mrdox/Metadata/Specifiers.hpp

+24-40
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
#define MRDOX_API_METADATA_SPECIFIERS_HPP
1313

1414
#include <mrdox/Platform.hpp>
15+
#include <mrdox/Support/Dom.hpp>
1516
#include <string_view>
1617

1718
namespace clang {
@@ -36,25 +37,6 @@ enum class AccessKind
3637
None
3738
};
3839

39-
/** Storage class kinds
40-
41-
[dcl.stc] p1: At most one storage-class-specifier shall appear
42-
in a given decl-specifier-seq, except that `thread_local`
43-
may appear with `static` or `extern`.
44-
*/
45-
enum class StorageClassKind
46-
{
47-
None = 0,
48-
Extern,
49-
Static,
50-
// auto storage-class-specifier (removed in C++11)
51-
// only valid for variables
52-
Auto,
53-
// register storage-class-specifier (removed in C++17)
54-
// only valid for variables
55-
Register
56-
};
57-
5840
/** `constexpr`/`consteval` specifier kinds
5941
6042
[dcl.spec.general] p2: At most one of the `constexpr`, `consteval`,
@@ -175,29 +157,31 @@ enum class ReferenceKind
175157
RValue
176158
};
177159

178-
MRDOX_DECL
179-
std::string_view
180-
toString(AccessKind kind);
181-
182-
MRDOX_DECL
183-
std::string_view
184-
toString(StorageClassKind kind);
185-
186-
MRDOX_DECL
187-
std::string_view
188-
toString(ConstexprKind kind);
189-
190-
MRDOX_DECL
191-
std::string_view
192-
toString(ExplicitKind kind);
160+
/** Storage class kinds
193161
194-
MRDOX_DECL
195-
std::string_view
196-
toString(NoexceptKind kind);
162+
[dcl.stc] p1: At most one storage-class-specifier shall appear
163+
in a given decl-specifier-seq, except that `thread_local`
164+
may appear with `static` or `extern`.
165+
*/
166+
enum class StorageClassKind
167+
{
168+
None = 0,
169+
Extern,
170+
Static,
171+
// auto storage-class-specifier (removed in C++11)
172+
// only valid for variables
173+
Auto,
174+
// register storage-class-specifier (removed in C++17)
175+
// only valid for variables
176+
Register
177+
};
197178

198-
MRDOX_DECL
199-
std::string_view
200-
toString(ReferenceKind kind);
179+
MRDOX_DECL dom::String toString(AccessKind kind) noexcept;
180+
MRDOX_DECL dom::String toString(ConstexprKind kind) noexcept;
181+
MRDOX_DECL dom::String toString(ExplicitKind kind) noexcept;
182+
MRDOX_DECL dom::String toString(NoexceptKind kind) noexcept;
183+
MRDOX_DECL dom::String toString(ReferenceKind kind) noexcept;
184+
MRDOX_DECL dom::String toString(StorageClassKind kind) noexcept;
201185

202186
} // mrdox
203187
} // clang

include/mrdox/Metadata/Template.hpp

+1-3
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,7 @@ enum class TParamKind : int
3535
Template
3636
};
3737

38-
MRDOX_DECL
39-
std::string_view
40-
toString(TParamKind kind);
38+
MRDOX_DECL dom::String toString(TParamKind kind) noexcept;
4139

4240
struct TParam;
4341

include/mrdox/Metadata/Type.hpp

+5-9
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
#include <mrdox/Metadata/Specifiers.hpp>
1717
#include <mrdox/Metadata/Symbols.hpp>
1818
#include <mrdox/MetadataFwd.hpp>
19+
#include <mrdox/Support/Dom.hpp>
1920
#include <memory>
2021
#include <string>
2122
#include <string_view>
@@ -31,9 +32,7 @@ enum QualifierKind : int
3132
Volatile
3233
};
3334

34-
MRDOX_DECL
35-
std::string_view
36-
toString(QualifierKind kind);
35+
MRDOX_DECL dom::String toString(QualifierKind kind) noexcept;
3736

3837
enum class TypeKind
3938
{
@@ -49,17 +48,13 @@ enum class TypeKind
4948
Pack
5049
};
5150

52-
MRDOX_DECL
53-
std::string_view
54-
toString(TypeKind kind);
51+
MRDOX_DECL dom::String toString(TypeKind kind) noexcept;
5552

5653
struct TypeInfo
5754
{
5855
TypeKind Kind;
5956

60-
constexpr
61-
virtual
62-
~TypeInfo() = default;
57+
constexpr virtual ~TypeInfo() = default;
6358

6459
constexpr bool isBuiltin() const noexcept { return Kind == TypeKind::Builtin ; }
6560
constexpr bool isTag() const noexcept { return Kind == TypeKind::Tag; }
@@ -271,6 +266,7 @@ visit(
271266
}
272267
}
273268

269+
// VFALCO maybe we should rename this to `renderType` or something?
274270
MRDOX_DECL
275271
std::string
276272
toString(

0 commit comments

Comments
 (0)