mirror of
https://codeberg.org/comaps/comaps
synced 2025-12-20 05:13:58 +00:00
Format all C++ and Java code via clang-format
Signed-off-by: Konstantin Pastbin <konstantin.pastbin@gmail.com>
This commit is contained in:
@@ -74,10 +74,7 @@ void ProcessorHandle::Detach()
|
||||
// Engine::Params ----------------------------------------------------------------------------------
|
||||
Engine::Params::Params() : m_locale("en"), m_numThreads(1) {}
|
||||
|
||||
Engine::Params::Params(string const & locale, size_t numThreads)
|
||||
: m_locale(locale), m_numThreads(numThreads)
|
||||
{
|
||||
}
|
||||
Engine::Params::Params(string const & locale, size_t numThreads) : m_locale(locale), m_numThreads(numThreads) {}
|
||||
|
||||
// Engine ------------------------------------------------------------------------------------------
|
||||
Engine::Engine(DataSource & dataSource, CategoriesHolder const & categories,
|
||||
@@ -121,19 +118,19 @@ weak_ptr<ProcessorHandle> Engine::Search(SearchParams params)
|
||||
{
|
||||
shared_ptr<ProcessorHandle> handle(new ProcessorHandle());
|
||||
PostMessage(Message::TYPE_TASK, [this, params = std::move(params), handle](Processor & processor)
|
||||
{
|
||||
DoSearch(std::move(params), handle, processor);
|
||||
});
|
||||
{ DoSearch(std::move(params), handle, processor); });
|
||||
return handle;
|
||||
}
|
||||
|
||||
void Engine::SetLocale(string const & locale)
|
||||
{
|
||||
PostMessage(Message::TYPE_BROADCAST,
|
||||
[locale](Processor & processor) { processor.SetPreferredLocale(locale); });
|
||||
PostMessage(Message::TYPE_BROADCAST, [locale](Processor & processor) { processor.SetPreferredLocale(locale); });
|
||||
}
|
||||
|
||||
size_t Engine::GetNumThreads() const { return m_threads.size(); }
|
||||
size_t Engine::GetNumThreads() const
|
||||
{
|
||||
return m_threads.size();
|
||||
}
|
||||
|
||||
void Engine::ClearCaches()
|
||||
{
|
||||
@@ -142,75 +139,61 @@ void Engine::ClearCaches()
|
||||
|
||||
void Engine::CacheWorldLocalities()
|
||||
{
|
||||
PostMessage(Message::TYPE_BROADCAST,
|
||||
[](Processor & processor) { processor.CacheWorldLocalities(); });
|
||||
PostMessage(Message::TYPE_BROADCAST, [](Processor & processor) { processor.CacheWorldLocalities(); });
|
||||
}
|
||||
|
||||
void Engine::LoadCitiesBoundaries()
|
||||
{
|
||||
PostMessage(Message::TYPE_BROADCAST,
|
||||
[](Processor & processor) { processor.LoadCitiesBoundaries(); });
|
||||
PostMessage(Message::TYPE_BROADCAST, [](Processor & processor) { processor.LoadCitiesBoundaries(); });
|
||||
}
|
||||
|
||||
void Engine::LoadCountriesTree()
|
||||
{
|
||||
PostMessage(Message::TYPE_BROADCAST,
|
||||
[](Processor & processor) { processor.LoadCountriesTree(); });
|
||||
PostMessage(Message::TYPE_BROADCAST, [](Processor & processor) { processor.LoadCountriesTree(); });
|
||||
}
|
||||
|
||||
void Engine::EnableIndexingOfBookmarksDescriptions(bool enable)
|
||||
{
|
||||
PostMessage(Message::TYPE_BROADCAST, [enable](Processor & processor) {
|
||||
processor.EnableIndexingOfBookmarksDescriptions(enable);
|
||||
});
|
||||
PostMessage(Message::TYPE_BROADCAST,
|
||||
[enable](Processor & processor) { processor.EnableIndexingOfBookmarksDescriptions(enable); });
|
||||
}
|
||||
|
||||
void Engine::EnableIndexingOfBookmarkGroup(bookmarks::GroupId const & groupId, bool enable)
|
||||
{
|
||||
PostMessage(Message::TYPE_BROADCAST, [=](Processor & processor) {
|
||||
processor.EnableIndexingOfBookmarkGroup(groupId, enable);
|
||||
});
|
||||
PostMessage(Message::TYPE_BROADCAST,
|
||||
[=](Processor & processor) { processor.EnableIndexingOfBookmarkGroup(groupId, enable); });
|
||||
}
|
||||
|
||||
void Engine::ResetBookmarks()
|
||||
{
|
||||
PostMessage(Message::TYPE_BROADCAST, [](Processor & processor) {
|
||||
processor.ResetBookmarks();
|
||||
});
|
||||
PostMessage(Message::TYPE_BROADCAST, [](Processor & processor) { processor.ResetBookmarks(); });
|
||||
}
|
||||
|
||||
void Engine::OnBookmarksCreated(vector<pair<bookmarks::Id, bookmarks::Doc>> const & marks)
|
||||
{
|
||||
PostMessage(Message::TYPE_BROADCAST,
|
||||
[marks](Processor & processor) { processor.OnBookmarksCreated(marks); });
|
||||
PostMessage(Message::TYPE_BROADCAST, [marks](Processor & processor) { processor.OnBookmarksCreated(marks); });
|
||||
}
|
||||
|
||||
void Engine::OnBookmarksUpdated(vector<pair<bookmarks::Id, bookmarks::Doc>> const & marks)
|
||||
{
|
||||
PostMessage(Message::TYPE_BROADCAST,
|
||||
[marks](Processor & processor) { processor.OnBookmarksUpdated(marks); });
|
||||
PostMessage(Message::TYPE_BROADCAST, [marks](Processor & processor) { processor.OnBookmarksUpdated(marks); });
|
||||
}
|
||||
|
||||
void Engine::OnBookmarksDeleted(vector<bookmarks::Id> const & marks)
|
||||
{
|
||||
PostMessage(Message::TYPE_BROADCAST, [marks](Processor & processor) { processor.OnBookmarksDeleted(marks); });
|
||||
}
|
||||
|
||||
void Engine::OnBookmarksAttachedToGroup(bookmarks::GroupId const & groupId, vector<bookmarks::Id> const & marks)
|
||||
{
|
||||
PostMessage(Message::TYPE_BROADCAST,
|
||||
[marks](Processor & processor) { processor.OnBookmarksDeleted(marks); });
|
||||
[groupId, marks](Processor & processor) { processor.OnBookmarksAttachedToGroup(groupId, marks); });
|
||||
}
|
||||
|
||||
void Engine::OnBookmarksAttachedToGroup(bookmarks::GroupId const & groupId,
|
||||
vector<bookmarks::Id> const & marks)
|
||||
void Engine::OnBookmarksDetachedFromGroup(bookmarks::GroupId const & groupId, vector<bookmarks::Id> const & marks)
|
||||
{
|
||||
PostMessage(Message::TYPE_BROADCAST, [groupId, marks](Processor & processor) {
|
||||
processor.OnBookmarksAttachedToGroup(groupId, marks);
|
||||
});
|
||||
}
|
||||
|
||||
void Engine::OnBookmarksDetachedFromGroup(bookmarks::GroupId const & groupId,
|
||||
vector<bookmarks::Id> const & marks)
|
||||
{
|
||||
PostMessage(Message::TYPE_BROADCAST, [groupId, marks](Processor & processor) {
|
||||
processor.OnBookmarksDetachedFromGroup(groupId, marks);
|
||||
});
|
||||
PostMessage(Message::TYPE_BROADCAST,
|
||||
[groupId, marks](Processor & processor) { processor.OnBookmarksDetachedFromGroup(groupId, marks); });
|
||||
}
|
||||
|
||||
void Engine::MainLoop(Context & context)
|
||||
@@ -222,10 +205,7 @@ void Engine::MainLoop(Context & context)
|
||||
|
||||
{
|
||||
unique_lock<mutex> lock(m_mu);
|
||||
m_cv.wait(lock, [&]()
|
||||
{
|
||||
return m_shutdown || !m_messages.empty() || !context.m_messages.empty();
|
||||
});
|
||||
m_cv.wait(lock, [&]() { return m_shutdown || !m_messages.empty() || !context.m_messages.empty(); });
|
||||
|
||||
if (m_shutdown)
|
||||
break;
|
||||
@@ -283,10 +263,7 @@ void Engine::DoSearch(SearchParams params, shared_ptr<ProcessorHandle> handle, P
|
||||
{
|
||||
LOG(LINFO, ("Search started:", params.m_mode, params.m_viewport));
|
||||
base::Timer timer;
|
||||
SCOPE_GUARD(printDuration, [&timer]()
|
||||
{
|
||||
LOG(LINFO, ("Search ended in", timer.ElapsedMilliseconds(), "ms."));
|
||||
});
|
||||
SCOPE_GUARD(printDuration, [&timer]() { LOG(LINFO, ("Search ended in", timer.ElapsedMilliseconds(), "ms.")); });
|
||||
|
||||
processor.Reset();
|
||||
handle->Attach(processor);
|
||||
|
||||
Reference in New Issue
Block a user