nk
1.0.0
C++ Numerical Computing Runtime
Toggle main menu visibility
Loading...
Searching...
No Matches
help_catalog.hpp
1
#pragma once
2
3
#include <string>
4
#include <vector>
5
#include <unordered_map>
6
7
namespace
nk::bundle {
8
9
struct
HelpEntry
{
10
std::string name;
11
std::string summary;
12
std::string signature;
13
std::string doc;
14
};
15
16
struct
HelpSection
{
17
std::string title;
18
std::vector<HelpEntry> entries;
19
};
20
21
struct
HelpCategory
{
22
std::string name;
// e.g. "elmat", "elfun", "images", "signal"
23
std::string title;
// e.g. "Elementary matrices and matrix manipulation."
24
std::vector<HelpSection> sections;
25
};
26
27
class
HelpCatalog {
28
public
:
29
static
const
HelpCatalog &instance();
30
31
// List all registered categories in order
32
const
std::vector<HelpCategory> &
categories
()
const
{
return
categories_; }
33
34
// Find category by name (case-insensitive, alias-aware e.g. "images" -> "image")
35
const
HelpCategory
*findCategory(std::string name)
const
;
36
37
// Find function help by name (case-insensitive)
38
const
HelpEntry
*findFunction(std::string name)
const
;
39
40
// Generate formatted MATLAB-style help overview of all categories
41
std::string formatAllCategories()
const
;
42
43
// Generate formatted MATLAB-style help for a specific category (e.g. "help elmat")
44
std::string formatCategory(
const
std::string &catName)
const
;
45
46
// Generate formatted help for a specific function (e.g. "help sin")
47
std::string formatFunction(
const
std::string &funcName)
const
;
48
49
// Return list of function names in a given category
50
std::vector<std::string> getCategoryFunctions(
const
std::string &catName)
const
;
51
52
// Return list of all function names across all categories
53
std::vector<std::string> getAllFunctions()
const
;
54
55
private
:
56
HelpCatalog();
57
void
initCategories();
58
59
std::vector<HelpCategory> categories_;
60
std::unordered_map<std::string, size_t> categoryIndex_;
61
std::unordered_map<std::string, HelpEntry> functionIndex_;
62
};
63
64
}
// namespace nk::bundle
nk::bundle::categories
std::vector< std::string > categories()
Lists all registered documentation categories (categories).
nk::bundle::HelpCategory
Definition
help_catalog.hpp:21
nk::bundle::HelpEntry
Definition
help_catalog.hpp:9
nk::bundle::HelpSection
Definition
help_catalog.hpp:16
src
bundle
include
nk
bundle
help
help_catalog.hpp
Generated by
1.17.0