1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-07-22 17:18:39 +00:00

Code modernization: subfolders (#6283)

* Code modernization: subfolders

Modernize various code on subfolders client, network, script, threading, unittests, util

* empty function
* default constructor/destructor
* for range-based loops
* use emplace_back instead of push_back
* C++ STL header style
* Make connection.cpp readable in a pointed place + typo
This commit is contained in:
Loïc Blot 2017-08-19 22:23:47 +02:00 committed by GitHub
parent 7528986e44
commit 88b436e6a9
49 changed files with 398 additions and 518 deletions

View file

@ -79,7 +79,7 @@ template<typename Key, typename Value>
class MutexedMap
{
public:
MutexedMap() {}
MutexedMap() = default;
void set(const Key &name, const Value &value)
{
@ -128,7 +128,8 @@ public:
template<typename Key, typename U, typename Caller, typename CallerData>
friend class RequestQueue;
MutexedQueue() {}
MutexedQueue() = default;
bool empty() const
{
MutexAutoLock lock(m_mutex);
@ -153,9 +154,9 @@ public:
T t = m_queue.front();
m_queue.pop_front();
return t;
} else {
return T();
}
return T();
}
T pop_front(u32 wait_time_max_ms)
@ -166,9 +167,9 @@ public:
T t = m_queue.front();
m_queue.pop_front();
return t;
} else {
throw ItemNotFoundException("MutexedQueue: queue is empty");
}
throw ItemNotFoundException("MutexedQueue: queue is empty");
}
T pop_frontNoEx()
@ -190,9 +191,9 @@ public:
T t = m_queue.back();
m_queue.pop_back();
return t;
} else {
throw ItemNotFoundException("MutexedQueue: queue is empty");
}
throw ItemNotFoundException("MutexedQueue: queue is empty");
}
/* this version of pop_back returns a empty element of T on timeout.
@ -206,9 +207,9 @@ public:
T t = m_queue.back();
m_queue.pop_back();
return t;
} else {
return T();
}
return T();
}
T pop_backNoEx()