FlightGear next
TranslationDomain.cxx
Go to the documentation of this file.
1// SPDX-FileCopyrightText: 2025 Florent Rougon
2// SPDX-License-Identifier: GPL-2.0-or-later
3
8
9#include <memory>
10#include <string>
11
12#include <simgear/debug/logstream.hxx>
13
14#include "TranslationDomain.hxx"
15
16namespace flightgear
17{
18
20TranslationDomain::getOrCreateResource(const std::string& resourceName)
21{
22 auto& resourcePtr = _map[resourceName];
23
24 if (!resourcePtr) {
25 resourcePtr = std::make_shared<TranslationResource>(resourceName);
26 }
27
28 return resourcePtr;
29}
30
32TranslationDomain::getResource(const std::string& resourceName) const
33{
34 auto elt = _map.find(resourceName);
35
36 if (elt == _map.end()) {
37 SG_LOG(SG_GENERAL, SG_ALERT,
38 "TranslationDomain::getResource(): unable to find requested "
39 "resource '" << resourceName << "'.");
40 return {};
41 } else {
42 return elt->second;
43 }
44}
45
46} // namespace flightgear
Container for all TranslationResource's belonging to a domain.
ResourceRef getOrCreateResource(const std::string &resourceName)
Get the specified TranslationResource instance.
std::shared_ptr< TranslationResource > ResourceRef
ResourceRef getResource(const std::string &resourceName) const
Get the specified TranslationResource instance.
FlightPlan.hxx - defines a full flight-plan object, including departure, cruise, arrival information ...
Definition Addon.cxx:53