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 Module = "xl-module"; ///< CSS class name. See user manual chapter #"dxl_styling".
69 static constexpr alib::String Concept = "xl-concept"; ///< CSS class name. See user manual chapter #"dxl_styling".
70 static constexpr alib::String Namespace = "xl-ns"; ///< CSS class name. See user manual chapter #"dxl_styling".
71 static constexpr alib::String Struct = "xl-struct"; ///< CSS class name. See user manual chapter #"dxl_styling".
72 static constexpr alib::String Class = "xl-class"; ///< CSS class name. See user manual chapter #"dxl_styling".
73 static constexpr alib::String Union = "xl-union"; ///< CSS class name. See user manual chapter #"dxl_styling".
74 static constexpr alib::String Enum = "xl-enum"; ///< CSS class name. See user manual chapter #"dxl_styling".
75 static constexpr alib::String EnumElem = "xl-enumelem"; ///< CSS class name. See user manual chapter #"dxl_styling".
76 static constexpr alib::String Var = "xl-var"; ///< CSS class name. See user manual chapter #"dxl_styling".
77 static constexpr alib::String Func = "xl-func"; ///< CSS class name. See user manual chapter #"dxl_styling".
78
79 static constexpr alib::String FileOrDir = "xl-filedir"; ///< CSS class name. See user manual chapter #"dxl_styling".
80 static constexpr alib::String Record = "xl-record"; ///< CSS class name. See user manual chapter #"dxl_styling".
81 static constexpr alib::String Template = "xl-template"; ///< CSS class name. See user manual chapter #"dxl_styling".
82 static constexpr alib::String TemplSpec = "xl-tempspec"; ///< CSS class name. See user manual chapter #"dxl_styling".
83 static constexpr alib::String Indirect = "xl-indirect"; ///< CSS class name. See user manual chapter #"dxl_styling".
84 static constexpr alib::String NsMem = "xl-in-ns"; ///< CSS class name. See user manual chapter #"dxl_styling".
85 static constexpr alib::String RecMem = "xl-in-rec"; ///< CSS class name. See user manual chapter #"dxl_styling".
86 static constexpr alib::String WithDisp = "xl-display"; ///< CSS class name. See user manual chapter #"dxl_styling".
87
88
89 static constexpr alib::String XLEL = "xl-el"; ///< CSS class name. See user manual chapter #"dxl_styling".
90 static constexpr alib::String ELUnknown = "xl-elukn"; ///< CSS class name. See user manual chapter #"dxl_styling".
91
92 /// Constructor.
93 Styles() =default;
94
95 /// Receives the number of style-classes set.
96 /// @return The number of style-classes set.
97 int Size() const { return size; }
98
99 ///@return \c true if a display text was given to the \xl, false otherwise.
100 bool IsVerbal() const { return isVerbal; }
101
102 ///@return \c true if a code entity is targeted by the \xl, false otherwise.
103 bool IsCodeEntity() const { return isCodeEntity; }
104
105 ///@return \c true if a directory is targeted by the \xl, false otherwise.
106 bool IsDir() const { return isDir; }
107
108 ///@return \c true if a file is targeted by the \xl, false otherwise.
109 bool IsFile() const { return isFile; }
110
111 /// Receives a style-class string.
112 /// @param idx The index requested
113 /// @return The class with the given \p{idx}.
114 const alib::String& Get(int idx) const
115 { ALIB_ASSERT( idx< size, "DXL/STYLES") return *list[idx]; }
116
117 /// Adds the given \p{style} class string to this list of styles.
118 /// @param style The target node.
119 void Add( const alib::String& style )
120 { ALIB_ASSERT( size< MAX_STYLES, "DXL/STYLES") list[size++]= &style; }
121
122 /// Sets the styles from the given parameters.
123 /// \note Additional styles are defined and set with the method #"GetELDecoration;2".
124 /// @param node The target-node to set the styles for.
125 /// @param hasDisplayText Denotes whether a dedicated display text was given to the \xl.
126 /// @param isIndirect Denotes whether a type-definition or an inherited member was resolved.
127 void Set( const Index::Node& node, bool hasDisplayText, bool isIndirect);
128
129};
130
131} //namespace [dxl]
132
133
134#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:103
static constexpr alib::String Namespace
CSS class name. See user manual chapter #"dxl_styling".
Definition styles.hpp:70
bool IsFile() const
Definition styles.hpp:109
static constexpr alib::String Template
CSS class name. See user manual chapter #"dxl_styling".
Definition styles.hpp:81
static constexpr alib::String Typedef
CSS class name. See user manual chapter #"dxl_styling".
Definition styles.hpp:67
bool IsVerbal() const
Definition styles.hpp:100
static constexpr alib::String TemplSpec
CSS class name. See user manual chapter #"dxl_styling".
Definition styles.hpp:82
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:84
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:83
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:75
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:76
static constexpr alib::String Struct
CSS class name. See user manual chapter #"dxl_styling".
Definition styles.hpp:71
static constexpr alib::String Concept
CSS class name. See user manual chapter #"dxl_styling".
Definition styles.hpp:69
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:74
int Size() const
Definition styles.hpp:97
static constexpr alib::String Doc
CSS class name. See user manual chapter #"dxl_styling".
Definition styles.hpp:57
static constexpr alib::String Module
CSS class name. See user manual chapter #"dxl_styling".
Definition styles.hpp:68
static constexpr alib::String RecMem
CSS class name. See user manual chapter #"dxl_styling".
Definition styles.hpp:85
static constexpr alib::String FileOrDir
CSS class name. See user manual chapter #"dxl_styling".
Definition styles.hpp:79
static constexpr alib::String Union
CSS class name. See user manual chapter #"dxl_styling".
Definition styles.hpp:73
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:80
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:90
static constexpr alib::String XLEL
CSS class name. See user manual chapter #"dxl_styling".
Definition styles.hpp:89
const alib::String * list[MAX_STYLES]
The original source string.
Definition styles.hpp:35
bool IsDir() const
Definition styles.hpp:106
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:17
void Add(const alib::String &style)
Definition styles.hpp:119
static constexpr alib::String Class
CSS class name. See user manual chapter #"dxl_styling".
Definition styles.hpp:72
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:114
static constexpr alib::String WithDisp
CSS class name. See user manual chapter #"dxl_styling".
Definition styles.hpp:86
static constexpr alib::String Func
CSS class name. See user manual chapter #"dxl_styling".
Definition styles.hpp:77
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