Skip to content

Commit 6aa70ec

Browse files
committed
bug 512677 New command specifying an empty comment
A new command `\trivial` is introduced signaling that the entity is "trivial" and does not need to be documented. Advantage is that the entity will appear in the documentation without using a setting like `EXTRACT_ALL`
1 parent 9637460 commit 6aa70ec

File tree

16 files changed

+276
-52
lines changed

16 files changed

+276
-52
lines changed

addon/doxmlparser/doxmlparser/compound.py

Lines changed: 42 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1378,7 +1378,7 @@ class compounddefType(GeneratedsSuper):
13781378
__hash__ = GeneratedsSuper.__hash__
13791379
subclass = None
13801380
superclass = None
1381-
def __init__(self, id=None, kind=None, language=None, prot=None, final=None, inline=None, sealed=None, abstract=None, compoundname=None, title=None, basecompoundref=None, derivedcompoundref=None, includes=None, includedby=None, incdepgraph=None, invincdepgraph=None, innermodule=None, innerdir=None, innerfile=None, innerclass=None, innerconcept=None, innernamespace=None, innerpage=None, innergroup=None, qualifier=None, templateparamlist=None, sectiondef=None, tableofcontents=None, requiresclause=None, initializer=None, briefdescription=None, detaileddescription=None, exports=None, inheritancegraph=None, collaborationgraph=None, programlisting=None, location=None, listofallmembers=None, gds_collector_=None, **kwargs_):
1381+
def __init__(self, id=None, kind=None, trivial=None, language=None, prot=None, final=None, inline=None, sealed=None, abstract=None, compoundname=None, title=None, basecompoundref=None, derivedcompoundref=None, includes=None, includedby=None, incdepgraph=None, invincdepgraph=None, innermodule=None, innerdir=None, innerfile=None, innerclass=None, innerconcept=None, innernamespace=None, innerpage=None, innergroup=None, qualifier=None, templateparamlist=None, sectiondef=None, tableofcontents=None, requiresclause=None, initializer=None, briefdescription=None, detaileddescription=None, exports=None, inheritancegraph=None, collaborationgraph=None, programlisting=None, location=None, listofallmembers=None, gds_collector_=None, **kwargs_):
13821382
self.gds_collector_ = gds_collector_
13831383
self.gds_elementtree_node_ = None
13841384
self.original_tagname_ = None
@@ -1388,6 +1388,8 @@ def __init__(self, id=None, kind=None, language=None, prot=None, final=None, inl
13881388
self.id_nsprefix_ = None
13891389
self.kind = _cast(None, kind)
13901390
self.kind_nsprefix_ = None
1391+
self.trivial = _cast(None, trivial)
1392+
self.trivial_nsprefix_ = None
13911393
self.language = _cast(None, language)
13921394
self.language_nsprefix_ = None
13931395
self.prot = _cast(None, prot)
@@ -1729,6 +1731,10 @@ def get_kind(self):
17291731
return self.kind
17301732
def set_kind(self, kind):
17311733
self.kind = kind
1734+
def get_trivial(self):
1735+
return self.trivial
1736+
def set_trivial(self, trivial):
1737+
self.trivial = trivial
17321738
def get_language(self):
17331739
return self.language
17341740
def set_language(self, language):
@@ -1766,44 +1772,44 @@ def validate_DoxCompoundKind(self, value):
17661772
lineno = self.gds_get_node_lineno_()
17671773
self.gds_collector_.add_message('Value "%(value)s"%(lineno)s does not match xsd enumeration restriction on DoxCompoundKind' % {"value" : encode_str_2_3(value), "lineno": lineno} )
17681774
result = False
1769-
def validate_DoxLanguage(self, value):
1770-
# Validate type DoxLanguage, a restriction on xsd:string.
1775+
def validate_DoxBool(self, value):
1776+
# Validate type DoxBool, a restriction on xsd:string.
17711777
if value is not None and Validate_simpletypes_ and self.gds_collector_ is not None:
17721778
if not isinstance(value, str):
17731779
lineno = self.gds_get_node_lineno_()
17741780
self.gds_collector_.add_message('Value "%(value)s"%(lineno)s is not of the correct base simple type (str)' % {"value": value, "lineno": lineno, })
17751781
return False
17761782
value = value
1777-
enumerations = ['Unknown', 'IDL', 'Java', 'C#', 'D', 'PHP', 'Objective-C', 'C++', 'JavaScript', 'Python', 'Fortran', 'VHDL', 'XML', 'SQL', 'Markdown', 'Slice', 'Lex']
1783+
enumerations = ['yes', 'no']
17781784
if value not in enumerations:
17791785
lineno = self.gds_get_node_lineno_()
1780-
self.gds_collector_.add_message('Value "%(value)s"%(lineno)s does not match xsd enumeration restriction on DoxLanguage' % {"value" : encode_str_2_3(value), "lineno": lineno} )
1786+
self.gds_collector_.add_message('Value "%(value)s"%(lineno)s does not match xsd enumeration restriction on DoxBool' % {"value" : encode_str_2_3(value), "lineno": lineno} )
17811787
result = False
1782-
def validate_DoxProtectionKind(self, value):
1783-
# Validate type DoxProtectionKind, a restriction on xsd:string.
1788+
def validate_DoxLanguage(self, value):
1789+
# Validate type DoxLanguage, a restriction on xsd:string.
17841790
if value is not None and Validate_simpletypes_ and self.gds_collector_ is not None:
17851791
if not isinstance(value, str):
17861792
lineno = self.gds_get_node_lineno_()
17871793
self.gds_collector_.add_message('Value "%(value)s"%(lineno)s is not of the correct base simple type (str)' % {"value": value, "lineno": lineno, })
17881794
return False
17891795
value = value
1790-
enumerations = ['public', 'protected', 'private', 'package']
1796+
enumerations = ['Unknown', 'IDL', 'Java', 'C#', 'D', 'PHP', 'Objective-C', 'C++', 'JavaScript', 'Python', 'Fortran', 'VHDL', 'XML', 'SQL', 'Markdown', 'Slice', 'Lex']
17911797
if value not in enumerations:
17921798
lineno = self.gds_get_node_lineno_()
1793-
self.gds_collector_.add_message('Value "%(value)s"%(lineno)s does not match xsd enumeration restriction on DoxProtectionKind' % {"value" : encode_str_2_3(value), "lineno": lineno} )
1799+
self.gds_collector_.add_message('Value "%(value)s"%(lineno)s does not match xsd enumeration restriction on DoxLanguage' % {"value" : encode_str_2_3(value), "lineno": lineno} )
17941800
result = False
1795-
def validate_DoxBool(self, value):
1796-
# Validate type DoxBool, a restriction on xsd:string.
1801+
def validate_DoxProtectionKind(self, value):
1802+
# Validate type DoxProtectionKind, a restriction on xsd:string.
17971803
if value is not None and Validate_simpletypes_ and self.gds_collector_ is not None:
17981804
if not isinstance(value, str):
17991805
lineno = self.gds_get_node_lineno_()
18001806
self.gds_collector_.add_message('Value "%(value)s"%(lineno)s is not of the correct base simple type (str)' % {"value": value, "lineno": lineno, })
18011807
return False
18021808
value = value
1803-
enumerations = ['yes', 'no']
1809+
enumerations = ['public', 'protected', 'private', 'package']
18041810
if value not in enumerations:
18051811
lineno = self.gds_get_node_lineno_()
1806-
self.gds_collector_.add_message('Value "%(value)s"%(lineno)s does not match xsd enumeration restriction on DoxBool' % {"value" : encode_str_2_3(value), "lineno": lineno} )
1812+
self.gds_collector_.add_message('Value "%(value)s"%(lineno)s does not match xsd enumeration restriction on DoxProtectionKind' % {"value" : encode_str_2_3(value), "lineno": lineno} )
18071813
result = False
18081814
def hasContent_(self):
18091815
if (
@@ -1871,6 +1877,9 @@ def exportAttributes(self, outfile, level, already_processed, namespaceprefix_='
18711877
if self.kind is not None and 'kind' not in already_processed:
18721878
already_processed.add('kind')
18731879
outfile.write(' kind=%s' % (self.gds_encode(self.gds_format_string(quote_attrib(self.kind), input_name='kind')), ))
1880+
if self.trivial is not None and 'trivial' not in already_processed:
1881+
already_processed.add('trivial')
1882+
outfile.write(' trivial=%s' % (self.gds_encode(self.gds_format_string(quote_attrib(self.trivial), input_name='trivial')), ))
18741883
if self.language is not None and 'language' not in already_processed:
18751884
already_processed.add('language')
18761885
outfile.write(' language=%s' % (self.gds_encode(self.gds_format_string(quote_attrib(self.language), input_name='language')), ))
@@ -2008,6 +2017,11 @@ def buildAttributes(self, node, attrs, already_processed):
20082017
already_processed.add('kind')
20092018
self.kind = value
20102019
self.validate_DoxCompoundKind(self.kind) # validate type DoxCompoundKind
2020+
value = find_attr_value_('trivial', node)
2021+
if value is not None and 'trivial' not in already_processed:
2022+
already_processed.add('trivial')
2023+
self.trivial = value
2024+
self.validate_DoxBool(self.trivial) # validate type DoxBool
20112025
value = find_attr_value_('language', node)
20122026
if value is not None and 'language' not in already_processed:
20132027
already_processed.add('language')
@@ -3741,7 +3755,7 @@ class memberdefType(GeneratedsSuper):
37413755
__hash__ = GeneratedsSuper.__hash__
37423756
subclass = None
37433757
superclass = None
3744-
def __init__(self, kind=None, id=None, prot=None, static=None, extern=None, strong=None, const=None, explicit=None, inline=None, refqual=None, virt=None, volatile=None, mutable=None, thread_local=None, noexcept=None, noexceptexpression=None, nodiscard=None, constexpr=None, consteval=None, constinit=None, readable=None, writable=None, initonly=None, settable=None, privatesettable=None, protectedsettable=None, gettable=None, privategettable=None, protectedgettable=None, final=None, sealed=None, new=None, add=None, remove=None, raise_=None, optional=None, required=None, accessor=None, attribute=None, property=None, readonly=None, bound=None, removable=None, constrained=None, transient=None, maybevoid=None, maybedefault=None, maybeambiguous=None, templateparamlist=None, type_=None, definition=None, argsstring=None, name=None, qualifiedname=None, read=None, write=None, bitfield=None, reimplements=None, reimplementedby=None, qualifier=None, param=None, enumvalue=None, requiresclause=None, initializer=None, exceptions=None, briefdescription=None, detaileddescription=None, inbodydescription=None, location=None, references=None, referencedby=None, gds_collector_=None, **kwargs_):
3758+
def __init__(self, kind=None, id=None, prot=None, static=None, extern=None, trivial=None, strong=None, const=None, explicit=None, inline=None, refqual=None, virt=None, volatile=None, mutable=None, thread_local=None, noexcept=None, noexceptexpression=None, nodiscard=None, constexpr=None, consteval=None, constinit=None, readable=None, writable=None, initonly=None, settable=None, privatesettable=None, protectedsettable=None, gettable=None, privategettable=None, protectedgettable=None, final=None, sealed=None, new=None, add=None, remove=None, raise_=None, optional=None, required=None, accessor=None, attribute=None, property=None, readonly=None, bound=None, removable=None, constrained=None, transient=None, maybevoid=None, maybedefault=None, maybeambiguous=None, templateparamlist=None, type_=None, definition=None, argsstring=None, name=None, qualifiedname=None, read=None, write=None, bitfield=None, reimplements=None, reimplementedby=None, qualifier=None, param=None, enumvalue=None, requiresclause=None, initializer=None, exceptions=None, briefdescription=None, detaileddescription=None, inbodydescription=None, location=None, references=None, referencedby=None, gds_collector_=None, **kwargs_):
37453759
self.gds_collector_ = gds_collector_
37463760
self.gds_elementtree_node_ = None
37473761
self.original_tagname_ = None
@@ -3757,6 +3771,8 @@ def __init__(self, kind=None, id=None, prot=None, static=None, extern=None, stro
37573771
self.static_nsprefix_ = None
37583772
self.extern = _cast(None, extern)
37593773
self.extern_nsprefix_ = None
3774+
self.trivial = _cast(None, trivial)
3775+
self.trivial_nsprefix_ = None
37603776
self.strong = _cast(None, strong)
37613777
self.strong_nsprefix_ = None
37623778
self.const = _cast(None, const)
@@ -4079,6 +4095,10 @@ def get_extern(self):
40794095
return self.extern
40804096
def set_extern(self, extern):
40814097
self.extern = extern
4098+
def get_trivial(self):
4099+
return self.trivial
4100+
def set_trivial(self, trivial):
4101+
self.trivial = trivial
40824102
def get_strong(self):
40834103
return self.strong
40844104
def set_strong(self, strong):
@@ -4397,6 +4417,9 @@ def exportAttributes(self, outfile, level, already_processed, namespaceprefix_='
43974417
if self.extern is not None and 'extern' not in already_processed:
43984418
already_processed.add('extern')
43994419
outfile.write(' extern=%s' % (self.gds_encode(self.gds_format_string(quote_attrib(self.extern), input_name='extern')), ))
4420+
if self.trivial is not None and 'trivial' not in already_processed:
4421+
already_processed.add('trivial')
4422+
outfile.write(' trivial=%s' % (self.gds_encode(self.gds_format_string(quote_attrib(self.trivial), input_name='trivial')), ))
44004423
if self.strong is not None and 'strong' not in already_processed:
44014424
already_processed.add('strong')
44024425
outfile.write(' strong=%s' % (self.gds_encode(self.gds_format_string(quote_attrib(self.strong), input_name='strong')), ))
@@ -4644,6 +4667,11 @@ def buildAttributes(self, node, attrs, already_processed):
46444667
already_processed.add('extern')
46454668
self.extern = value
46464669
self.validate_DoxBool(self.extern) # validate type DoxBool
4670+
value = find_attr_value_('trivial', node)
4671+
if value is not None and 'trivial' not in already_processed:
4672+
already_processed.add('trivial')
4673+
self.trivial = value
4674+
self.validate_DoxBool(self.trivial) # validate type DoxBool
46474675
value = find_attr_value_('strong', node)
46484676
if value is not None and 'strong' not in already_processed:
46494677
already_processed.add('strong')

doc/commands.dox

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -235,6 +235,7 @@ documentation:
235235
\refitem cmdthrows \\throws
236236
\refitem cmdtodo \\todo
237237
\refitem cmdtparam \\tparam
238+
\refitem cmdtrivial \\trivial
238239
\refitem cmdtypedef \\typedef
239240
\refitem cmdplantumlfile \\plantumlfile
240241
\refitem cmdunion \\union
@@ -1510,6 +1511,15 @@ Description
15101511

15111512
\sa section \ref cmdfn "\\fn", \ref cmdproperty "\\property", and \ref cmdtypedef "\\typedef".
15121513

1514+
<hr>
1515+
\section cmdtrivial \\trivial
1516+
1517+
\addindex \\trivial
1518+
Indicates that the entity doesn't need documentation as it is "trivial", but that it should be
1519+
show in the documentation anyway.
1520+
1521+
\sa \ref cfg_extract_all "EXTRACT_ALL"
1522+
15131523
<hr>
15141524
\section cmdvhdlflow \\vhdlflow [(title for the flow chart)]
15151525

src/classdef.cpp

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,7 @@ class ClassDefImpl : public DefinitionMixin<ClassDefMutable>
207207
QCString displayName(bool includeScope=TRUE) const override;
208208
CompoundType compoundType() const override;
209209
QCString compoundTypeString() const override;
210+
bool isTrivial() const override;
210211
const BaseClassList &baseClasses() const override;
211212
void updateBaseClasses(const BaseClassList &bcd) override;
212213
const BaseClassList &subClasses() const override;
@@ -293,6 +294,7 @@ class ClassDefImpl : public DefinitionMixin<ClassDefMutable>
293294
void addUsedClass(ClassDef *cd,const QCString &accessName,Protection prot) override;
294295
void addUsedByClass(ClassDef *cd,const QCString &accessName,Protection prot) override;
295296
void setIsStatic(bool b) override;
297+
void setIsTrivial(bool b) override;
296298
void setCompoundType(CompoundType t) override;
297299
void setClassName(const QCString &name) override;
298300
void setClassSpecifier(TypeSpecifier spec) override;
@@ -510,6 +512,9 @@ class ClassDefImpl : public DefinitionMixin<ClassDefMutable>
510512
/*! Is the class part of an unnamed namespace? */
511513
bool m_isStatic = false;
512514

515+
/*! Is the class trivial without class documentation? */
516+
bool m_isTrivial = false;
517+
513518
/*! TRUE if classes members are merged with those of the base classes. */
514519
bool m_membersMerged = false;
515520

@@ -612,6 +617,8 @@ class ClassDefAliasImpl : public DefinitionAliasMixin<ClassDef>
612617
{ return getCdAlias()->compoundType(); }
613618
QCString compoundTypeString() const override
614619
{ return getCdAlias()->compoundTypeString(); }
620+
bool isTrivial() const override
621+
{ return getCdAlias()->isTrivial(); }
615622
const BaseClassList &baseClasses() const override
616623
{ return getCdAlias()->baseClasses(); }
617624
const BaseClassList &subClasses() const override
@@ -825,6 +832,7 @@ ClassDefImpl::ClassDefImpl(
825832
m_templateMaster =nullptr;
826833
m_isAbstract = FALSE;
827834
m_isStatic = FALSE;
835+
m_isTrivial = FALSE;
828836
m_isTemplArg = FALSE;
829837
m_membersMerged = FALSE;
830838
m_categoryOf = nullptr;
@@ -901,6 +909,7 @@ std::unique_ptr<ClassDef> ClassDefImpl::deepCopy(const QCString &name) const
901909
result->m_categoryOf = m_categoryOf;
902910
result->m_isAbstract = m_isAbstract;
903911
result->m_isStatic = m_isStatic;
912+
result->m_isTrivial = m_isTrivial;
904913
result->m_membersMerged = m_membersMerged;
905914
result->m_isLocal = m_isLocal;
906915
result->m_isTemplArg = m_isTemplArg;
@@ -3665,7 +3674,7 @@ bool ClassDefImpl::isVisibleInHierarchy() const
36653674

36663675
bool ClassDefImpl::hasDocumentation() const
36673676
{
3668-
return DefinitionMixin::hasDocumentation();
3677+
return m_isTrivial || DefinitionMixin::hasDocumentation();
36693678
}
36703679

36713680
//----------------------------------------------------------------------
@@ -5173,6 +5182,16 @@ void ClassDefImpl::setIsStatic(bool b)
51735182
m_isStatic=b;
51745183
}
51755184

5185+
void ClassDefImpl::setIsTrivial(bool b)
5186+
{
5187+
m_isTrivial=b;
5188+
}
5189+
5190+
bool ClassDefImpl::isTrivial() const
5191+
{
5192+
return m_isTrivial;
5193+
}
5194+
51765195
void ClassDefImpl::setCompoundType(CompoundType t)
51775196
{
51785197
m_compType = t;

src/classdef.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,9 @@ class ClassDef : public Definition
147147
/** Returns the type of compound as a string */
148148
virtual QCString compoundTypeString() const = 0;
149149

150+
/** Returns whether or not the class is trivial */
151+
virtual bool isTrivial() const = 0;
152+
150153
/** Returns the list of base classes from which this class directly
151154
* inherits.
152155
*/
@@ -385,6 +388,7 @@ class ClassDefMutable : public DefinitionMutable, public ClassDef
385388
virtual void setProtection(Protection p) = 0;
386389
virtual void setGroupDefForAllMembers(GroupDef *g,Grouping::GroupPri_t pri,const QCString &fileName,int startLine,bool hasDocs) = 0;
387390
virtual void setIsStatic(bool b) = 0;
391+
virtual void setIsTrivial(bool b) = 0;
388392
virtual void setCompoundType(CompoundType t) = 0;
389393
virtual void setClassName(const QCString &name) = 0;
390394
virtual void setClassSpecifier(TypeSpecifier spec) = 0;

src/commentscan.l

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,7 @@ static bool handleGroupgraph(yyscan_t yyscanner,const QCString &, const StringVe
147147
static bool handleHideGroupgraph(yyscan_t yyscanner,const QCString &, const StringVector &);
148148
static bool handleInternal(yyscan_t yyscanner,const QCString &, const StringVector &);
149149
static bool handleStatic(yyscan_t yyscanner,const QCString &, const StringVector &);
150+
static bool handleTrivial(yyscan_t yyscanner,const QCString &, const StringVector &);
150151
static bool handlePure(yyscan_t yyscanner,const QCString &, const StringVector &);
151152
static bool handlePrivate(yyscan_t yyscanner,const QCString &, const StringVector &);
152153
static bool handlePrivateSection(yyscan_t yyscanner,const QCString &, const StringVector &);
@@ -364,6 +365,7 @@ static const std::map< std::string, DocCmdMap > docCmdMap =
364365
{ "throws", { nullptr, CommandSpacing::Block, SectionHandling::Break }},
365366
{ "todo", { &handleTodo, CommandSpacing::XRef, SectionHandling::Break }},
366367
{ "tparam", { nullptr, CommandSpacing::Block, SectionHandling::Break }},
368+
{ "trivial", { &handleTrivial, CommandSpacing::Invisible, SectionHandling::Escape }},
367369
{ "typedef", { &handleFn, CommandSpacing::Invisible, SectionHandling::Escape }},
368370
{ "union", { &handleUnion, CommandSpacing::Invisible, SectionHandling::Escape }},
369371
{ "until", { nullptr, CommandSpacing::Block, SectionHandling::Escape }},
@@ -4020,6 +4022,13 @@ static bool handleStatic(yyscan_t yyscanner,const QCString &, const StringVector
40204022
return FALSE;
40214023
}
40224024

4025+
static bool handleTrivial(yyscan_t yyscanner,const QCString &, const StringVector &)
4026+
{
4027+
struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
4028+
yyextra->current->isTrivial = true;
4029+
return FALSE;
4030+
}
4031+
40234032
static bool handlePure(yyscan_t yyscanner,const QCString &, const StringVector &)
40244033
{
40254034
struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;

0 commit comments

Comments
 (0)