Doxygen XLinks
by
V: 2511R0
Website: doxygen
Loading...
Searching...
No Matches
styles.hpp
Go to the documentation of this file.
1//==================================================================================================
2/// \file
3/// This header-file is part of \dxl - A doxygen post-processor that allows to define smarter
4/// <b>Doxygen</b>-links.
5///
6/// \emoji :copyright: 2025-2026 A-Worx GmbH, Germany.
7/// Published under \ref mainpage_license "Boost Software License".
8//==================================================================================================
9#ifndef HPP_DXL_STYLES
10#define HPP_DXL_STYLES
11#pragma once
12#include "target.hpp"
13#include "index.hpp"
14
15namespace dxl {
16class XLink;
17class DoxygenXLinks;
18
19
20
21// #################################################################################################
22/// Encapsulates the information given with the links that this whole project was created for.
23/// Instances represent an XLink to a doxygen #"dxl Target" as given by the user.
24// #################################################################################################
25class Styles {
26 friend class DoxygenXLinks;
27
28
29
30 protected:
31 /// The maximum number of styles attached by \dxl.
32 static constexpr int MAX_STYLES= 7;
33
34 /// The original source string.
36
37 /// The number of styles in #".list".
38 int size= 0;
39
40 /// This is set when a display text was given to the \xl.
41 bool isVerbal= false;
42
43 /// This set when a code entity is targeted by the \xl.
44 bool isCodeEntity= false;
45
46 /// This set when a dir is targeted by the \xl.
47 bool isDir= false;
48
49 /// This set when a file is targeted by the \xl.
50 bool isFile= false;
51
52 public:
53
54 static constexpr alib::String EL = "el"; ///< CSS class name. See user manual chapter #"dxl_styling".
55 static constexpr alib::String ELRef = "elRef"; ///< CSS class name. See user manual chapter #"dxl_styling".
56
57 static constexpr alib::String Doc = "xl-doc"; ///< CSS class name. See user manual chapter #"dxl_styling".
58
59 static constexpr alib::String File = "xl-file"; ///< CSS class name. See user manual chapter #"dxl_styling".
60 static constexpr alib::String SrcFile = "xl-srcfile"; ///< todo: only set with EL/ELRef today.
61 static constexpr alib::String SrcFileLine= "xl-srcline"; ///< CSS class name. See user manual chapter #"dxl_styling".
62 static constexpr alib::String Dir = "xl-dir"; ///< CSS class name. See user manual chapter #"dxl_styling".
63
64 static constexpr alib::String Code = "xl-entity"; ///< CSS class name. See user manual chapter #"dxl_styling".
65
66 static constexpr alib::String Macro = "xl-macro"; ///< CSS class name. See user manual chapter #"dxl_styling".
67 static constexpr alib::String Typedef = "xl-typedef"; ///< CSS class name. See user manual chapter #"dxl_styling".
68 static constexpr alib::String Concept = "xl-concept"; ///< CSS class name. See user manual chapter #"dxl_styling".
69 static constexpr alib::String Namespace = "xl-ns"; ///< CSS class name. See user manual chapter #"dxl_styling".
70 static constexpr alib::String Struct = "xl-struct"; ///< CSS class name. See user manual chapter #"dxl_styling".
71 static constexpr alib::String Class = "xl-class"; ///< CSS class name. See user manual chapter #"dxl_styling".
72 static constexpr alib::String Union = "xl-union"; ///< CSS class name. See user manual chapter #"dxl_styling".
73 static constexpr alib::String Enum = "xl-enum"; ///< CSS class name. See user manual chapter #"dxl_styling".
74 static constexpr alib::String EnumElem = "xl-enumelem"; ///< CSS class name. See user manual chapter #"dxl_styling".
75 static constexpr alib::String Var = "xl-var"; ///< CSS class name. See user manual chapter #"dxl_styling".
76 static constexpr alib::String Func = "xl-func"; ///< CSS class name. See user manual chapter #"dxl_styling".
77
78 static constexpr alib::String FileOrDir = "xl-filedir"; ///< CSS class name. See user manual chapter #"dxl_styling".
79 static constexpr alib::String Record = "xl-record"; ///< CSS class name. See user manual chapter #"dxl_styling".
80 static constexpr alib::String Template = "xl-template"; ///< CSS class name. See user manual chapter #"dxl_styling".
81 static constexpr alib::String TemplSpec = "xl-tempspec"; ///< CSS class name. See user manual chapter #"dxl_styling".
82 static constexpr alib::String Indirect = "xl-indirect"; ///< CSS class name. See user manual chapter #"dxl_styling".
83 static constexpr alib::String NsMem = "xl-in-ns"; ///< CSS class name. See user manual chapter #"dxl_styling".
84 static constexpr alib::String RecMem = "xl-in-rec"; ///< CSS class name. See user manual chapter #"dxl_styling".
85 static constexpr alib::String WithDisp = "xl-display"; ///< CSS class name. See user manual chapter #"dxl_styling".
86
87
88 static constexpr alib::String XLEL = "xl-el"; ///< CSS class name. See user manual chapter #"dxl_styling".
89 static constexpr alib::String ELUnknown = "xl-elukn"; ///< CSS class name. See user manual chapter #"dxl_styling".
90
91 /// Constructor.
92 Styles() = default;
93
94 /// Receives the number of style-classes set.
95 /// @return The number of style-classes set.
96 int Size() const { return size; }
97
98 ///@return \c true if a display text was given to the \xl, false otherwise.
99 bool IsVerbal() const { return isVerbal; }
100
101 ///@return \c true if a code entity is targeted by the \xl, false otherwise.
102 bool IsCodeEntity() const { return isCodeEntity; }
103
104 ///@return \c true if a directory is targeted by the \xl, false otherwise.
105 bool IsDir() const { return isDir; }
106
107 ///@return \c true if a file is targeted by the \xl, false otherwise.
108 bool IsFile() const { return isFile; }
109
110 /// Receives a style-class string.
111 /// @param idx The index requested
112 /// @return The class with the given \p{idx}.
113 const alib::String& Get(int idx) const
114 { ALIB_ASSERT( idx< size, "DXL/STYLES") return *list[idx]; }
115
116 /// Adds the given \p{style} class string to this list of styles.
117 /// @param style The target node.
118 void Add( const alib::String& style )
119 { ALIB_ASSERT( size< MAX_STYLES, "DXL/STYLES") list[size++]= &style; }
120
121 /// Sets the styles from the given parameters.
122 /// \note Additional styles are defined and set with the method #"GetELDecoration;2".
123 /// @param node The target-node to set the styles for.
124 /// @param hasDisplayText Denotes whether a dedicated display text was given to the \xl.
125 /// @param isIndirect Denotes whether a type-definition or an inherited member was resolved.
126 void Set( const Index::Node& node, bool hasDisplayText, bool isIndirect);
127
128};
129
130} //namespace [dxl]
131
132
133#endif // HPP_DXL_STYLES
#define ALIB_ASSERT(cond, domain)
static constexpr int MAX_STYLES
The maximum number of styles attached by DoxygenXLinks.
Definition styles.hpp:32
static constexpr alib::String EL
CSS class name. See user manual chapter #"dxl_styling".
Definition styles.hpp:54
bool IsCodeEntity() const
Definition styles.hpp:102
static constexpr alib::String Namespace
CSS class name. See user manual chapter #"dxl_styling".
Definition styles.hpp:69
bool IsFile() const
Definition styles.hpp:108
static constexpr alib::String Template
CSS class name. See user manual chapter #"dxl_styling".
Definition styles.hpp:80
static constexpr alib::String Typedef
CSS class name. See user manual chapter #"dxl_styling".
Definition styles.hpp:67
bool IsVerbal() const
Definition styles.hpp:99
static constexpr alib::String TemplSpec
CSS class name. See user manual chapter #"dxl_styling".
Definition styles.hpp:81
static constexpr alib::String SrcFileLine
CSS class name. See user manual chapter #"dxl_styling".
Definition styles.hpp:61
static constexpr alib::String NsMem
CSS class name. See user manual chapter #"dxl_styling".
Definition styles.hpp:83
bool isFile
This set when a file is targeted by the XLink.
Definition styles.hpp:50
static constexpr alib::String Indirect
CSS class name. See user manual chapter #"dxl_styling".
Definition styles.hpp:82
static constexpr alib::String Dir
CSS class name. See user manual chapter #"dxl_styling".
Definition styles.hpp:62
static constexpr alib::String Macro
CSS class name. See user manual chapter #"dxl_styling".
Definition styles.hpp:66
static constexpr alib::String EnumElem
CSS class name. See user manual chapter #"dxl_styling".
Definition styles.hpp:74
static constexpr alib::String SrcFile
todo: only set with EL/ELRef today.
Definition styles.hpp:60
static constexpr alib::String Var
CSS class name. See user manual chapter #"dxl_styling".
Definition styles.hpp:75
static constexpr alib::String Struct
CSS class name. See user manual chapter #"dxl_styling".
Definition styles.hpp:70
static constexpr alib::String Concept
CSS class name. See user manual chapter #"dxl_styling".
Definition styles.hpp:68
static constexpr alib::String ELRef
CSS class name. See user manual chapter #"dxl_styling".
Definition styles.hpp:55
static constexpr alib::String Enum
CSS class name. See user manual chapter #"dxl_styling".
Definition styles.hpp:73
int Size() const
Definition styles.hpp:96
static constexpr alib::String Doc
CSS class name. See user manual chapter #"dxl_styling".
Definition styles.hpp:57
static constexpr alib::String RecMem
CSS class name. See user manual chapter #"dxl_styling".
Definition styles.hpp:84
static constexpr alib::String FileOrDir
CSS class name. See user manual chapter #"dxl_styling".
Definition styles.hpp:78
static constexpr alib::String Union
CSS class name. See user manual chapter #"dxl_styling".
Definition styles.hpp:72
static constexpr alib::String File
CSS class name. See user manual chapter #"dxl_styling".
Definition styles.hpp:59
static constexpr alib::String Record
CSS class name. See user manual chapter #"dxl_styling".
Definition styles.hpp:79
bool isDir
This set when a dir is targeted by the XLink.
Definition styles.hpp:47
static constexpr alib::String ELUnknown
CSS class name. See user manual chapter #"dxl_styling".
Definition styles.hpp:89
static constexpr alib::String XLEL
CSS class name. See user manual chapter #"dxl_styling".
Definition styles.hpp:88
const alib::String * list[MAX_STYLES]
The original source string.
Definition styles.hpp:35
bool IsDir() const
Definition styles.hpp:105
bool isVerbal
This is set when a display text was given to the XLink.
Definition styles.hpp:41
int size
The number of styles in #".list".
Definition styles.hpp:38
void Set(const Index::Node &node, bool hasDisplayText, bool isIndirect)
Definition styles.cpp:18
void Add(const alib::String &style)
Definition styles.hpp:118
static constexpr alib::String Class
CSS class name. See user manual chapter #"dxl_styling".
Definition styles.hpp:71
bool isCodeEntity
This set when a code entity is targeted by the XLink.
Definition styles.hpp:44
const alib::String & Get(int idx) const
Definition styles.hpp:113
static constexpr alib::String WithDisp
CSS class name. See user manual chapter #"dxl_styling".
Definition styles.hpp:85
static constexpr alib::String Func
CSS class name. See user manual chapter #"dxl_styling".
Definition styles.hpp:76
Styles()=default
Constructor.
static constexpr alib::String Code
CSS class name. See user manual chapter #"dxl_styling".
Definition styles.hpp:64
strings::TString< character > String
todox
Definition doxyfile.cpp:20
The cursor type of the #"StringTree".
Definition index.hpp:105