Doxygen
Loading...
Searching...
No Matches
stlsupport.cpp File Reference
#include "stlsupport.h"
#include "entry.h"
#include "config.h"
Include dependency graph for stlsupport.cpp:

Go to the source code of this file.

Classes

struct  STLInfo
 A struct contained the data for an STL class. More...

Functions

static void addSTLMember (const std::shared_ptr< Entry > &root, const char *type, const char *name)
static void addSTLIterator (const std::shared_ptr< Entry > &classEntry, const DString &name)
static void addSTLClass (const std::shared_ptr< Entry > &root, const STLInfo *info)
static void addSTLClasses (const std::shared_ptr< Entry > &root)
void addSTLSupport (std::shared_ptr< Entry > &root)
 Add stub entries for the most used classes in the standard template library.

Variables

static STLInfo g_stlinfo []

Function Documentation

◆ addSTLClass()

void addSTLClass ( const std::shared_ptr< Entry > & root,
const STLInfo * info )
static

Definition at line 169 of file stlsupport.cpp.

170{
171 //printf("Adding STL class %s\n",info->className);
172 DString fullName = info->className;
173 fullName.prepend("std::");
174
175 // add fake Entry for the class
176 std::shared_ptr<Entry> classEntry = std::make_shared<Entry>();
177 classEntry->fileName = "[STL]";
178 classEntry->startLine = 1;
179 classEntry->name = fullName;
180 classEntry->section = EntryType::makeClass();
181 classEntry->brief = "STL class";
182 classEntry->hidden = false;
183 classEntry->artificial= true;
184
185 // add template arguments to class
186 if (info->templType1 != nullptr)
187 {
188 ArgumentList al;
189 Argument a;
190 a.type="typename";
191 a.name=info->templType1;
192 al.push_back(a);
193 if (info->templType2 != nullptr) // another template argument
194 {
195 a.type="typename";
196 a.name=info->templType2;
197 al.push_back(a);
198 }
199 classEntry->tArgLists.push_back(al);
200 }
201 // add member variables
202 if (info->templName1 != nullptr)
203 {
204 addSTLMember(classEntry,info->templType1,info->templName1);
205 }
206 if (info->templName2 != nullptr)
207 {
208 addSTLMember(classEntry,info->templType2,info->templName2);
209 }
210 if (fullName=="std::auto_ptr" ||
211 fullName=="std::smart_ptr" ||
212 fullName=="std::shared_ptr" ||
213 fullName=="std::weak_ptr" ||
214 fullName=="std::unique_ptr")
215 {
216 std::shared_ptr<Entry> memEntry = std::make_shared<Entry>();
217 memEntry->name = "operator->";
218 memEntry->args = "()";
219 memEntry->type = "T*";
220 memEntry->protection = Protection::Public;
221 memEntry->section = EntryType::makeFunction();
222 memEntry->brief = "STL member";
223 memEntry->hidden = false;
224 memEntry->artificial = false;
225 classEntry->moveToSubEntryAndKeep(memEntry);
226 }
227 Specifier virt = info->virtualInheritance ? Specifier::Virtual : Specifier::Normal;
228 if (info->baseClass1 != nullptr)
229 {
230 classEntry->extends.emplace_back(info->baseClass1, Protection::Public, virt);
231 }
232 if (info->baseClass2 != nullptr)
233 {
234 classEntry->extends.emplace_back(info->baseClass2, Protection::Public, virt);
235 }
236 if (info->iterators)
237 {
238 // add iterator class
239 addSTLIterator(classEntry,fullName+"::iterator");
240 addSTLIterator(classEntry,fullName+"::const_iterator");
241 addSTLIterator(classEntry,fullName+"::reverse_iterator");
242 addSTLIterator(classEntry,fullName+"::const_reverse_iterator");
243 }
244 root->moveToSubEntryAndKeep(classEntry);
245}
This class contains the information about the argument of a function or template.
Definition arguments.h:27
DString name
Definition arguments.h:45
DString type
Definition arguments.h:43
This class represents an function or template argument list.
Definition arguments.h:66
void push_back(const Argument &a)
Definition arguments.h:103
A String class for use with Doxygen wrapping std::string and adding some additional functionality off...
Definition dstring.h:84
DString & prepend(const char *s)
Definition dstring.h:515
static void addSTLMember(const std::shared_ptr< Entry > &root, const char *type, const char *name)
static void addSTLIterator(const std::shared_ptr< Entry > &classEntry, const DString &name)
const char * templType2
const char * templName2
const char * baseClass2
const char * templType1
const char * baseClass1
bool iterators
const char * templName1
bool virtualInheritance
const char * className
Specifier
Definition types.h:80

