Doxygen
Loading...
Searching...
No Matches
rtfgen.h File Reference
#include <array>
#include "config.h"
#include "outputgen.h"
Include dependency graph for rtfgen.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  RTFCodeGenerator
 Generator for RTF code fragments. More...
class  RTFGenerator
 Generator for RTF output. More...
struct  RTFGenerator::RTFListItemInfo

Functions

QCString rtfFormatBmkStr (const QCString &name)

Function Documentation

◆ rtfFormatBmkStr()

QCString rtfFormatBmkStr ( const QCString & name)

Definition at line 2873 of file rtfgen.cpp.

2874{
2875 std::lock_guard<std::mutex> lock(g_rtfFormatMutex);
2876
2877 // To overcome the 40-character tag limitation, we
2878 // substitute a short arbitrary string for the name
2879 // supplied, and keep track of the correspondence
2880 // between names and strings.
2881 auto it = g_tagMap.find(name.str());
2882 if (it!=g_tagMap.end()) // already known
2883 {
2884 return QCString(it->second);
2885 }
2886
2887 QCString tag = g_nextTag;
2888 auto result = g_tagMap.emplace(name.str(), g_nextTag.str());
2889
2890 if (result.second) // new item was added
2891 {
2892 // increment the next tag.
2893
2894 char* nxtTag = g_nextTag.rawData() + g_nextTag.length() - 1;
2895 for ( unsigned int i = 0; i < g_nextTag.length(); ++i, --nxtTag )
2896 {
2897 if ( ( ++(*nxtTag) ) > 'Z' )
2898 {
2899 *nxtTag = 'A';
2900 }
2901 else
2902 {
2903 // Since there was no carry, we can stop now
2904 break;
2905 }
2906 }
2907 }
2908
2909 Debug::print(Debug::Rtf,0,"Name = {} RTF_tag = {}\n",name,tag);
2910 return tag;
2911}
@ Rtf
Definition debug.h:43
static void print(DebugMask mask, int prio, fmt::format_string< Args... > fmt, Args &&... args)
Definition debug.h:76
This is an alternative implementation of QCString.
Definition qcstring.h:101
const std::string & str() const
Definition qcstring.h:537
static std::mutex g_rtfFormatMutex
Definition rtfgen.cpp:2869
static QCString g_nextTag("AAAAAAAAAA")
static std::unordered_map< std::string, std::string > g_tagMap
Definition rtfgen.cpp:2870

References g_nextTag, g_rtfFormatMutex, g_tagMap, Rtf_Style_Default::name, Debug::print(), and Debug::Rtf.

Referenced by RTFGenerator::endDoxyAnchor(), objectLinkToString(), RTFDocVisitor::operator()(), RTFDocVisitor::operator()(), RTFDocVisitor::operator()(), RTFDocVisitor::operator()(), RTFDocVisitor::operator()(), RTFDocVisitor::startLink(), RTFGenerator::startTextLink(), RTFGenerator::writeAnchor(), RTFCodeGenerator::writeCodeLink(), RTFCodeGenerator::writeLineNumber(), RTFGenerator::writeRTFReference(), and RTFGenerator::writeStartAnnoItem().