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.

#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.

#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.

#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.

Function Documentation

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

Definition at line 53 of file layout.cpp.

54 {
55  QCString visible = attrib.value("visible").utf8();
56  if (visible.isEmpty()) return defVal;
57  if (visible.at(0)=='$' && visible.length()>1)
58  {
59  QCString id = visible.mid(1);
60  ConfigOption *opt = Config::instance()->get(id);
61  if (opt && opt->kind()==ConfigOption::O_Bool)
62  {
63  return *((ConfigBool *)opt)->valueRef();
64  }
65  else if (!opt)
66  {
67  err("found unsupported value %s for visible attribute in layout file\n",
68  visible.data());
69  }
70  }
71  return visible!="no" && visible!="0";
72 }
bool isEmpty() const
Definition: qcstring.h:189
uint length() const
Definition: qcstring.h:195
char & at(uint i) const
Definition: qcstring.h:326
opt
Definition: train.py:196
const std::string instance
OptionType kind() const
Definition: config.h:65
QString value(int index) const
Definition: qxml.cpp:664
const char * data() const
Definition: qcstring.h:207
void err(const char *fmt,...)
Definition: message.cpp:226
QCString mid(uint index, uint len=0xffffffff) const
Definition: qcstring.cpp:246
QCString utf8() const
Definition: qstring.cpp:14507
QCString extractLanguageSpecificTitle ( const QCString input,
SrcLangExt  lang 
)

Definition at line 1417 of file layout.cpp.

1418 {
1419  int i,s=0,e=input.find('|');
1420  if (e==-1) return input; // simple title case
1421  int e1=e;
1422  while (e!=-1) // look for 'number=title' pattern separated by '|'
1423  {
1424  s=e+1;
1425  e=input.find('|',s);
1426  i=input.find('=',s);
1427  assert(i>s);
1428  int key=input.mid(s,i-s).toInt();
1429  if (key==(int)lang) // found matching key
1430  {
1431  if (e==-1) e=input.length();
1432  return input.mid(i+1,e-i-1);
1433  }
1434  }
1435  return input.left(e1); // fallback, no explicit language key found
1436 }
uint length() const
Definition: qcstring.h:195
QCString left(uint len) const
Definition: qcstring.cpp:213
int find(char c, int index=0, bool cs=TRUE) const
Definition: qcstring.cpp:41
const double e
static int input(void)
Definition: code.cpp:15695
def key(type, name=None)
Definition: graph.py:13
int toInt(bool *ok=0) const
Definition: qcstring.cpp:439
QCString mid(uint index, uint len=0xffffffff) const
Definition: qcstring.cpp:246
static QCString * s
Definition: config.cpp:1042
void writeDefaultLayoutFile ( const char *  fileName)

Definition at line 1397 of file layout.cpp.

1398 {
1399  QFile f(fileName);
1400  bool ok = openOutputFile(fileName,f);
1401  if (!ok)
1402  {
1403  err("Failed to open file %s for writing!\n",fileName);
1404  return;
1405  }
1406  QTextStream t(&f);
1407  t << substitute(layout_default,"$doxygenversion",versionString);
1408 }
bool openOutputFile(const char *outFile, QFile &f)
Definition: util.cpp:8588
fileName
Definition: dumpTree.py:9
char versionString[]
Definition: version.cpp:1
void err(const char *fmt,...)
Definition: message.cpp:226
The QFile class is an I/O device that operates on files.
Definition: qfile.h:50
The QTextStream class provides basic functions for reading and writing text using a QIODevice...
Definition: qtextstream.h:53
static const char layout_default[]
Definition: layout.cpp:35
QCString substitute(const QCString &s, const QCString &src, const QCString &dst)
substitute all occurrences of src in s by dst
Definition: util.cpp:5088

Variable Documentation

const char layout_default[] =
static

Definition at line 35 of file layout.cpp.