References addSTLIterator(), addSTLMember(), STLInfo::baseClass1, STLInfo::baseClass2, STLInfo::className, STLInfo::iterators, Argument::name, DString::prepend(), ArgumentList::push_back(), STLInfo::templName1, STLInfo::templName2, STLInfo::templType1, STLInfo::templType2, Argument::type, and STLInfo::virtualInheritance.

Referenced by addSTLClasses().

◆ addSTLClasses()

void addSTLClasses ( const std::shared_ptr< Entry > & root)
static

Definition at line 248 of file stlsupport.cpp.

249{
250 std::shared_ptr<Entry> namespaceEntry = std::make_shared<Entry>();
251 namespaceEntry->fileName = "[STL]";
252 namespaceEntry->startLine = 1;
253 namespaceEntry->name = "std";
254 namespaceEntry->section = EntryType::makeNamespace();
255 namespaceEntry->brief = "STL namespace";
256 namespaceEntry->hidden = false;
257 namespaceEntry->artificial= true;
258
259 STLInfo *info = g_stlinfo;
260 while (info->className != nullptr)
261 {
262 addSTLClass(namespaceEntry,info);
263 info++;
264 }
265
266 root->moveToSubEntryAndKeep(namespaceEntry);
267}
static STLInfo g_stlinfo[]
static void addSTLClass(const std::shared_ptr< Entry > &root, const STLInfo *info)
A struct contained the data for an STL class.

References addSTLClass(), STLInfo::className, and g_stlinfo.

Referenced by addSTLSupport().

◆ addSTLIterator()

void addSTLIterator ( const std::shared_ptr< Entry > & classEntry,
const DString & name )
static

Definition at line 156 of file stlsupport.cpp.

157{
158 std::shared_ptr<Entry> iteratorClassEntry = std::make_shared<Entry>();
159 iteratorClassEntry->fileName = "[STL]";
160 iteratorClassEntry->startLine = 1;
161 iteratorClassEntry->name = name;
162 iteratorClassEntry->section = EntryType::makeClass();
163 iteratorClassEntry->brief = "STL iterator class";
164 iteratorClassEntry->hidden = false;
165 iteratorClassEntry->artificial= true;
166 classEntry->moveToSubEntryAndKeep(iteratorClassEntry);
167}

Referenced by addSTLClass().

◆ addSTLMember()

void addSTLMember ( const std::shared_ptr< Entry > & root,
const char * type,
const char * name )
static

Definition at line 143 of file stlsupport.cpp.

144{
145 std::shared_ptr<Entry> memEntry = std::make_shared<Entry>();
146 memEntry->name = name;
147 memEntry->type = type;
148 memEntry->protection = Protection::Public;
149 memEntry->section = EntryType::makeVariable();
150 memEntry->brief = "STL member";
151 memEntry->hidden = false;
152 memEntry->artificial = true;
153 root->moveToSubEntryAndKeep(memEntry);
154}

Referenced by addSTLClass().

◆ addSTLSupport()

void addSTLSupport ( std::shared_ptr< Entry > & root)

Add stub entries for the most used classes in the standard template library.

Parameters
rootRoot of the entry tree to add the entries to.

Definition at line 269 of file stlsupport.cpp.

270{
271 if (Config_getBool(BUILTIN_STL_SUPPORT))
272 {
273 addSTLClasses(root);
274 }
275}
#define Config_getBool(name)
Definition config.h:33
static void addSTLClasses(const std::shared_ptr< Entry > &root)

References addSTLClasses(), and Config_getBool.

Referenced by parseInput().

Variable Documentation

◆ g_stlinfo

STLInfo g_stlinfo[]
static

Definition at line 37 of file stlsupport.cpp.

Referenced by addSTLClasses().