Doxygen
Loading...
Searching...
No Matches
linkifytext.h
Go to the documentation of this file.
1/******************************************************************************
2 *
3 * Copyright (C) 1997-2026 by Dimitri van Heesch.
4 *
5 * Permission to use, copy, modify, and distribute this software and its
6 * documentation under the terms of the GNU General Public License is hereby
7 * granted. No representations are made about the suitability of this software
8 * for any purpose. It is provided "as is" without express or implied warranty.
9 * See the GNU General Public License for more details.
10 *
11 * Documents produced by Doxygen are derivative works derived from the
12 * input used in their production; they are not affected by this license.
13 *
14 */
15
16#ifndef LINKIFYTEXT_H
17#define LINKIFYTEXT_H
18
19#include <string_view>
20
21#include "construct.h"
22
23class ArgumentList;
24class Definition;
25class DString;
26class FileDef;
27
28/** Abstract interface for a hyperlinked text fragment. */
30{
31 public:
33
34 virtual void writeString(std::string_view,bool) const = 0;
35 virtual void writeBreak(int indent) const = 0;
36 virtual void writeLink(const DString &extRef,const DString &file,
37 const DString &anchor,std::string_view text
38 ) const = 0;
39};
40
41//--------------------------------------------------------------------
42
44{
45 public:
46 // === getters for optional params
47 const Definition *scope() const { return m_scope; }
48 const FileDef *fileScope() const { return m_fileScope; }
49 const Definition *self() const { return m_self; }
50 const ArgumentList *argumentList() const { return m_al; }
51 bool autoBreak() const { return m_autoBreak; }
52 bool external() const { return m_external; }
53 bool keepSpaces() const { return m_keepSpaces; }
54 int indentLevel() const { return m_indentLevel; }
55 size_t breakThreshold() const { return m_breakThreshold; }
56
57 // === setters for optional params
59 { m_scope = scope; return *this; }
60
63
65 { m_self = self; return *this;}
66
68 { m_al = al; return *this; }
69
72
75
78
81
84
85 private:
86 // optional params with defaults
87 const Definition * m_scope = nullptr;
88 const FileDef * m_fileScope = nullptr;
89 const Definition * m_self = nullptr;
90 const ArgumentList *m_al = nullptr;
91 bool m_autoBreak = false;
92 bool m_external = true;
93 bool m_keepSpaces = false;
95 size_t m_breakThreshold = 30;
96};
97
98//--------------------------------------------------------------------
99
100void linkifyText(const TextGeneratorIntf &ol,
101 const DString &text,
102 const LinkifyTextOptions &options
103 );
104
105#endif // LINKIFYTEXT_H
This class represents an function or template argument list.
Definition arguments.h:66
A String class for use with Doxygen wrapping std::string and adding some additional functionality off...
Definition dstring.h:84
The common base class of all entity definitions found in the sources.
Definition definition.h:77
A model of a file symbol.
Definition filedef.h:97
Abstract interface for a hyperlinked text fragment.
Definition linkifytext.h:30
virtual void writeString(std::string_view, bool) const =0
virtual void writeBreak(int indent) const =0
virtual void writeLink(const DString &extRef, const DString &file, const DString &anchor, std::string_view text) const =0
#define ABSTRACT_BASE_CLASS(cls)
Macro to implement rule of 5 for an abstract base class.
Definition construct.h:20
void linkifyText(const TextGeneratorIntf &ol, const DString &text, const LinkifyTextOptions &options)
Definition dstring.h:913
LinkifyTextOptions & setScope(const Definition *scope)
Definition linkifytext.h:58
const FileDef * m_fileScope
Definition linkifytext.h:88
LinkifyTextOptions & setAutoBreak(bool autoBreak)
Definition linkifytext.h:70
const Definition * m_self
Definition linkifytext.h:89
LinkifyTextOptions & setSelf(const Definition *self)
Definition linkifytext.h:64
int indentLevel() const
Definition linkifytext.h:54
LinkifyTextOptions & setFileScope(const FileDef *fileScope)
Definition linkifytext.h:61
bool external() const
Definition linkifytext.h:52
const ArgumentList * m_al
Definition linkifytext.h:90
LinkifyTextOptions & setIndentLevel(int indentLevel)
Definition linkifytext.h:79
const ArgumentList * argumentList() const
Definition linkifytext.h:50
LinkifyTextOptions & setArgumentList(const ArgumentList *al)
Definition linkifytext.h:67
const Definition * scope() const
Definition linkifytext.h:47
const Definition * self() const
Definition linkifytext.h:49
LinkifyTextOptions & setKeepSpaces(bool keepSpaces)
Definition linkifytext.h:76
size_t breakThreshold() const
Definition linkifytext.h:55
bool keepSpaces() const
Definition linkifytext.h:53
const FileDef * fileScope() const
Definition linkifytext.h:48
const Definition * m_scope
Definition linkifytext.h:87
LinkifyTextOptions & setExternal(bool external)
Definition linkifytext.h:73
bool autoBreak() const
Definition linkifytext.h:51
LinkifyTextOptions & setBreakThreshold(size_t breakThreshold)
Definition linkifytext.h:82