Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
D
doxverilog
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
Elphel
doxverilog
Commits
c5ec90d1
Commit
c5ec90d1
authored
Dec 17, 2013
by
Dimitri van Heesch
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Template and context enhancements
parent
e47f3d06
Changes
15
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
978 additions
and
309 deletions
+978
-309
classdef.cpp
src/classdef.cpp
+14
-206
context.cpp
src/context.cpp
+562
-35
context.h
src/context.h
+52
-0
doxygen.cpp
src/doxygen.cpp
+2
-1
filedef.cpp
src/filedef.cpp
+1
-1
groupdef.cpp
src/groupdef.cpp
+1
-1
memberdef.cpp
src/memberdef.cpp
+42
-21
memberdef.h
src/memberdef.h
+1
-0
memberlist.cpp
src/memberlist.cpp
+1
-1
memberlist.h
src/memberlist.h
+1
-1
namespacedef.cpp
src/namespacedef.cpp
+1
-1
template.cpp
src/template.cpp
+103
-34
template.h
src/template.h
+0
-7
util.cpp
src/util.cpp
+190
-0
util.h
src/util.h
+7
-0
No files found.
src/classdef.cpp
View file @
c5ec90d1
...
...
@@ -337,7 +337,14 @@ QCString ClassDef::displayName(bool includeScope) const
// n = n.left(n.length()-2);
//}
//printf("ClassDef::displayName()=%s\n",n.data());
if
(
n
.
find
(
'@'
)
!=-
1
)
{
return
removeAnonymousScopes
(
n
);
}
else
{
return
n
;
}
}
// inserts a base/super class in the inheritance list
...
...
@@ -1542,7 +1549,7 @@ void ClassDef::writeSummaryLinks(OutputList &ol)
MemberList
*
ml
=
getMemberList
(
lmd
->
type
);
if
(
ml
&&
ml
->
declVisible
())
{
ol
.
writeSummaryLink
(
0
,
ml
->
listTypeAsString
(
ml
->
listType
()),
lmd
->
title
(
lang
),
first
);
ol
.
writeSummaryLink
(
0
,
MemberList
::
listTypeAsString
(
ml
->
listType
()),
lmd
->
title
(
lang
),
first
);
first
=
FALSE
;
}
}
...
...
@@ -2526,23 +2533,14 @@ bool ClassDef::hasNonReferenceSuperClass()
void
ClassDef
::
writeDeclaration
(
OutputList
&
ol
,
MemberDef
*
md
,
bool
inGroup
,
ClassDef
*
inheritedFrom
,
const
char
*
inheritId
)
{
//ol.insertMemberAlign();
//printf("ClassName=`%s' inGroup=%d\n",name().data(),inGroup);
//if (inGroup && md && md->getClassDef()==this) return;
ol
.
docify
(
compoundTypeString
());
int
ri
=
name
().
findRev
(
"::"
);
if
(
ri
==-
1
)
ri
=
name
().
length
();
QCString
cn
=
name
().
right
(
name
().
length
()
-
ri
-
2
);
if
(
!
cn
.
isEmpty
()
&&
cn
.
at
(
0
)
!=
'@'
&&
md
)
{
if
(
cn
.
right
(
2
)
==
"-p"
/*|| cn.right(2)=="-g"*/
)
QCString
cn
=
displayName
(
FALSE
);
if
(
!
cn
.
isEmpty
())
{
cn
=
cn
.
left
(
cn
.
length
()
-
2
);
}
ol
.
docify
(
" "
);
if
(
isLinkable
())
if
(
md
&&
isLinkable
())
{
ol
.
writeObjectLink
(
0
,
0
,
md
->
anchor
(),
cn
);
}
...
...
@@ -3929,196 +3927,6 @@ void ClassDef::sortMemberLists()
}
}
/** Computes for a given list type \a inListType, which are the
* the corresponding list type(s) in the base class that are to be
* added to this list.
*
* So for public inheritance, the mapping is 1-1, so outListType1=inListType
* Private members are to be hidden completely.
*
* For protected inheritance, both protected and public members of the
* base class should be joined in the protected member section.
*
* For private inheritance, both protected and public members of the
* base class should be joined in the private member section.
*/
static
void
convertProtectionLevel
(
MemberListType
inListType
,
Protection
inProt
,
int
*
outListType1
,
int
*
outListType2
)
{
static
bool
extractPrivate
=
Config_getBool
(
"EXTRACT_PRIVATE"
);
// default representing 1-1 mapping
*
outListType1
=
inListType
;
*
outListType2
=-
1
;
if
(
inProt
==
Public
)
{
switch
(
inListType
)
// in the private section of the derived class,
// the private section of the base class should not
// be visible
{
case
MemberListType_priMethods
:
case
MemberListType_priStaticMethods
:
case
MemberListType_priSlots
:
case
MemberListType_priAttribs
:
case
MemberListType_priStaticAttribs
:
case
MemberListType_priTypes
:
*
outListType1
=-
1
;
*
outListType2
=-
1
;
break
;
default
:
break
;
}
}
else
if
(
inProt
==
Protected
)
// Protected inheritance
{
switch
(
inListType
)
// in the protected section of the derived class,
// both the public and protected members are shown
// as protected
{
case
MemberListType_pubMethods
:
case
MemberListType_pubStaticMethods
:
case
MemberListType_pubSlots
:
case
MemberListType_pubAttribs
:
case
MemberListType_pubStaticAttribs
:
case
MemberListType_pubTypes
:
case
MemberListType_priMethods
:
case
MemberListType_priStaticMethods
:
case
MemberListType_priSlots
:
case
MemberListType_priAttribs
:
case
MemberListType_priStaticAttribs
:
case
MemberListType_priTypes
:
*
outListType1
=-
1
;
*
outListType2
=-
1
;
break
;
case
MemberListType_proMethods
:
*
outListType2
=
MemberListType_pubMethods
;
break
;
case
MemberListType_proStaticMethods
:
*
outListType2
=
MemberListType_pubStaticMethods
;
break
;
case
MemberListType_proSlots
:
*
outListType2
=
MemberListType_pubSlots
;
break
;
case
MemberListType_proAttribs
:
*
outListType2
=
MemberListType_pubAttribs
;
break
;
case
MemberListType_proStaticAttribs
:
*
outListType2
=
MemberListType_pubStaticAttribs
;
break
;
case
MemberListType_proTypes
:
*
outListType2
=
MemberListType_pubTypes
;
break
;
default
:
break
;
}
}
else
if
(
inProt
==
Private
)
{
switch
(
inListType
)
// in the private section of the derived class,
// both the public and protected members are shown
// as private
{
case
MemberListType_pubMethods
:
case
MemberListType_pubStaticMethods
:
case
MemberListType_pubSlots
:
case
MemberListType_pubAttribs
:
case
MemberListType_pubStaticAttribs
:
case
MemberListType_pubTypes
:
case
MemberListType_proMethods
:
case
MemberListType_proStaticMethods
:
case
MemberListType_proSlots
:
case
MemberListType_proAttribs
:
case
MemberListType_proStaticAttribs
:
case
MemberListType_proTypes
:
*
outListType1
=-
1
;
*
outListType2
=-
1
;
break
;
case
MemberListType_priMethods
:
if
(
extractPrivate
)
{
*
outListType1
=
MemberListType_pubMethods
;
*
outListType2
=
MemberListType_proMethods
;
}
else
{
*
outListType1
=-
1
;
*
outListType2
=-
1
;
}
break
;
case
MemberListType_priStaticMethods
:
if
(
extractPrivate
)
{
*
outListType1
=
MemberListType_pubStaticMethods
;
*
outListType2
=
MemberListType_proStaticMethods
;
}
else
{
*
outListType1
=-
1
;
*
outListType2
=-
1
;
}
break
;
case
MemberListType_priSlots
:
if
(
extractPrivate
)
{
*
outListType1
=
MemberListType_pubSlots
;
*
outListType1
=
MemberListType_proSlots
;
}
else
{
*
outListType1
=-
1
;
*
outListType2
=-
1
;
}
break
;
case
MemberListType_priAttribs
:
if
(
extractPrivate
)
{
*
outListType1
=
MemberListType_pubAttribs
;
*
outListType2
=
MemberListType_proAttribs
;
}
else
{
*
outListType1
=-
1
;
*
outListType2
=-
1
;
}
break
;
case
MemberListType_priStaticAttribs
:
if
(
extractPrivate
)
{
*
outListType1
=
MemberListType_pubStaticAttribs
;
*
outListType2
=
MemberListType_proStaticAttribs
;
}
else
{
*
outListType1
=-
1
;
*
outListType2
=-
1
;
}
break
;
case
MemberListType_priTypes
:
if
(
extractPrivate
)
{
*
outListType1
=
MemberListType_pubTypes
;
*
outListType2
=
MemberListType_proTypes
;
}
else
{
*
outListType1
=-
1
;
*
outListType2
=-
1
;
}
break
;
default
:
break
;
}
}
//printf("convertProtectionLevel(type=%d prot=%d): %d,%d\n",
// inListType,inProt,*outListType1,*outListType2);
}
int
ClassDef
::
countMemberDeclarations
(
MemberListType
lt
,
ClassDef
*
inheritedFrom
,
int
lt2
,
bool
invert
,
bool
showAlways
,
QPtrDict
<
void
>
*
visitedClasses
)
{
...
...
@@ -4157,7 +3965,7 @@ int ClassDef::countInheritedDecMembers(MemberListType lt,
QPtrDict
<
void
>
*
visitedClasses
)
{
int
inhCount
=
0
;
int
count
=
countMembersIncludingGrouped
(
lt
,
inheritedFrom
,
FALSE
)
>
0
;
int
count
=
countMembersIncludingGrouped
(
lt
,
inheritedFrom
,
FALSE
);
bool
process
=
count
>
0
;
//printf("%s: countInheritedDecMembers: lt=%d process=%d count=%d invert=%d\n",
// name().data(),lt,process,count,invert);
...
...
@@ -4297,7 +4105,7 @@ void ClassDef::writeInheritedMemberDeclarations(OutputList &ol,
{
ol
.
pushGeneratorState
();
ol
.
disableAllBut
(
OutputGenerator
::
Html
);
int
count
=
countMembersIncludingGrouped
(
lt
,
inheritedFrom
,
FALSE
)
>
0
;
int
count
=
countMembersIncludingGrouped
(
lt
,
inheritedFrom
,
FALSE
);
bool
process
=
count
>
0
;
//printf("%s: writeInheritedMemberDec: lt=%d process=%d invert=%d always=%d\n",
// name().data(),lt,process,invert,showAlways);
...
...
src/context.cpp
View file @
c5ec90d1
This diff is collapsed.
Click to expand it.
src/context.h
View file @
c5ec90d1
...
...
@@ -614,6 +614,23 @@ class ExampleListContext : public TemplateStructIntf
Private
*
p
;
};
//----------------------------------------------------
class
NavPathElemContext
:
public
TemplateStructIntf
{
public
:
NavPathElemContext
(
Definition
*
def
);
~
NavPathElemContext
();
// TemplateStructIntf methods
virtual
TemplateVariant
get
(
const
char
*
name
)
const
;
private
:
class
Private
;
Private
*
p
;
};
//----------------------------------------------------
class
InheritanceNodeContext
:
public
TemplateStructIntf
...
...
@@ -741,6 +758,41 @@ class MemberInfoContext : public TemplateStructIntf
//----------------------------------------------------
class
InheritedMemberInfoContext
:
public
TemplateStructIntf
{
public
:
InheritedMemberInfoContext
(
ClassDef
*
cd
,
MemberList
*
ml
,
const
QCString
&
title
);
~
InheritedMemberInfoContext
();
// TemplateStructIntf methods
virtual
TemplateVariant
get
(
const
char
*
name
)
const
;
private
:
class
Private
;
Private
*
p
;
};
//----------------------------------------------------
class
InheritedMemberInfoListContext
:
public
TemplateListIntf
{
public
:
InheritedMemberInfoListContext
();
void
addMemberList
(
ClassDef
*
cd
,
MemberListType
lt
,
const
QCString
&
title
,
bool
additionalList
=
TRUE
);
~
InheritedMemberInfoListContext
();
// TemplateListIntf
virtual
int
count
()
const
;
virtual
TemplateVariant
at
(
int
index
)
const
;
virtual
TemplateListIntf
::
ConstIterator
*
createIterator
()
const
;
private
:
class
Private
;
Private
*
p
;
};
//----------------------------------------------------
class
AllMembersListContext
:
public
TemplateListIntf
{
public
:
...
...
src/doxygen.cpp
View file @
c5ec90d1
...
...
@@ -11427,6 +11427,8 @@ void generateOutput()
g_s
.
end
();
}
if
(
g_useOutputTemplate
)
generateOutputViaTemplate
();
if
(
generateRtf
)
{
g_s
.
begin
(
"Combining RTF output...
\n
"
);
...
...
@@ -11506,7 +11508,6 @@ void generateOutput()
msg
(
"finished...
\n
"
);
}
if
(
g_useOutputTemplate
)
generateOutputViaTemplate
();
/**************************************************************************
* Start cleaning up *
...
...
src/filedef.cpp
View file @
c5ec90d1
...
...
@@ -514,7 +514,7 @@ void FileDef::writeSummaryLinks(OutputList &ol)
MemberList
*
ml
=
getMemberList
(
lmd
->
type
);
if
(
ml
&&
ml
->
declVisible
())
{
ol
.
writeSummaryLink
(
0
,
ml
->
listTypeAsString
(
ml
->
listType
()),
lmd
->
title
(
lang
),
first
);
ol
.
writeSummaryLink
(
0
,
MemberList
::
listTypeAsString
(
ml
->
listType
()),
lmd
->
title
(
lang
),
first
);
first
=
FALSE
;
}
}
...
...
src/groupdef.cpp
View file @
c5ec90d1
...
...
@@ -913,7 +913,7 @@ void GroupDef::writeSummaryLinks(OutputList &ol)
MemberList
*
ml
=
getMemberList
(
lmd
->
type
);
if
(
ml
&&
ml
->
declVisible
())
{
ol
.
writeSummaryLink
(
0
,
ml
->
listTypeAsString
(
ml
->
listType
()),
lmd
->
title
(
lang
),
first
);
ol
.
writeSummaryLink
(
0
,
MemberList
::
listTypeAsString
(
ml
->
listType
()),
lmd
->
title
(
lang
),
first
);
first
=
FALSE
;
}
}
...
...
src/memberdef.cpp
View file @
c5ec90d1
...
...
@@ -1409,9 +1409,6 @@ void MemberDef::writeDeclaration(OutputList &ol,
// are explicitly grouped.
if
(
!
inGroup
&&
m_impl
->
mtype
==
MemberType_EnumValue
)
return
;
// hide members whose brief section should not be visible
//if (!isBriefSectionVisible()) return;
Definition
*
d
=
0
;
ASSERT
(
cd
!=
0
||
nd
!=
0
||
fd
!=
0
||
gd
!=
0
);
// member should belong to something
if
(
cd
)
d
=
cd
;
else
if
(
nd
)
d
=
nd
;
else
if
(
fd
)
d
=
fd
;
else
d
=
gd
;
...
...
@@ -1421,14 +1418,6 @@ void MemberDef::writeDeclaration(OutputList &ol,
QCString
cname
=
d
->
name
();
QCString
cdname
=
d
->
displayName
();
QCString
cfname
=
getOutputFileBase
();
//QCString osname = cname;
// in case of class members that are put in a group the name of the outerscope
// differs from the cname.
//if (getOuterScope()) osname=getOuterScope()->name();
//HtmlHelp *htmlHelp=0;
//bool hasHtmlHelp = Config_getBool("GENERATE_HTML") && Config_getBool("GENERATE_HTMLHELP");
//if (hasHtmlHelp) htmlHelp = HtmlHelp::getInstance();
// search for the last anonymous scope in the member type
ClassDef
*
annoClassDef
=
getClassDefOfAnonymousType
();
...
...
@@ -1445,15 +1434,27 @@ void MemberDef::writeDeclaration(OutputList &ol,
// If there is no detailed description we need to write the anchor here.
bool
detailsVisible
=
isDetailedSectionLinkable
();
if
(
!
detailsVisible
&&
!
m_impl
->
annMemb
)
if
(
!
detailsVisible
)
{
QCString
doxyName
=
name
().
copy
();
QCString
doxyArgs
=
argsString
();
if
(
m_impl
->
annMemb
)
{
QCString
doxyName
=
m_impl
->
annMemb
->
name
();
if
(
!
cname
.
isEmpty
())
{
doxyName
.
prepend
(
cdname
+
getLanguageSpecificSeparator
(
getLanguage
()));
}
ol
.
startDoxyAnchor
(
cfname
,
cname
,
m_impl
->
annMemb
->
anchor
(),
doxyName
,
doxyArgs
);
}
else
{
QCString
doxyName
=
name
();
if
(
!
cname
.
isEmpty
())
{
doxyName
.
prepend
(
cdname
+
getLanguageSpecificSeparator
(
getLanguage
()));
}
QCString
doxyArgs
=
argsString
();
ol
.
startDoxyAnchor
(
cfname
,
cname
,
anchor
(),
doxyName
,
doxyArgs
);
}
ol
.
pushGeneratorState
();
ol
.
disable
(
OutputGenerator
::
Man
);
...
...
@@ -2388,6 +2389,21 @@ QCString MemberDef::displayDefinition() const
ldef
=
ldef
.
mid
(
2
);
}
}
static
QRegExp
r
(
"@[0-9]+"
);
int
l
,
i
=
r
.
match
(
ldef
,
0
,
&
l
);
if
(
i
!=-
1
)
// replace anonymous parts with { ... }
{
int
si
=
ldef
.
find
(
' '
),
pi
,
ei
=
i
+
l
;
if
(
si
==-
1
)
si
=
0
;
while
((
pi
=
r
.
match
(
ldef
,
i
+
l
,
&
l
))
!=-
1
)
{
i
=
pi
;
ei
=
i
+
l
;
}
int
ni
=
ldef
.
find
(
"::"
,
si
);
if
(
ni
>=
ei
)
ei
=
ni
+
2
;
ldef
=
ldef
.
left
(
si
)
+
" { ... } "
+
ldef
.
right
(
ldef
.
length
()
-
ei
);
}
ClassDef
*
cd
=
getClassDef
();
if
(
cd
&&
cd
->
isObjectiveC
())
{
...
...
@@ -2407,9 +2423,9 @@ QCString MemberDef::displayDefinition() const
{
ldef
=
ldef
.
left
(
dp
+
1
);
}
int
l
=
ldef
.
length
();
l
=
ldef
.
length
();
//printf("start >%s<\n",ldef.data());
i
nt
i
=
l
-
1
;
i
=
l
-
1
;
while
(
i
>=
0
&&
(
isId
(
ldef
.
at
(
i
))
||
ldef
.
at
(
i
)
==
':'
))
i
--
;
while
(
i
>=
0
&&
isspace
((
uchar
)
ldef
.
at
(
i
)))
i
--
;
if
(
i
>
0
)
...
...
@@ -2483,8 +2499,8 @@ void MemberDef::writeDocumentation(MemberList *ml,OutputList &ol,
bool
inFile
=
container
->
definitionType
()
==
Definition
::
TypeFile
;
bool
hasDocs
=
isDetailedSectionVisible
(
inGroup
,
inFile
);
//printf("MemberDef::writeDocumentation(): name=`%s' hasDocs=`%d' containerType=%d inGroup=%d\n",
// name().data(),hasDocs,container->definitionType(),inGroup);
//printf("MemberDef::writeDocumentation(): name=`%s' hasDocs=`%d' containerType=%d inGroup=%d
sectionLinkable=%d
\n",
// name().data(),hasDocs,container->definitionType(),inGroup
,isDetailedSectionLinkable()
);
if
(
!
hasDocs
)
return
;
if
(
isEnumValue
()
&&
!
showEnumValues
)
return
;
...
...
@@ -4656,6 +4672,11 @@ void MemberDef::setFromAnonymousMember(MemberDef *m)
m_impl
->
annMemb
=
m
;
}
MemberDef
*
MemberDef
::
fromAnonymousMember
()
const
{
return
m_impl
->
annMemb
;
}
void
MemberDef
::
setTemplateMaster
(
MemberDef
*
mt
)
{
m_impl
->
templateMaster
=
mt
;
...
...
src/memberdef.h
View file @
c5ec90d1
...
...
@@ -217,6 +217,7 @@ class MemberDef : public Definition
bool
fromAnonymousScope
()
const
;
bool
anonymousDeclShown
()
const
;
MemberDef
*
fromAnonymousMember
()
const
;
// callgraph related members
bool
hasCallGraph
()
const
;
...
...
src/memberlist.cpp
View file @
c5ec90d1
...
...
@@ -878,7 +878,7 @@ void MemberList::setNeedsSorting(bool b)
m_needsSorting
=
b
;
}
QCString
MemberList
::
listTypeAsString
(
MemberListType
type
)
const
QCString
MemberList
::
listTypeAsString
(
MemberListType
type
)
{
switch
(
type
)
{
...
...
src/memberlist.h
View file @
c5ec90d1
...
...
@@ -36,7 +36,7 @@ class MemberList : public QList<MemberDef>
MemberList
(
MemberListType
lt
);
~
MemberList
();
MemberListType
listType
()
const
{
return
m_listType
;
}
QCString
listTypeAsString
(
MemberListType
type
)
const
;
static
QCString
listTypeAsString
(
MemberListType
type
)
;
bool
insert
(
uint
index
,
const
MemberDef
*
md
);
void
inSort
(
const
MemberDef
*
md
);
void
append
(
const
MemberDef
*
md
);
...
...
src/namespacedef.cpp
View file @
c5ec90d1
...
...
@@ -430,7 +430,7 @@ void NamespaceDef::writeSummaryLinks(OutputList &ol)
MemberList
*
ml
=
getMemberList
(
lmd
->
type
);
if
(
ml
&&
ml
->
declVisible
())
{
ol
.
writeSummaryLink
(
0
,
ml
->
listTypeAsString
(
ml
->
listType
()),
lmd
->
title
(
lang
),
first
);
ol
.
writeSummaryLink
(
0
,
MemberList
::
listTypeAsString
(
ml
->
listType
()),
lmd
->
title
(
lang
),
first
);
first
=
FALSE
;
}
}
...
...
src/template.cpp
View file @
c5ec90d1
...
...
@@ -1558,6 +1558,7 @@ class TemplateImpl : public TemplateNode, public Template
{
public
:
TemplateImpl
(
TemplateEngine
*
e
,
const
QCString
&
name
,
const
QCString
&
data
);
~
TemplateImpl
()
{}
void
render
(
FTextStream
&
ts
,
TemplateContext
*
c
);
TemplateEngine
*
engine
()
const
{
return
m_engine
;
}
...
...
@@ -1867,6 +1868,58 @@ class TemplateNodeIf : public TemplateNodeCreator<TemplateNodeIf>
TemplateNodeList
m_falseNodes
;
};
//----------------------------------------------------------
/** @brief Class representing a 'for' tag in a template */
class
TemplateNodeRepeat
:
public
TemplateNodeCreator
<
TemplateNodeRepeat
>
{
public
:
TemplateNodeRepeat
(
TemplateParser
*
parser
,
TemplateNode
*
parent
,
int
line
,
const
QCString
&
data
)
:
TemplateNodeCreator
<
TemplateNodeRepeat
>
(
parser
,
parent
,
line
)
{
TRACE
((
"{TemplateNodeRepeat(%s)
\n
"
,
data
.
data
()));
ExpressionParser
expParser
(
parser
->
templateName
(),
line
);
m_expr
=
expParser
.
parseVariable
(
data
);
QStrList
stopAt
;
stopAt
.
append
(
"endrepeat"
);
parser
->
parse
(
this
,
line
,
stopAt
,
m_repeatNodes
);
parser
->
removeNextToken
();
// skip over endrepeat
TRACE
((
"}TemplateNodeRepeat(%s)
\n
"
,
data
.
data
()));
}
~
TemplateNodeRepeat
()
{
delete
m_expr
;
}
void
render
(
FTextStream
&
ts
,
TemplateContext
*
c
)
{
dynamic_cast
<
TemplateContextImpl
*>
(
c
)
->
setLocation
(
m_templateName
,
m_line
);
TemplateVariant
v
;
if
(
m_expr
&&
(
v
=
m_expr
->
resolve
(
c
)).
type
()
==
TemplateVariant
::
Integer
)
{
int
i
,
n
=
v
.
toInt
();
for
(
i
=
0
;
i
<
n
;
i
++
)
{
TemplateStruct
s
;
s
.
set
(
"counter0"
,
(
int
)
i
);
s
.
set
(
"counter"
,
(
int
)(
i
+
1
));
s
.
set
(
"revcounter"
,
(
int
)(
n
-
i
));
s
.
set
(
"revcounter0"
,
(
int
)(
n
-
i
-
1
));
s
.
set
(
"first"
,
i
==
0
);
s
.
set
(
"last"
,
i
==
n
-
1
);
c
->
set
(
"repeatloop"
,
&
s
);
// render all items for this iteration of the loop
m_repeatNodes
.
render
(
ts
,
c
);
}
}
else
// simple type...
{
warn
(
m_templateName
,
m_line
,
"for requires a variable of list type!"
);
}
}
private
:
TemplateNodeList
m_repeatNodes
;
ExprAst
*
m_expr
;
};
//----------------------------------------------------------
/** @brief Class representing a 'for' tag in a template */
...
...
@@ -2165,7 +2218,8 @@ class TemplateNodeExtend : public TemplateNodeCreator<TemplateNodeExtend>
TemplateImpl
*
t
=
getTemplate
();
if
(
t
)
{
TemplateImpl
*
baseTemplate
=
dynamic_cast
<
TemplateImpl
*>
(
t
->
engine
()
->
loadByName
(
extendFile
));
Template
*
bt
=
t
->
engine
()
->
loadByName
(
extendFile
);
TemplateImpl
*
baseTemplate
=
bt
?
dynamic_cast
<
TemplateImpl
*>
(
bt
)
:
0
;
if
(
baseTemplate
)
{
// fill block context
...
...
@@ -2194,7 +2248,7 @@ class TemplateNodeExtend : public TemplateNodeCreator<TemplateNodeExtend>
// clean up
bc
->
clear
();
delete
baseTemplate
;
//
delete baseTemplate;
}
else
{
...
...
@@ -2242,7 +2296,8 @@ class TemplateNodeInclude : public TemplateNodeCreator<TemplateNodeInclude>
TemplateImpl
*
t
=
getTemplate
();
if
(
t
)
{
TemplateImpl
*
incTemplate
=
dynamic_cast
<
TemplateImpl
*>
(
t
->
engine
()
->
loadByName
(
includeFile
));
Template
*
it
=
t
->
engine
()
->
loadByName
(
includeFile
);
TemplateImpl
*
incTemplate
=
it
?
dynamic_cast
<
TemplateImpl
*>
(
it
)
:
0
;
if
(
incTemplate
)
{
incTemplate
->
render
(
ts
,
c
);
...
...
@@ -2324,7 +2379,8 @@ class TemplateNodeCreate : public TemplateNodeCreator<TemplateNodeCreate>
TemplateImpl
*
t
=
getTemplate
();
if
(
t
)
{
TemplateImpl
*
createTemplate
=
dynamic_cast
<
TemplateImpl
*>
(
t
->
engine
()
->
loadByName
(
templateFile
));
Template
*
ct
=
t
->
engine
()
->
loadByName
(
templateFile
);
TemplateImpl
*
createTemplate
=
ct
?
dynamic_cast
<
TemplateImpl
*>
(
ct
)
:
0
;
if
(
createTemplate
)
{
if
(
!
ci
->
outputDirectory
().
isEmpty
())
...
...
@@ -2336,7 +2392,7 @@ class TemplateNodeCreate : public TemplateNodeCreator<TemplateNodeCreate>
{
FTextStream
ts
(
&
f
);
createTemplate
->
render
(
ts
,
c
);
delete
createTemplate
;
//
delete createTemplate;
}
else
{
...
...
@@ -2729,6 +2785,9 @@ class TemplateNodeMarkers : public TemplateNodeCreator<TemplateNodeMarkers>
for
(
it
->
toFirst
();
(
it
->
current
(
var
))
&&
i
<
entryIndex
;
it
->
toNext
(),
i
++
)
{}
if
(
ok
&&
i
==
entryIndex
)
// found element
{
TemplateStruct
s
;
s
.
set
(
"id"
,(
int
)
i
);
c
->
set
(
"markers"
,
&
s
);
c
->
set
(
m_var
,
var
);
// define local variable to hold element of list type
bool
wasSpaceless
=
ci
->
spacelessEnabled
();
ci
->
enableSpaceless
(
TRUE
);
...
...
@@ -2824,6 +2883,7 @@ static TemplateNodeFactory::AutoRegister<TemplateNodeBlock> autoRefBlock("bl
static
TemplateNodeFactory
::
AutoRegister
<
TemplateNodeCycle
>
autoRefCycle
(
"cycle"
);
static
TemplateNodeFactory
::
AutoRegister
<
TemplateNodeExtend
>
autoRefExtend
(
"extend"
);
static
TemplateNodeFactory
::
AutoRegister
<
TemplateNodeCreate
>
autoRefCreate
(
"create"
);
static
TemplateNodeFactory
::
AutoRegister
<
TemplateNodeRepeat
>
autoRefRepeat
(
"repeat"
);
static
TemplateNodeFactory
::
AutoRegister
<
TemplateNodeInclude
>
autoRefInclude
(
"include"
);
static
TemplateNodeFactory
::
AutoRegister
<
TemplateNodeMarkers
>
autoRefMarkers
(
"markers"
);
static
TemplateNodeFactory
::
AutoRegister
<
TemplateNodeSpaceless
>
autoRefSpaceless
(
"spaceless"
);
...
...
@@ -3186,7 +3246,8 @@ void TemplateParser::parse(
command
==
"endif"
||
command
==
"endfor"
||
command
==
"endblock"
||
command
==
"endwith"
||
command
==
"endrecursetree"
||
command
==
"endspaceless"
||
command
==
"endmarkers"
||
command
==
"endmsg"
)
command
==
"endmarkers"
||
command
==
"endmsg"
||
command
==
"endrepeat"
)
{
warn
(
m_templateName
,
tok
->
line
,
"Found tag '%s' without matching start tag"
,
command
.
data
());
}
...
...
@@ -3288,13 +3349,45 @@ void TemplateImpl::render(FTextStream &ts, TemplateContext *c)
class
TemplateEngine
::
Private
{
public
:
Private
()
{
templates
.
setAutoDelete
(
TRUE
);
}
QList
<
Template
>
templates
;
Private
(
TemplateEngine
*
engine
)
:
m_templateCache
(
17
),
m_engine
(
engine
)
{
m_templateCache
.
setAutoDelete
(
TRUE
);
}
Template
*
loadByName
(
const
QCString
&
fileName
)
const
{
Template
*
templ
=
m_templateCache
.
find
(
fileName
);
if
(
templ
==
0
)
{
QFile
f
(
fileName
);
if
(
f
.
open
(
IO_ReadOnly
))
{
uint
size
=
f
.
size
();
char
*
data
=
new
char
[
size
+
1
];
if
(
data
)
{
data
[
size
]
=
0
;
if
(
f
.
readBlock
(
data
,
f
.
size
()))
{
templ
=
new
TemplateImpl
(
m_engine
,
fileName
,
data
);
m_templateCache
.
insert
(
fileName
,
templ
);
}
delete
[]
data
;
}
}
else
{
err
(
"Cound not open template file %s
\n
"
,
fileName
.
data
());
}
}
return
templ
;
}
private
:
mutable
QDict
<
Template
>
m_templateCache
;
TemplateEngine
*
m_engine
;
};
TemplateEngine
::
TemplateEngine
()
{
p
=
new
Private
;
p
=
new
Private
(
this
)
;
}
TemplateEngine
::~
TemplateEngine
()
...
...
@@ -3307,32 +3400,8 @@ TemplateContext *TemplateEngine::createContext() const
return
new
TemplateContextImpl
;
}
Template
*
TemplateEngine
::
newTemplate
(
const
QCString
&
name
,
const
QCString
&
data
)
{
Template
*
t
=
new
TemplateImpl
(
this
,
name
,
data
);
p
->
templates
.
append
(
t
);
return
t
;
}
Template
*
TemplateEngine
::
loadByName
(
const
QCString
&
fileName
)
{
Template
*
t
=
0
;
QFile
f
(
fileName
);
if
(
f
.
open
(
IO_ReadOnly
))
{
uint
size
=
f
.
size
();
char
*
data
=
new
char
[
size
+
1
];
if
(
data
)
{
data
[
size
]
=
0
;
if
(
f
.
readBlock
(
data
,
f
.
size
()))
{
t
=
new
TemplateImpl
(
this
,
fileName
,
data
);
}
delete
[]
data
;
}
}
return
t
;
return
p
->
loadByName
(
fileName
);
}
src/template.h
View file @
c5ec90d1
...
...
@@ -443,13 +443,6 @@ class TemplateEngine
*/
TemplateContext
*
createContext
()
const
;
/** Creates a new template whose contents are given by a string.
* @param[in] name The name of the template.
* @param[in] data The contents of the template.
* @return the new template, the caller will be the owner.
*/
Template
*
newTemplate
(
const
QCString
&
name
,
const
QCString
&
data
);
/** Creates a new template whole contents are in a file.
* @param[in] fileName The name of the file containing the
* template data
...
...
src/util.cpp
View file @
c5ec90d1
...
...
@@ -8080,3 +8080,193 @@ QCString extractDirection(QCString &docs)
return
QCString
();
}
//-----------------------------------------------------------
/** Computes for a given list type \a inListType, which are the
* the corresponding list type(s) in the base class that are to be
* added to this list.
*
* So for public inheritance, the mapping is 1-1, so outListType1=inListType
* Private members are to be hidden completely.
*
* For protected inheritance, both protected and public members of the
* base class should be joined in the protected member section.
*
* For private inheritance, both protected and public members of the
* base class should be joined in the private member section.
*/
void
convertProtectionLevel
(
MemberListType
inListType
,
Protection
inProt
,
int
*
outListType1
,
int
*
outListType2
)
{
static
bool
extractPrivate
=
Config_getBool
(
"EXTRACT_PRIVATE"
);
// default representing 1-1 mapping
*
outListType1
=
inListType
;
*
outListType2
=-
1
;
if
(
inProt
==
Public
)
{
switch
(
inListType
)
// in the private section of the derived class,
// the private section of the base class should not
// be visible
{
case
MemberListType_priMethods
:
case
MemberListType_priStaticMethods
:
case
MemberListType_priSlots
:
case
MemberListType_priAttribs
:
case
MemberListType_priStaticAttribs
:
case
MemberListType_priTypes
:
*
outListType1
=-
1
;
*
outListType2
=-
1
;
break
;
default:
break
;
}
}
else
if
(
inProt
==
Protected
)
// Protected inheritance
{
switch
(
inListType
)
// in the protected section of the derived class,
// both the public and protected members are shown
// as protected
{
case
MemberListType_pubMethods
:
case
MemberListType_pubStaticMethods
:
case
MemberListType_pubSlots
:
case
MemberListType_pubAttribs
:
case
MemberListType_pubStaticAttribs
:
case
MemberListType_pubTypes
:
case
MemberListType_priMethods
:
case
MemberListType_priStaticMethods
:
case
MemberListType_priSlots
:
case
MemberListType_priAttribs
:
case
MemberListType_priStaticAttribs
:
case
MemberListType_priTypes
:
*
outListType1
=-
1
;
*
outListType2
=-
1
;
break
;
case
MemberListType_proMethods
:
*
outListType2
=
MemberListType_pubMethods
;
break
;
case
MemberListType_proStaticMethods
:
*
outListType2
=
MemberListType_pubStaticMethods
;
break
;
case
MemberListType_proSlots
:
*
outListType2
=
MemberListType_pubSlots
;
break
;
case
MemberListType_proAttribs
:
*
outListType2
=
MemberListType_pubAttribs
;
break
;
case
MemberListType_proStaticAttribs
:
*
outListType2
=
MemberListType_pubStaticAttribs
;
break
;
case
MemberListType_proTypes
:
*
outListType2
=
MemberListType_pubTypes
;
break
;
default:
break
;
}
}
else
if
(
inProt
==
Private
)
{
switch
(
inListType
)
// in the private section of the derived class,
// both the public and protected members are shown
// as private
{
case
MemberListType_pubMethods
:
case
MemberListType_pubStaticMethods
:
case
MemberListType_pubSlots
:
case
MemberListType_pubAttribs
:
case
MemberListType_pubStaticAttribs
:
case
MemberListType_pubTypes
:
case
MemberListType_proMethods
:
case
MemberListType_proStaticMethods
:
case
MemberListType_proSlots
:
case
MemberListType_proAttribs
:
case
MemberListType_proStaticAttribs
:
case
MemberListType_proTypes
:
*
outListType1
=-
1
;
*
outListType2
=-
1
;
break
;
case
MemberListType_priMethods
:
if
(
extractPrivate
)
{
*
outListType1
=
MemberListType_pubMethods
;
*
outListType2
=
MemberListType_proMethods
;
}
else
{
*
outListType1
=-
1
;
*
outListType2
=-
1
;
}
break
;
case
MemberListType_priStaticMethods
:
if
(
extractPrivate
)
{
*
outListType1
=
MemberListType_pubStaticMethods
;
*
outListType2
=
MemberListType_proStaticMethods
;
}
else
{
*
outListType1
=-
1
;
*
outListType2
=-
1
;
}
break
;
case
MemberListType_priSlots
:
if
(
extractPrivate
)
{
*
outListType1
=
MemberListType_pubSlots
;
*
outListType1
=
MemberListType_proSlots
;
}
else
{
*
outListType1
=-
1
;
*
outListType2
=-
1
;
}
break
;
case
MemberListType_priAttribs
:
if
(
extractPrivate
)
{
*
outListType1
=
MemberListType_pubAttribs
;
*
outListType2
=
MemberListType_proAttribs
;
}
else
{
*
outListType1
=-
1
;
*
outListType2
=-
1
;
}
break
;
case
MemberListType_priStaticAttribs
:
if
(
extractPrivate
)
{
*
outListType1
=
MemberListType_pubStaticAttribs
;
*
outListType2
=
MemberListType_proStaticAttribs
;
}
else
{
*
outListType1
=-
1
;
*
outListType2
=-
1
;
}
break
;
case
MemberListType_priTypes
:
if
(
extractPrivate
)
{
*
outListType1
=
MemberListType_pubTypes
;
*
outListType2
=
MemberListType_proTypes
;
}
else
{
*
outListType1
=-
1
;
*
outListType2
=-
1
;
}
break
;
default:
break
;
}
}
//printf("convertProtectionLevel(type=%d prot=%d): %d,%d\n",
// inListType,inProt,*outListType1,*outListType2);
}
src/util.h
View file @
c5ec90d1
...
...
@@ -448,5 +448,12 @@ uint getUtf8CodeToUpper( const QCString& s, int idx );
QCString
extractDirection
(
QCString
&
docs
);
void
convertProtectionLevel
(
MemberListType
inListType
,
Protection
inProt
,
int
*
outListType1
,
int
*
outListType2
);
#endif
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment