Classes | Public Member Functions | Private Member Functions | Private Attributes | List of all members
DefinitionContext< T > Class Template Reference

Classes

struct  Cachable
 

Public Member Functions

 DefinitionContext (Definition *d)
 
void addBaseProperties (PropertyMapper< T > &inst)
 
TemplateVariant fileName () const
 
TemplateVariant anchor () const
 
TemplateVariant sourceFileName () const
 
TemplateVariant isLinkable () const
 
TemplateVariant isLinkableInProject () const
 
TemplateVariant name () const
 
TemplateVariant bareName () const
 
QCString relPathAsString () const
 
virtual TemplateVariant relPath () const
 
TemplateVariant details () const
 
TemplateVariant brief () const
 
TemplateVariant inbodyDocs () const
 
TemplateVariant dynSectionId () const
 
TemplateVariant language () const
 
TemplateVariant compoundKind () const
 
TemplateVariant sourceDef () const
 
void fillPath (Definition *def, TemplateList *list) const
 
TemplateVariant navigationPath () const
 
TemplateVariant isReference () const
 
TemplateVariant externalReference () const
 

Private Member Functions

CachablegetCache () const
 

Private Attributes

Definitionm_def
 

Detailed Description

template<typename T>
class DefinitionContext< T >

Definition at line 1357 of file context.cpp.

Constructor & Destructor Documentation

template<typename T>
DefinitionContext< T >::DefinitionContext ( Definition d)
inline

Definition at line 1360 of file context.cpp.

1360  : m_def(d)
1361  {
1362  assert(d!=0);
1363  }
Definition * m_def
Definition: context.cpp:1646

Member Function Documentation

template<typename T>
void DefinitionContext< T >::addBaseProperties ( PropertyMapper< T > &  inst)
inline

Definition at line 1364 of file context.cpp.

1365  {
1366  //%% string name: the name of the symbol
1367  inst.addProperty("name",&DefinitionContext::name);
1368  //%% string bareName: the bare name of the symbol with scope info
1369  inst.addProperty("bareName",&DefinitionContext::bareName);
1370  //%% string relPath: the relative path to the root of the output (CREATE_SUBDIRS)
1371  inst.addProperty("relPath",&DefinitionContext::relPath);
1372  //%% string fileName: the file name of the output file associated with the symbol (without extension)
1373  inst.addProperty("fileName",&DefinitionContext::fileName);
1374  //%% string anchor: anchor within the page
1375  inst.addProperty("anchor",&DefinitionContext::anchor);
1376  //%% string details: the detailed documentation for this symbol
1377  inst.addProperty("details",&DefinitionContext::details);
1378  //%% string brief: the brief description for this symbol
1379  inst.addProperty("brief",&DefinitionContext::brief);
1380  //%% string inbodyDocs: the documentation found in the body
1381  inst.addProperty("inbodyDocs",&DefinitionContext::inbodyDocs);
1382  //%% string sourceFileName: the file name of the source file (without extension)
1383  inst.addProperty("sourceFileName",&DefinitionContext::sourceFileName);
1384  //%% bool isLinkable: can the symbol be linked to?
1385  inst.addProperty("isLinkable",&DefinitionContext::isLinkable);
1386  //%% bool isLinkableInProject: can the symbol be linked within this project?
1387  inst.addProperty("isLinkableInProject",&DefinitionContext::isLinkableInProject);
1388  //%% int dynSectionId: identifier that can be used for collapsable sections
1389  inst.addProperty("dynSectionId",&DefinitionContext::dynSectionId);
1390  //%% string language: the programming language in which the symbol is written
1391  inst.addProperty("language",&DefinitionContext::language);
1392  //%% string sourceDef: A link to the source definition
1393  inst.addProperty("sourceDef",&DefinitionContext::sourceDef);
1394  //%% list[Definition] navigationPath: Breadcrumb navigation path to this item
1395  inst.addProperty("navigationPath",&DefinitionContext::navigationPath);
1396  //%% string kind: Kind of compound object: class, namespace, module, package, page, dir
1397  inst.addProperty("compoundKind",&DefinitionContext::compoundKind);
1398  //%% bool isReference: is this definition imported via a tag file
1399  inst.addProperty("isReference",&DefinitionContext::isReference);
1400  //%% string externalReference: the link to the element in the remote documentation
1401  inst.addProperty("externalReference",&DefinitionContext::externalReference);
1402  }
TemplateVariant language() const
Definition: context.cpp:1491
TemplateVariant fileName() const
Definition: context.cpp:1403
TemplateVariant isReference() const
Definition: context.cpp:1577
TemplateVariant dynSectionId() const
Definition: context.cpp:1487
TemplateVariant bareName() const
Definition: context.cpp:1427
TemplateVariant sourceFileName() const
Definition: context.cpp:1411
TemplateVariant anchor() const
Definition: context.cpp:1407
TemplateVariant isLinkableInProject() const
Definition: context.cpp:1419
TemplateVariant compoundKind() const
Definition: context.cpp:1515
TemplateVariant isLinkable() const
Definition: context.cpp:1415
virtual TemplateVariant relPath() const
Definition: context.cpp:1436
void addProperty(const char *name, typename PropertyFunc::Handler handle)
Definition: context.cpp:252
TemplateVariant details() const
Definition: context.cpp:1440
TemplateVariant inbodyDocs() const
Definition: context.cpp:1469
TemplateVariant sourceDef() const
Definition: context.cpp:1533
TemplateVariant navigationPath() const
Definition: context.cpp:1559
TemplateVariant brief() const
Definition: context.cpp:1451
TemplateVariant externalReference() const
Definition: context.cpp:1581
TemplateVariant name() const
Definition: context.cpp:1423
template<typename T>
TemplateVariant DefinitionContext< T >::anchor ( ) const
inline

Definition at line 1407 of file context.cpp.

1408  {
1409  return m_def->anchor();
1410  }
Definition * m_def
Definition: context.cpp:1646
virtual QCString anchor() const =0
template<typename T>
TemplateVariant DefinitionContext< T >::bareName ( ) const
inline

Definition at line 1427 of file context.cpp.

1428  {
1429  return m_def->displayName(FALSE);
1430  }
Definition * m_def
Definition: context.cpp:1646
const bool FALSE
Definition: qglobal.h:370
virtual QCString displayName(bool includeScope=TRUE) const =0
template<typename T>
TemplateVariant DefinitionContext< T >::brief ( ) const
inline

Definition at line 1451 of file context.cpp.

1452  {
1453  Cachable &cache = getCache();
1454  if (!cache.brief || g_globals.outputFormat!=cache.briefOutputFormat)
1455  {
1456  if (m_def->hasBriefDescription())
1457  {
1458  cache.brief.reset(new TemplateVariant(parseDoc(m_def,m_def->briefFile(),m_def->briefLine(),
1460  cache.briefOutputFormat = g_globals.outputFormat;
1461  }
1462  else
1463  {
1464  cache.brief.reset(new TemplateVariant(""));
1465  }
1466  }
1467  return *cache.brief;
1468  }
Definition * m_def
Definition: context.cpp:1646
int briefLine() const
static TemplateVariant parseDoc(Definition *def, const QCString &file, int line, const QCString &relPath, const QCString &docStr, bool isBrief)
Definition: context.cpp:1227
bool hasBriefDescription() const
QCString relPathAsString() const
Definition: context.cpp:1431
QCString briefFile() const
virtual QCString briefDescription(bool abbreviate=FALSE) const
Variant type which can hold one value of a fixed set of types.
Definition: template.h:90
ContextOutputFormat outputFormat
Definition: context.cpp:71
struct ContextGlobals g_globals
Cachable & getCache() const
Definition: context.cpp:1640
const bool TRUE
Definition: qglobal.h:371
template<typename T>
TemplateVariant DefinitionContext< T >::compoundKind ( ) const
inline

Definition at line 1515 of file context.cpp.

1516  {
1517  QCString result = "unspecified";
1518  switch (m_def->definitionType())
1519  {
1520  case DefinitionIntf::TypeClass: result="class"; break;
1521  case DefinitionIntf::TypeFile: result="file"; break;
1522  case DefinitionIntf::TypeNamespace: result="namespace"; break;
1523  case DefinitionIntf::TypeGroup: result="module"; break;
1524  case DefinitionIntf::TypePackage: result="package"; break;
1525  case DefinitionIntf::TypePage: result="page"; break;
1526  case DefinitionIntf::TypeDir: result="dir"; break;
1527  case DefinitionIntf::TypeMember: // fall through
1529  break;
1530  }
1531  return result;
1532  }
static QCString result
Definition * m_def
Definition: context.cpp:1646
virtual DefType definitionType() const =0
template<typename T>
TemplateVariant DefinitionContext< T >::details ( ) const
inline

Definition at line 1440 of file context.cpp.

1441  {
1442  Cachable &cache = getCache();
1443  if (!cache.details || g_globals.outputFormat!=cache.detailsOutputFormat)
1444  {
1445  cache.details.reset(new TemplateVariant(parseDoc(m_def,m_def->docFile(),m_def->docLine(),
1447  cache.detailsOutputFormat = g_globals.outputFormat;
1448  }
1449  return *cache.details;
1450  }
QCString docFile() const
Definition * m_def
Definition: context.cpp:1646
const bool FALSE
Definition: qglobal.h:370
static TemplateVariant parseDoc(Definition *def, const QCString &file, int line, const QCString &relPath, const QCString &docStr, bool isBrief)
Definition: context.cpp:1227
QCString relPathAsString() const
Definition: context.cpp:1431
Variant type which can hold one value of a fixed set of types.
Definition: template.h:90
ContextOutputFormat outputFormat
Definition: context.cpp:71
struct ContextGlobals g_globals
int docLine() const
virtual QCString documentation() const
Cachable & getCache() const
Definition: context.cpp:1640
template<typename T>
TemplateVariant DefinitionContext< T >::dynSectionId ( ) const
inline

Definition at line 1487 of file context.cpp.

1488  {
1489  return g_globals.dynSectionId;
1490  }
int dynSectionId
Definition: context.cpp:69
struct ContextGlobals g_globals
template<typename T>
TemplateVariant DefinitionContext< T >::externalReference ( ) const
inline

Definition at line 1581 of file context.cpp.

1582  {
1584  }
Definition * m_def
Definition: context.cpp:1646
QCString relPathAsString() const
Definition: context.cpp:1431
QCString externalReference(const QCString &relPath) const
template<typename T>
TemplateVariant DefinitionContext< T >::fileName ( ) const
inline

Definition at line 1403 of file context.cpp.

1404  {
1405  return m_def->getOutputFileBase();
1406  }
Definition * m_def
Definition: context.cpp:1646
virtual QCString getOutputFileBase() const =0
template<typename T>
void DefinitionContext< T >::fillPath ( Definition def,
TemplateList list 
) const
inline

Definition at line 1545 of file context.cpp.

1546  {
1547  Definition *outerScope = def->getOuterScope();
1549  if (outerScope && outerScope!=Doxygen::globalScope)
1550  {
1551  fillPath(outerScope,list);
1552  }
1553  else if (type==Definition::TypeFile && ((const FileDef*)def)->getDirDef())
1554  {
1555  fillPath(((const FileDef*)def)->getDirDef(),list);
1556  }
1557  list->append(NavPathElemContext::alloc(def));
1558  }
static NavPathElemContext * alloc(Definition *def)
Definition: context.h:892
virtual void append(const TemplateVariant &v)
Definition: template.cpp:343
static NamespaceDef * globalScope
Definition: doxygen.h:128
virtual DefType definitionType() const =0
virtual Definition * getOuterScope() const
void fillPath(Definition *def, TemplateList *list) const
Definition: context.cpp:1545
template<typename T>
Cachable& DefinitionContext< T >::getCache ( ) const
inlineprivate

Definition at line 1640 of file context.cpp.

1641  {
1642  Cachable *c = static_cast<Cachable*>(m_def->cookie());
1643  assert(c!=0);
1644  return *c;
1645  }
Cookie * cookie() const
Definition: definition.h:352
Definition * m_def
Definition: context.cpp:1646
template<typename T>
TemplateVariant DefinitionContext< T >::inbodyDocs ( ) const
inline

Definition at line 1469 of file context.cpp.

1470  {
1471  Cachable &cache = getCache();
1472  if (!cache.inbodyDocs || g_globals.outputFormat!=cache.inbodyDocsOutputFormat)
1473  {
1474  if (!m_def->inbodyDocumentation().isEmpty())
1475  {
1476  cache.inbodyDocs.reset(new TemplateVariant(parseDoc(m_def,m_def->inbodyFile(),m_def->inbodyLine(),
1478  cache.inbodyDocsOutputFormat = g_globals.outputFormat;
1479  }
1480  else
1481  {
1482  cache.inbodyDocs.reset(new TemplateVariant(""));
1483  }
1484  }
1485  return *cache.inbodyDocs;
1486  }
bool isEmpty() const
Definition: qcstring.h:189
Definition * m_def
Definition: context.cpp:1646
QCString inbodyDocumentation() const
const bool FALSE
Definition: qglobal.h:370
static TemplateVariant parseDoc(Definition *def, const QCString &file, int line, const QCString &relPath, const QCString &docStr, bool isBrief)
Definition: context.cpp:1227
QCString inbodyFile() const
QCString relPathAsString() const
Definition: context.cpp:1431
int inbodyLine() const
Variant type which can hold one value of a fixed set of types.
Definition: template.h:90
ContextOutputFormat outputFormat
Definition: context.cpp:71
struct ContextGlobals g_globals
Cachable & getCache() const
Definition: context.cpp:1640
template<typename T>
TemplateVariant DefinitionContext< T >::isLinkable ( ) const
inline

Definition at line 1415 of file context.cpp.

1416  {
1417  return m_def->isLinkable();
1418  }
virtual bool isLinkable() const =0
Definition * m_def
Definition: context.cpp:1646
template<typename T>
TemplateVariant DefinitionContext< T >::isLinkableInProject ( ) const
inline

Definition at line 1419 of file context.cpp.

1420  {
1421  return m_def->isLinkableInProject();
1422  }
virtual bool isLinkableInProject() const =0
Definition * m_def
Definition: context.cpp:1646
template<typename T>
TemplateVariant DefinitionContext< T >::isReference ( ) const
inline

Definition at line 1577 of file context.cpp.

1578  {
1579  return m_def->isReference();
1580  }
Definition * m_def
Definition: context.cpp:1646
virtual bool isReference() const
template<typename T>
TemplateVariant DefinitionContext< T >::language ( ) const
inline

Definition at line 1491 of file context.cpp.

1492  {
1493  SrcLangExt lang = m_def->getLanguage();
1494  QCString result = "unknown";
1495  switch (lang)
1496  {
1497  case SrcLangExt_Unknown: break;
1498  case SrcLangExt_IDL: result="idl"; break;
1499  case SrcLangExt_Java: result="java"; break;
1500  case SrcLangExt_CSharp: result="csharp"; break;
1501  case SrcLangExt_D: result="d"; break;
1502  case SrcLangExt_PHP: result="php"; break;
1503  case SrcLangExt_ObjC: result="objc"; break;
1504  case SrcLangExt_Cpp: result="cpp"; break;
1505  case SrcLangExt_JS: result="js"; break;
1506  case SrcLangExt_Python: result="python"; break;
1507  case SrcLangExt_Fortran: result="fortran"; break;
1508  case SrcLangExt_VHDL: result="vhdl"; break;
1509  case SrcLangExt_XML: result="xml"; break;
1510  case SrcLangExt_Tcl: result="tcl"; break;
1511  case SrcLangExt_Markdown: result="markdown"; break;
1512  }
1513  return result;
1514  }
static QCString result
Definition * m_def
Definition: context.cpp:1646
SrcLangExt
Definition: types.h:41
SrcLangExt getLanguage() const
template<typename T>
TemplateVariant DefinitionContext< T >::name ( ) const
inline

Definition at line 1423 of file context.cpp.

1424  {
1425  return m_def->displayName(TRUE);
1426  }
Definition * m_def
Definition: context.cpp:1646
virtual QCString displayName(bool includeScope=TRUE) const =0
const bool TRUE
Definition: qglobal.h:371
template<typename T>
TemplateVariant DefinitionContext< T >::navigationPath ( ) const
inline

Definition at line 1559 of file context.cpp.

1560  {
1561  Cachable &cache = getCache();
1562  if (!cache.navPath)
1563  {
1566  {
1567  fillPath(m_def->getOuterScope(),list);
1568  }
1569  else if (m_def->definitionType()==Definition::TypeFile && ((const FileDef *)m_def)->getDirDef())
1570  {
1571  fillPath(((const FileDef *)m_def)->getDirDef(),list);
1572  }
1573  cache.navPath.reset(list);
1574  }
1575  return cache.navPath.get();
1576  }
static TemplateList * alloc()
Definition: template.cpp:420
Definition * m_def
Definition: context.cpp:1646
Default implementation of a context value of type list.
Definition: template.h:376
static NamespaceDef * globalScope
Definition: doxygen.h:128
virtual DefType definitionType() const =0
virtual Definition * getOuterScope() const
Cachable & getCache() const
Definition: context.cpp:1640
void fillPath(Definition *def, TemplateList *list) const
Definition: context.cpp:1545
template<typename T>
virtual TemplateVariant DefinitionContext< T >::relPath ( ) const
inlinevirtual

Reimplemented in PageContext::Private, and DirContext::Private.

Definition at line 1436 of file context.cpp.

1437  {
1438  return relPathAsString();
1439  }
QCString relPathAsString() const
Definition: context.cpp:1431
template<typename T>
QCString DefinitionContext< T >::relPathAsString ( ) const
inline

Definition at line 1431 of file context.cpp.

1432  {
1433  static bool createSubdirs = Config_getBool("CREATE_SUBDIRS");
1434  return createSubdirs ? QCString("../../") : QCString("");
1435  }
#define Config_getBool(val)
Definition: config.cpp:664
template<typename T>
TemplateVariant DefinitionContext< T >::sourceDef ( ) const
inline

Definition at line 1533 of file context.cpp.

1534  {
1535  Cachable &cache = getCache();
1536  if (cache.sourceDef->count()==2)
1537  {
1538  return cache.sourceDef.get();
1539  }
1540  else
1541  {
1542  return FALSE;
1543  }
1544  }
const bool FALSE
Definition: qglobal.h:370
Cachable & getCache() const
Definition: context.cpp:1640
template<typename T>
TemplateVariant DefinitionContext< T >::sourceFileName ( ) const
inline

Definition at line 1411 of file context.cpp.

1412  {
1413  return m_def->getSourceFileBase();
1414  }
Definition * m_def
Definition: context.cpp:1646
virtual QCString getSourceFileBase() const
Definition: definition.cpp:885

Member Data Documentation

template<typename T>
Definition* DefinitionContext< T >::m_def
private

Definition at line 1646 of file context.cpp.


The documentation for this class was generated from the following file: