My Project
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Classes | Macros | Functions | Variables
layout.cpp File Reference
#include "layout.h"
#include "message.h"
#include "language.h"
#include "vhdldocgen.h"
#include "util.h"
#include "doxygen.h"
#include "version.h"
#include "config.h"
#include <assert.h>
#include <qxml.h>
#include <qfile.h>
#include <qstring.h>
#include <qfileinfo.h>
#include <qtextstream.h>
#include "layout_default.xml.h"

Go to the source code of this file.

Classes

class  LayoutParser
 
class  LayoutParser::StartElementHandler
 
class  LayoutParser::StartElementHandlerKind
 
class  LayoutParser::StartElementHandlerSection
 
class  LayoutParser::StartElementHandlerMember
 
class  LayoutParser::StartElementHandlerNavEntry
 
class  LayoutParser::EndElementHandler
 
class  LayoutErrorHandler
 
class  LayoutDocManager::Private
 

Macros

#define ADD_OPTION(langId, text)   "|"+QCString().setNum(langId)+"="+text
 
#define COMPILE_FOR_1_OPTION(def, langId1, text1)   def+ADD_OPTION(langId1,text1)
 
#define COMPILE_FOR_2_OPTIONS(def, langId1, text1, langId2, text2)   COMPILE_FOR_1_OPTION(def,langId1,text1)+ADD_OPTION(langId2,text2)
 
#define COMPILE_FOR_3_OPTIONS(def, langId1, text1, langId2, text2, langId3, text3)   COMPILE_FOR_2_OPTIONS(def,langId1,text1,langId2,text2)+ADD_OPTION(langId3,text3)
 
#define COMPILE_FOR_4_OPTIONS(def, langId1, text1, langId2, text2, langId3, text3, langId4, text4)   COMPILE_FOR_3_OPTIONS(def,langId1,text1,langId2,text2,langId3,text3)+ADD_OPTION(langId4,text4)
 

Functions

static bool elemIsVisible (const QXmlAttributes &attrib, bool defVal=TRUE)
 
void writeDefaultLayoutFile (const char *fileName)
 
QCString extractLanguageSpecificTitle (const QCString &input, SrcLangExt lang)
 

Variables

static const char layout_default [] =
 

Macro Definition Documentation

#define ADD_OPTION (   langId,
  text 
)    "|"+QCString().setNum(langId)+"="+text

Definition at line 39 of file layout.cpp.

#define COMPILE_FOR_1_OPTION (   def,
  langId1,
  text1 
)    def+ADD_OPTION(langId1,text1)

Definition at line 41 of file layout.cpp.

Referenced by LayoutParser::init().

#define COMPILE_FOR_2_OPTIONS (   def,
  langId1,
  text1,
  langId2,
  text2 
)    COMPILE_FOR_1_OPTION(def,langId1,text1)+ADD_OPTION(langId2,text2)

Definition at line 44 of file layout.cpp.

Referenced by LayoutParser::init().

#define COMPILE_FOR_3_OPTIONS (   def,
  langId1,
  text1,
  langId2,
  text2,
  langId3,
  text3 
)    COMPILE_FOR_2_OPTIONS(def,langId1,text1,langId2,text2)+ADD_OPTION(langId3,text3)

Definition at line 47 of file layout.cpp.

Referenced by LayoutParser::init().

#define COMPILE_FOR_4_OPTIONS (   def,
  langId1,
  text1,
  langId2,
  text2,
  langId3,
  text3,
  langId4,
  text4 
)    COMPILE_FOR_3_OPTIONS(def,langId1,text1,langId2,text2,langId3,text3)+ADD_OPTION(langId4,text4)

Definition at line 50 of file layout.cpp.

Referenced by LayoutParser::init().

Function Documentation

static bool elemIsVisible ( const QXmlAttributes &  attrib,
bool  defVal = TRUE 
)
static

Definition at line 53 of file layout.cpp.

References err().

Referenced by LayoutParser::startNavEntry(), LayoutParser::startSectionEntry(), and LayoutParser::startSimpleEntry().

{
QCString visible = attrib.value("visible").utf8();
if (visible.isEmpty()) return defVal;
if (visible.at(0)=='$' && visible.length()>1)
{
QCString id = visible.mid(1);
const ConfigValues::Info *opt = ConfigValues::instance().get(id);
if (opt && opt->type==ConfigValues::Info::Bool)
{
return ConfigValues::instance().*((ConfigValues::InfoBool*)opt)->item;
}
else if (!opt)
{
err("found unsupported value %s for visible attribute in layout file\n",
visible.data());
}
}
return visible!="no" && visible!="0";
}
QCString extractLanguageSpecificTitle ( const QCString &  input,
SrcLangExt  lang 
)

Definition at line 1417 of file layout.cpp.

Referenced by LayoutDocEntryMemberDecl::subtitle(), LayoutDocEntrySection::title(), LayoutDocEntryMemberDecl::title(), and LayoutDocEntryMemberDef::title().

{
int i,s=0,e=input.find('|');
if (e==-1) return input; // simple title case
int e1=e;
while (e!=-1) // look for 'number=title' pattern separated by '|'
{
s=e+1;
e=input.find('|',s);
i=input.find('=',s);
assert(i>s);
int key=input.mid(s,i-s).toInt();
if (key==(int)lang) // found matching key
{
if (e==-1) e=input.length();
return input.mid(i+1,e-i-1);
}
}
return input.left(e1); // fallback, no explicit language key found
}
void writeDefaultLayoutFile ( const char *  fileName)

Definition at line 1397 of file layout.cpp.

References err(), layout_default, openOutputFile(), substitute(), and versionString.

Referenced by readConfiguration().

{
QFile f(fileName);
bool ok = openOutputFile(fileName,f);
if (!ok)
{
err("Failed to open file %s for writing!\n",fileName);
return;
}
QTextStream t(&f);
t << substitute(layout_default,"$doxygenversion",versionString);
}

Variable Documentation

const char layout_default[] =
static

Definition at line 35 of file layout.cpp.

Referenced by LayoutDocManager::init(), and writeDefaultLayoutFile().