Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
corpus2
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Redmine
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Analysers
corpus2
Commits
01f9e76f
Commit
01f9e76f
authored
May 5, 2011
by
ilor
Browse files
Options
Downloads
Patches
Plain Diff
path searcher updates
parent
68fd225b
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
libpwrutils/pathsearch.cpp
+2
-2
2 additions, 2 deletions
libpwrutils/pathsearch.cpp
libpwrutils/pathsearch.h
+21
-6
21 additions, 6 deletions
libpwrutils/pathsearch.h
with
23 additions
and
8 deletions
libpwrutils/pathsearch.cpp
+
2
−
2
View file @
01f9e76f
...
...
@@ -72,7 +72,7 @@ const std::string& PathSearcherBase::get_path_separator() const
}
std
::
string
PathSearcherBase
::
find_file
(
const
std
::
string
&
filename
,
const
std
::
string
&
info
)
const
std
::
string
&
info
)
const
{
boost
::
filesystem
::
path
i
(
filename
);
if
(
i
.
is_complete
())
{
...
...
@@ -101,7 +101,7 @@ std::string PathSearcherBase::find_file(const std::string& filename,
}
bool
PathSearcherBase
::
open_stream
(
const
std
::
string
&
filename
,
std
::
ifstream
&
ifs
,
const
std
::
string
&
info
)
std
::
ifstream
&
ifs
,
const
std
::
string
&
info
)
const
{
std
::
string
f
=
find_file
(
filename
,
info
);
if
(
!
f
.
empty
())
{
...
...
This diff is collapsed.
Click to expand it.
libpwrutils/pathsearch.h
+
21
−
6
View file @
01f9e76f
...
...
@@ -73,7 +73,7 @@ public:
* is on. Empty info string suppreses loading info.
*/
std
::
string
find_file
(
const
std
::
string
&
filename
,
const
std
::
string
&
info
=
""
);
const
std
::
string
&
info
=
""
)
const
;
/**
* Open a file stream for a file in the library search path
...
...
@@ -83,7 +83,22 @@ public:
* is on. Empty info string suppreses loading info.
*/
bool
open_stream
(
const
std
::
string
&
filename
,
std
::
ifstream
&
ifs
,
const
std
::
string
&
info
=
""
);
const
std
::
string
&
info
=
""
)
const
;
/**
* Convenience wrapper around find_file to throw an exception
* when the file is not found.
* Virtual, as it throws the exception defined by the child class.
*/
virtual
std
::
string
find_file_or_throw
(
const
std
::
string
&
filename
,
const
std
::
string
&
where
)
const
=
0
;
/**
* Wrapper around open_stream to throw an exception when the file is not
* found. Virtual, as it throws the exception defined by the child class.
*/
virtual
void
open_stream_or_throw
(
const
std
::
string
&
filename
,
std
::
ifstream
&
ifs
,
const
std
::
string
&
where
)
const
=
0
;
/**
* Look for files matching a condition.
...
...
@@ -122,14 +137,14 @@ public:
* when the file is not found.
*/
std
::
string
find_file_or_throw
(
const
std
::
string
&
filename
,
const
std
::
string
&
where
);
const
std
::
string
&
where
)
const
;
/**
* Convenience template wrapper around open_stream to throw an
* exception when the file is not found.
*/
void
open_stream_or_throw
(
const
std
::
string
&
filename
,
std
::
ifstream
&
ifs
,
const
std
::
string
&
where
);
std
::
ifstream
&
ifs
,
const
std
::
string
&
where
)
const
;
};
...
...
@@ -158,7 +173,7 @@ private:
template
<
class
E
>
std
::
string
PathSearcher
<
E
>::
find_file_or_throw
(
const
std
::
string
&
filename
,
const
std
::
string
&
info
)
const
std
::
string
&
filename
,
const
std
::
string
&
info
)
const
{
std
::
string
fn
=
find_file
(
filename
,
info
);
if
(
fn
.
empty
())
{
...
...
@@ -169,7 +184,7 @@ std::string PathSearcher<E>::find_file_or_throw(
template
<
class
E
>
void
PathSearcher
<
E
>::
open_stream_or_throw
(
const
std
::
string
&
filename
,
std
::
ifstream
&
ifs
,
const
std
::
string
&
info
)
std
::
ifstream
&
ifs
,
const
std
::
string
&
info
)
const
{
if
(
!
open_stream
(
filename
,
ifs
,
info
))
{
throw
E
(
filename
,
get_search_path_string
(),
info
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment