-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a0c9d1d
commit bbc08f1
Showing
39 changed files
with
991 additions
and
601 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,6 +5,7 @@ | |
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
// | ||
// Copyright (c) 2023 Vinnie Falco ([email protected]) | ||
// Copyright (c) 2023 Krystian Stasiowski ([email protected]) | ||
// | ||
// Official repository: https://github.com/cppalliance/mrdocs | ||
// | ||
|
@@ -101,6 +102,8 @@ class MRDOCS_VISIBLE | |
|
||
//-------------------------------------------- | ||
|
||
// KRYSTIAN FIXME: this could just be a single | ||
// overload constrained with std::derived_from<ScopeInfo> | ||
template<class F, class... Args> | ||
void traverse( | ||
NamespaceInfo const& I, | ||
|
@@ -121,6 +124,36 @@ class MRDOCS_VISIBLE | |
SpecializationInfo const& I, | ||
F&& f, Args&&... args) const; | ||
|
||
template<class F, class... Args> | ||
void traverse( | ||
OverloadSet const& OS, | ||
F&& f, Args&&... args) const; | ||
|
||
template<class F, class... Args> | ||
void traverseOverloads( | ||
ScopeInfo const& S, | ||
F&& f, Args&&... args) const; | ||
|
||
template<class F, class... Args> | ||
void traverseOverloads( | ||
RecordInfo const& I, | ||
F&& f, Args&&... args) const; | ||
|
||
template<class F, class... Args> | ||
void traverseOverloads( | ||
NamespaceInfo const& I, | ||
F&& f, Args&&... args) const; | ||
|
||
template<class F, class... Args> | ||
void traverseOverloads( | ||
EnumInfo const& I, | ||
F&& f, Args&&... args) const; | ||
|
||
template<class F, class... Args> | ||
void traverseOverloads( | ||
SpecializationInfo const& I, | ||
F&& f, Args&&... args) const; | ||
|
||
//-------------------------------------------- | ||
|
||
// KRYSTIAN NOTE: temporary | ||
|
@@ -163,9 +196,6 @@ traverse( | |
for(auto const& id : I.Members) | ||
visit(get(id), std::forward<F>(f), | ||
std::forward<Args>(args)...); | ||
for(auto const& id : I.Specializations) | ||
visit(get(id), std::forward<F>(f), | ||
std::forward<Args>(args)...); | ||
} | ||
|
||
template<class F, class... Args> | ||
|
@@ -178,7 +208,16 @@ traverse( | |
for(auto const& id : I.Members) | ||
visit(get(id), std::forward<F>(f), | ||
std::forward<Args>(args)...); | ||
for(auto const& id : I.Specializations) | ||
} | ||
|
||
template<class F, class... Args> | ||
void | ||
Corpus:: | ||
traverse( | ||
EnumInfo const& I, | ||
F&& f, Args&&... args) const | ||
{ | ||
for(auto const& id : I.Members) | ||
visit(get(id), std::forward<F>(f), | ||
std::forward<Args>(args)...); | ||
} | ||
|
@@ -187,7 +226,7 @@ template<class F, class... Args> | |
void | ||
Corpus:: | ||
traverse( | ||
EnumInfo const& I, | ||
SpecializationInfo const& I, | ||
F&& f, Args&&... args) const | ||
{ | ||
for(auto const& id : I.Members) | ||
|
@@ -199,13 +238,138 @@ template<class F, class... Args> | |
void | ||
Corpus:: | ||
traverse( | ||
OverloadSet const& OS, | ||
F&& f, Args&&... args) const | ||
{ | ||
for(auto const& id : OS.Members) | ||
visit(get(id), std::forward<F>(f), | ||
std::forward<Args>(args)...); | ||
} | ||
|
||
template<class F, class... Args> | ||
void | ||
Corpus:: | ||
traverseOverloads( | ||
ScopeInfo const& S, | ||
F&& f, Args&&... args) const | ||
{ | ||
for(const SymbolID& id : S.Members) | ||
{ | ||
const Info& member = get(id); | ||
const auto& lookup = S.Lookups.at(member.Name); | ||
if(lookup.size() == 1 || member.Name.empty()) | ||
{ | ||
visit(member, std::forward<F>(f), | ||
std::forward<Args>(args)...); | ||
} | ||
else if(lookup.front() == id) | ||
{ | ||
OverloadSet overloads(member.Name, | ||
member.Namespace.front(), lookup); | ||
visit(overloads, std::forward<F>(f), | ||
std::forward<Args>(args)...); | ||
} | ||
} | ||
} | ||
|
||
template<class F, class... Args> | ||
void | ||
Corpus:: | ||
traverseOverloads( | ||
RecordInfo const& I, | ||
F&& f, Args&&... args) const | ||
{ | ||
for(const SymbolID& id : I.Members) | ||
{ | ||
const Info& member = get(id); | ||
const auto& lookup = I.Lookups.at(member.Name); | ||
if(lookup.size() == 1 || member.Name.empty()) | ||
{ | ||
visit(member, std::forward<F>(f), | ||
std::forward<Args>(args)...); | ||
} | ||
else if(lookup.front() == id) | ||
{ | ||
OverloadSet overloads(member.Name, I.id, lookup); | ||
visit(overloads, std::forward<F>(f), | ||
std::forward<Args>(args)...); | ||
} | ||
} | ||
} | ||
|
||
template<class F, class... Args> | ||
void | ||
Corpus:: | ||
traverseOverloads( | ||
NamespaceInfo const& I, | ||
F&& f, Args&&... args) const | ||
{ | ||
for(const SymbolID& id : I.Members) | ||
{ | ||
const Info& member = get(id); | ||
const auto& lookup = I.Lookups.at(member.Name); | ||
if(lookup.size() == 1 || member.Name.empty()) | ||
{ | ||
visit(member, std::forward<F>(f), | ||
std::forward<Args>(args)...); | ||
} | ||
else if(lookup.front() == id) | ||
{ | ||
OverloadSet overloads(member.Name, I.id, lookup); | ||
visit(overloads, std::forward<F>(f), | ||
std::forward<Args>(args)...); | ||
} | ||
} | ||
} | ||
|
||
template<class F, class... Args> | ||
void | ||
Corpus:: | ||
traverseOverloads( | ||
EnumInfo const& I, | ||
F&& f, Args&&... args) const | ||
{ | ||
for(const SymbolID& id : I.Members) | ||
{ | ||
const Info& member = get(id); | ||
const auto& lookup = I.Lookups.at(member.Name); | ||
if(lookup.size() == 1 || member.Name.empty()) | ||
{ | ||
visit(member, std::forward<F>(f), | ||
std::forward<Args>(args)...); | ||
} | ||
else if(lookup.front() == id) | ||
{ | ||
OverloadSet overloads(member.Name, I.id, lookup); | ||
visit(overloads, std::forward<F>(f), | ||
std::forward<Args>(args)...); | ||
} | ||
} | ||
} | ||
|
||
template<class F, class... Args> | ||
void | ||
Corpus:: | ||
traverseOverloads( | ||
SpecializationInfo const& I, | ||
F&& f, Args&&... args) const | ||
{ | ||
for(auto const& J : I.Members) | ||
visit(get(J.Specialized), | ||
std::forward<F>(f), | ||
for(const SymbolID& id : I.Members) | ||
{ | ||
const Info& member = get(id); | ||
const auto& lookup = I.Lookups.at(member.Name); | ||
if(lookup.size() == 1 || member.Name.empty()) | ||
{ | ||
visit(member, std::forward<F>(f), | ||
std::forward<Args>(args)...); | ||
} | ||
else if(lookup.front() == id) | ||
{ | ||
OverloadSet overloads(member.Name, I.id, lookup); | ||
visit(overloads, std::forward<F>(f), | ||
std::forward<Args>(args)...); | ||
} | ||
} | ||
} | ||
|
||
class Corpus::iterator | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,7 @@ | |
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
// | ||
// Copyright (c) 2023 Vinnie Falco ([email protected]) | ||
// Copyright (c) 2023 Krystian Stasiowski ([email protected]) | ||
// | ||
// Official repository: https://github.com/cppalliance/mrdocs | ||
// | ||
|
@@ -53,6 +54,14 @@ class MRDOCS_DECL | |
*/ | ||
Corpus const& getCorpus() const; | ||
|
||
/** Returns the Corpus associated with the Dom. | ||
*/ | ||
Corpus const& operator*() const; | ||
|
||
/** Returns the Corpus associated with the Dom. | ||
*/ | ||
Corpus const* operator->() const; | ||
|
||
/** Construct a Dom object representing the given symbol. | ||
This function is called internally when a `dom::Object` | ||
|
@@ -84,6 +93,17 @@ class MRDOCS_DECL | |
dom::Value | ||
getJavadoc( | ||
Javadoc const& jd) const; | ||
|
||
/** Return a Dom value representing an overload set. | ||
A @ref Generator should override this member | ||
and return suitable @ref dom::Value representing | ||
the overload set. | ||
*/ | ||
virtual | ||
dom::Object | ||
getOverloads( | ||
OverloadSet const& os) const; | ||
}; | ||
|
||
} // mrdocs | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.