Skip to content

Commit

Permalink
isSingletonResult is renamed to isSingleResult.
Browse files Browse the repository at this point in the history
  • Loading branch information
dbukki committed May 1, 2024
1 parent 6544d70 commit 72c6a6b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion parser/src/sourcemanager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ void SourceManager::removeFile(const model::File& file_)
{
odb::result<model::File> relFiles = _db->query<model::File>(
odb::query<model::File>::content == file_.content.object_id());
if (util::isSingletonResult(relFiles))
if (util::isSingleResult(relFiles))
{
removeContent = true;
_db->erase<model::FileContent>(file_.content.object_id());
Expand Down
12 changes: 6 additions & 6 deletions util/include/util/dbutil.h
Original file line number Diff line number Diff line change
Expand Up @@ -98,20 +98,20 @@ inline std::string getDbDriver()
}

/// @brief Determines if the specified ODB query result only contains
/// a single entity. That single entity is then stored in 'singleton_'.
/// a single entity. That single entity is then stored in 'single_'.
/// @tparam TEntity The type of entities in the query result.
/// @param result_ The ODB query result in question.
/// @param singleton_ The variable that receives the first entity (if any).
/// @return Returns true if 'result_' only contained 'singleton_';
/// @param single_ The variable that receives the first entity (if any).
/// @return Returns true if 'result_' only contained 'single_';
/// otherwise false.
template<typename TEntity>
bool isSingletonResult(odb::result<TEntity>& result_, TEntity& singleton_)
bool isSingleResult(odb::result<TEntity>& result_, TEntity& single_)
{
auto it_b = result_.begin();
const auto it_e = result_.end();
if (it_b != it_e)
{
singleton_ = *it_b;
single_ = *it_b;
return ++it_b == it_e;
}
else return false;
Expand All @@ -124,7 +124,7 @@ bool isSingletonResult(odb::result<TEntity>& result_, TEntity& singleton_)
/// @return Returns true if 'result_' only contained a single entity;
/// otherwise false.
template<typename TEntity>
bool isSingletonResult(odb::result<TEntity>& result_)
bool isSingleResult(odb::result<TEntity>& result_)
{
auto it_b = result_.begin();
const auto it_e = result_.end();
Expand Down

0 comments on commit 72c6a6b

Please sign in to comment.