Coverage Report

Created: 2026-11-14 03:38

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/nix/store/rr0r40cw3mzzbz0sxrnkvnrjpzb82wpc-j27cjzgh5nmq3y8k6hwa6zpi3qgcjia8-source/src/controllers/controllermanager.cc
Line
Count
Source
1
#include "controllers/controllermanager.h"
2
3
#include <memory>
4
#include <string>
5
#include <unordered_map>
6
#include <utility>
7
#include <vector>
8
9
namespace mahjong {
10
class PlayerController;
11
12
0
std::vector<std::string> ControllerManager::GetAvailableControllers() {
13
0
  std::vector<std::string> names;
14
0
  names.reserve(available_controllers_.size());
15
0
  for (const auto& [name, _] : available_controllers_) {
16
0
    names.push_back(name);
17
0
  }
18
0
  return names;
19
0
}
20
21
std::unique_ptr<mahjong::PlayerController> ControllerManager::NewController(
22
0
    const std::string& controller) {
23
0
  if (available_controllers_.contains(controller)) {
24
0
    return available_controllers_[controller]();
25
0
  }
26
0
  throw "No Such Controller";
27
0
}
28
29
bool ControllerManager::RegisterController(newControllerInst newFunc,
30
1.03k
                                           const std::string& name) {
31
1.03k
  if (available_controllers_.contains(name)) {
32
0
    return false;
33
0
  }
34
1.03k
  available_controllers_[name] = std::move(newFunc);
35
1.03k
  return true;
36
1.03k
}
37
38
}  // namespace mahjong