mirror of
https://github.com/NixOS/nix.git
synced 2025-11-17 16:02:43 +01:00
Finish converting existing comments for internal API docs (#8146)
* Finish converting existing comments for internal API docs 99% of this was just reformatting existing comments. Only two exceptions: - Expanded upon `BuildResult::status` compat note - Split up file-level `symbol-table.hh` doc comments to get per-definition docs Also fixed a few whitespace goofs, turning leading tabs to spaces and removing trailing spaces. Picking up from #8133 * Fix two things from comments * Use triple-backtick not indent for `dumpPath` * Convert GNU-style `\`..'` quotes to markdown style in API docs This will render correctly.
This commit is contained in:
parent
54b3b6ebc6
commit
0746951be1
53 changed files with 1907 additions and 938 deletions
|
|
@ -10,15 +10,11 @@
|
|||
|
||||
namespace nix {
|
||||
|
||||
/* Symbol table used by the parser and evaluator to represent and look
|
||||
up identifiers and attributes efficiently. SymbolTable::create()
|
||||
converts a string into a symbol. Symbols have the property that
|
||||
they can be compared efficiently (using an equality test),
|
||||
because the symbol table stores only one copy of each string. */
|
||||
|
||||
/* This class mainly exists to give us an operator<< for ostreams. We could also
|
||||
return plain strings from SymbolTable, but then we'd have to wrap every
|
||||
instance of a symbol that is fmt()ed, which is inconvenient and error-prone. */
|
||||
/**
|
||||
* This class mainly exists to give us an operator<< for ostreams. We could also
|
||||
* return plain strings from SymbolTable, but then we'd have to wrap every
|
||||
* instance of a symbol that is fmt()ed, which is inconvenient and error-prone.
|
||||
*/
|
||||
class SymbolStr
|
||||
{
|
||||
friend class SymbolTable;
|
||||
|
|
@ -47,6 +43,11 @@ public:
|
|||
friend std::ostream & operator <<(std::ostream & os, const SymbolStr & symbol);
|
||||
};
|
||||
|
||||
/**
|
||||
* Symbols have the property that they can be compared efficiently
|
||||
* (using an equality test), because the symbol table stores only one
|
||||
* copy of each string.
|
||||
*/
|
||||
class Symbol
|
||||
{
|
||||
friend class SymbolTable;
|
||||
|
|
@ -66,6 +67,10 @@ public:
|
|||
bool operator!=(const Symbol other) const { return id != other.id; }
|
||||
};
|
||||
|
||||
/**
|
||||
* Symbol table used by the parser and evaluator to represent and look
|
||||
* up identifiers and attributes efficiently.
|
||||
*/
|
||||
class SymbolTable
|
||||
{
|
||||
private:
|
||||
|
|
@ -74,6 +79,9 @@ private:
|
|||
|
||||
public:
|
||||
|
||||
/**
|
||||
* converts a string into a symbol.
|
||||
*/
|
||||
Symbol create(std::string_view s)
|
||||
{
|
||||
// Most symbols are looked up more than once, so we trade off insertion performance
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue