Orb/Doxygen/src/xmlditaelementprefix.h
changeset 3 d8fccb2cd802
equal deleted inserted replaced
2:932c358ece3e 3:d8fccb2cd802
       
     1 /******************************************************************************
       
     2  *
       
     3  * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
       
     4  *
       
     5  * Permission to use, copy, modify, and distribute this software and its
       
     6  * documentation under the terms of the GNU General Public License is hereby 
       
     7  * granted. No representations are made about the suitability of this software 
       
     8  * for any purpose. It is provided "as is" without express or implied warranty.
       
     9  * See the GNU General Public License for more details.
       
    10  *
       
    11  */
       
    12 
       
    13 #ifndef XMLDITAELEMENTPREFIX_H
       
    14 #define XMLDITAELEMENTPREFIX_H
       
    15 
       
    16 #include "definition.h"
       
    17 #include "classdef.h"
       
    18 #include "memberdef.h"
       
    19 #include "namespacedef.h"
       
    20 #include "filedef.h"
       
    21 #include <qstring.h>
       
    22 #include <qdict.h>
       
    23 #include <qfileinfo.h>
       
    24 
       
    25 /** Class that handles mappings between file name extensions and the
       
    26 source code language. This also handles mappings from source code language
       
    27 to DITA element prefix e.g. <cxxClassDef> and references to DITA elements
       
    28 such as <cxxclass>
       
    29 */
       
    30 class DITAElementPrefix
       
    31 {
       
    32 public:
       
    33 	DITAElementPrefix();
       
    34 	QString srcLang(const QString& fileName);
       
    35 	QString srcLang(const Definition *d);
       
    36 	QString memberKind(const MemberDef *md);
       
    37 	QString memberKind(const ClassDef *cd);
       
    38 	QString elemPrefix(const QString& fileName);
       
    39 	QString elemPrefix(const Definition *d);
       
    40 	QString elemPrefix(const MemberDef *md, bool includeKind);
       
    41 	QString elemPrefix(const ClassDef *cd, bool includeKind);
       
    42 	QString elemPrefix(const NamespaceDef *nd, bool includeKind);
       
    43 	QString elemPrefix(const FileDef *nd, bool includeKind);
       
    44 	QString elemReference(const MemberDef *md);
       
    45 	QString elemReference(const ClassDef *cd);
       
    46 	// DITA Map references to the 'big four'
       
    47 	QString ditaMapRef(const MemberDef *md);
       
    48 	QString ditaMapRef(const ClassDef *cd);
       
    49 	QString ditaMapRef(const NamespaceDef *nd);
       
    50 	QString ditaMapRef(const FileDef *fd);
       
    51 	// DOCTYPE stuff
       
    52 	QString doctypeOwner(const QString &srcLang);
       
    53 	// DOCTYPE for the 'big four'
       
    54 	QString doctypeStr(const MemberDef *md);
       
    55 	QString doctypeStr(const ClassDef *cd);
       
    56 	QString doctypeStr(const NamespaceDef *nd);
       
    57 	QString doctypeStr(const FileDef *fd);
       
    58 	QString doctypeStr(const QString &srcLang, const QString &ePref, const QString &sInsert);
       
    59 private:
       
    60 	QDict<char> m_extToLang;
       
    61 	QDict<char> m_langToPrefix;
       
    62 	QDict<char> m_langToDoctypeOwner;
       
    63 	QString m_defaultLanguage;
       
    64 private:
       
    65 	QString capFirstLetter(const QString& in) const;
       
    66 	QString doctypeStr(const Definition *d, const QString &ePref, const QString& sInsert);
       
    67 private:
       
    68 	// Private cctor and op=
       
    69 	DITAElementPrefix (const DITAElementPrefix &rhs);
       
    70 	DITAElementPrefix& operator=(const DITAElementPrefix &rhs);
       
    71 };
       
    72 
       
    73 #endif // XMLDITAELEMENTPREFIX_H