STORMM Source Documentation
Loading...
Searching...
No Matches
code_dox.h
1// -*-c++-*-
2#ifndef STORMM_SEARCH_DOX_H
3#define STORMM_SEARCH_DOX_H
4
5#include <vector>
6#include <string>
7#include "copyright.h"
8
9namespace stormm {
10namespace docs {
11
12using parse::TextFileReader;
13
16public:
17
21 ObjectIdentifier(const std::string &filename_in);
22
24 ~ObjectIdentifier() = default;
25
27 int getInstanceCount() const;
28
30 const std::string getFileName() const;
31
33 int getReturnTypeCount() const;
34
38 const std::string getReturnType(const int nt = 0) const;
39
43 void addInstance(const int n_add = 1);
44
46 void addReturnType(const std::string rtype);
47
48private:
49 const std::string file_name;
51 std::vector<std::string> return_types;
53 int n_instances;
56};
57
59enum class ObjectReportType {
60 FULL,
61 ANNOTATION_ONLY,
62 STATS_ONLY
63};
64
66enum class PreProcessorScopeModifier {
67 NONE,
68 IF,
69 ELIF,
70 ELSE,
71 ENDIF,
72};
73
76struct CppScope {
80 int end_pos;
81 std::string scope_name;
83 std::string file_name;
84 std::vector<std::string> namespaces;
86
90 CppScope(const std::string &filename_in);
91
93 ~CppScope() = default;
94};
95
102bool lineIsPreProcessor(const char* line, int nchar);
103
109PreProcessorScopeModifier testScopeModifier(const char* line, int nchar);
110
114std::vector<int3> findPreProcessorScopes(const TextFileReader &tfr);
115
119std::vector<CppScope> findCppScopes(const TextFileReader &tfr);
120
125ObjectIdentifier searchFileForObject(const std::string &object_name, const std::string &filename);
126
132void searchObject(const std::string &object_name, const std::string &member_name = std::string(),
133 ObjectReportType report_format = ObjectReportType::FULL);
134
135} // namespace docs
136} // namespace stormm
137
138
139#endif
Stores data on instances of an object (i.e. a function or struct found in a given file.
Definition code_dox.h:15
const std::string getReturnType(const int nt=0) const
Report the return type found for an object, as recorded in some ObjectIdentifier.
Definition code_dox.cpp:44
void addInstance(const int n_add=1)
Tally one more instance of an object in an ObjectIdentifier.
Definition code_dox.cpp:49
const std::string getFileName() const
Return the name of the file searched to produce an ObjectIdentifier.
Definition code_dox.cpp:34
void addReturnType(const std::string rtype)
Set the return type of an object in an ObjectIdentifier.
Definition code_dox.cpp:54
~ObjectIdentifier()=default
Default destructor.
ObjectIdentifier(const std::string &filename_in)
Constructor for the ObjectIdentifier struct.
Definition code_dox.cpp:22
int getReturnTypeCount() const
Report the number of return types for an object from some ObjectIdentifier.
Definition code_dox.cpp:39
int getInstanceCount() const
Return the number of instances for an object, as recorded in some ObjectIdentifier.
Definition code_dox.cpp:29
std::vector< std::string > namespaces
Definition code_dox.h:84
int start_pos
Position on the line at which this scope starts.
Definition code_dox.h:78
CppScope(const std::string &filename_in)
Constructor for a C++ scope struct.
Definition code_dox.cpp:59
std::string file_name
File name in which this scope is found.
Definition code_dox.h:83
int start_line
Line at which this scope starts.
Definition code_dox.h:77
~CppScope()=default
Default destructor.
int end_pos
Position on the line at which this scope ends.
Definition code_dox.h:80
std::string scope_name
Definition code_dox.h:81
int end_line
Line at which this scope ends.
Definition code_dox.h:79
Abstract for the TextFile object, providing read-only access.
Definition textfile.h:20