Doxygen
Loading...
Searching...
No Matches
rtfgen.h File Reference
#include <array>
#include <memory>
#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

DString rtfFormatBmkStr (const DString &name)

Function Documentation

◆ rtfFormatBmkStr()

DString rtfFormatBmkStr ( const DString & name)

Definition at line 2876 of file rtfgen.cpp.

2877{
2878 std::lock_guard<std::mutex> lock(g_rtfFormatMutex);
2879
2880 // To overcome the 40-character tag limitation, we
2881 // substitute a short arbitrary string for the name
2882 // supplied, and keep track of the correspondence
2883 // between names and strings.
2884 auto it = g_tagMap.find(name.str());
2885 if (it!=g_tagMap.end()) // already known
2886 {
2887 return it->second;
2888 }
2889
2890 DString tag = g_nextTag;
2891 auto result = g_tagMap.emplace(name.str(), g_nextTag.str());
2892
2893 if (result.second) // new item was added
2894 {
2895 // increment the next tag.
2896
2897 char* nxtTag = g_nextTag.rawData() + g_nextTag.length() - 1;
2898 for ( unsigned int i = 0; i < g_nextTag.length(); ++i, --nxtTag )
2899 {
2900 if ( ( ++(*nxtTag) ) > 'Z' )
2901 {
2902 *nxtTag = 'A';
2903 }
2904 else
2905 {
2906 // Since there was no carry, we can stop now
2907 break;
2908 }
2909 }
2910 }
2911
2912 Debug::print(Debug::Rtf,0,"Name = {} RTF_tag = {}\n",name,tag);
2913 return tag;
2914}
A String class for use with Doxygen wrapping std::string and adding some additional functionality off...
Definition dstring.h:88
char * rawData()
Returns a writable pointer to the data.
Definition dstring.h:170
const std::string & str() const
Definition dstring.h:649
size_t length() const
Returns the length of the string, not counting the 0-terminator.
Definition dstring.h:155
@ Rtf
Definition debug.h:44
static void print(DebugMask mask, int prio, fmt::format_string< Args... > fmt, Args &&... args)
Definition debug.h:78
static std::mutex g_rtfFormatMutex
Definition rtfgen.cpp:2872
static std::unordered_map< std::string, std::string > g_tagMap
Definition rtfgen.cpp:2873
static DString g_nextTag("AAAAAAAAAA")

References g_nextTag, g_rtfFormatMutex, g_tagMap, DString::length(), Rtf_Style_Default::name, Debug::print(), DString::rawData(), Debug::Rtf, rtfFormatBmkStr(), and DString::str().

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