FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
rstudio/src/cpp/session/modules/SessionCodeSearch.hpp at master · pearsonca/rstudio · GitHub
pearsonca
/
rstudio
Public
forked from
rstudio/rstudio
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
rstudio
/
src
/
cpp
/
session
/
modules
/
SessionCodeSearch.hpp
Copy path
More file actions
More file actions
Latest commit
History
History
History
121 lines (94 loc) · 3.08 KB
Breadcrumbs
rstudio
/
src
/
cpp
/
session
/
modules
/
SessionCodeSearch.hpp
Copy path
File metadata and controls
121 lines (94 loc) · 3.08 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
/*
* SessionCodeSearch.hpp
*
* Copyright (C) 2009-19 by RStudio, PBC
*
* Unless you have received this program directly from RStudio pursuant
* to the terms of a commercial license agreement with RStudio, then
* this program is licensed to you under the terms of version 3 of the
* GNU Affero General Public License. This program is distributed WITHOUT
* ANY EXPRESS OR IMPLIED WARRANTY, INCLUDING THOSE OF NON-INFRINGEMENT,
* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Please refer to the
* AGPL (http://www.gnu.org/licenses/agpl-3.0.txt) for more details.
*
*/
#
ifndef
SESSION_CODE_SEARCH_HPP
#
define
SESSION_CODE_SEARCH_HPP
#
include
<
core/r_util/RSourceIndex.hpp
>
#
include
<
session/SessionSourceDatabase.hpp
>
namespace
rstudio
{
namespace
core
{
class
Error
;
}
}
namespace
rstudio
{
namespace
session
{
namespace
modules
{
namespace
code_search
{
//
maintain an in-memory list of R source document indexes (for fast
//
code searching)
class
RSourceIndexes
: boost::noncopyable
{
private:
typedef
session::source_database::SourceDocument SourceDocument;
typedef
core::r_util::RSourceIndex RSourceIndex;
public:
//
maps document id (as string) to associated index
typedef
std::map< std::string, boost::shared_ptr<RSourceIndex> > IDMap;
typedef
std::map< std::string, boost::shared_ptr<RSourceIndex> > FilePathMap;
RSourceIndexes
() {}
virtual
~RSourceIndexes
() {}
//
COPYING: boost::noncopyable
void
initialize
();
void
update
(
const
boost::shared_ptr<SourceDocument>& pDoc);
boost::shared_ptr<RSourceIndex>
get
(
const
std::string& id)
{
if
(idMap_.
count
(id))
return
idMap_[id];
return
boost::shared_ptr<RSourceIndex>();
}
boost::shared_ptr<RSourceIndex>
get
(
const
core::FilePath& filePath)
{
std::string absPath = filePath.
getAbsolutePath
();
if
(filePathMap_.
count
(absPath))
return
filePathMap_[absPath];
return
boost::shared_ptr<RSourceIndex>();
}
void
remove
(
const
std::string& id,
const
std::string& path);
void
removeAll
();
std::vector< boost::shared_ptr<RSourceIndex> >
indexes
()
{
std::vector< boost::shared_ptr<RSourceIndex> > indexes;
for
(
const
IDMap::value_type& index : idMap_)
{
indexes.
push_back
(index.
second
);
}
return
indexes;
}
const
IDMap&
indexMap
()
const
{
return
idMap_;
}
const
FilePathMap&
filePathMap
()
const
{
return
filePathMap_;
}
private:
IDMap idMap_;
FilePathMap filePathMap_;
};
RSourceIndexes&
rSourceIndex
();
boost::shared_ptr<core::r_util::RSourceIndex>
getIndexedProjectFile
(
const
core::FilePath& filePath);
void
searchSource
(
const
std::string& term,
std::
size_t
maxResults,
bool
prefixOnly,
std::vector<core::r_util::RSourceItem>* pItems,
bool
* pMoreAvailable);
void
addAllProjectSymbols
(std::set<std::string>* pSymbols);
core::Error
initialize
();
}
//
namespace code_search
}
//
namespace modules
}
//
namespace session
}
//
namespace rstudio
#
endif
//
SESSION_CODE_SEARCH_HPP
Back
|
FazBrowse Home
|
New Git URL