FreeRDP
Loading...
Searching...
No Matches
SDLResourceManager Class Reference

#include <sdl_resource_manager.hpp>

Inheritance diagram for SDLResourceManager:

Public Member Functions

 SDLResourceManager (const SDLResourceManager &other)=delete
 SDLResourceManager (const SDLResourceManager &&other)=delete
SDLResourceManager operator= (const SDLResourceManager &other)=delete
SDLResourceManager & operator= (SDLResourceManager &&other)=delete

Static Public Member Functions

static std::string typeFonts ()
static std::string typeImages ()

Static Protected Member Functions

static void insert (const std::string &type, const std::string &id, const std::vector< unsigned char > &data)
static const std::vector< unsigned char > * data (const std::string &type, const std::string &id)
static std::string filename (const std::string &type, const std::string &id)
static bool useCompiledResources ()

Friends

class SDLResourceFile

Detailed Description

FreeRDP: A Remote Desktop Protocol Implementation

Copyright 2023 Armin Novak armin.nosp@m..nov.nosp@m.ak@th.nosp@m.inca.nosp@m.st.co.nosp@m.m

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Definition at line 24 of file sdl_resource_manager.hpp.

Member Function Documentation

◆ data()

const std::vector< unsigned char > * SDLResourceManager::data ( const std::string & type,
const std::string & id )
staticnodiscardprotected

Definition at line 48 of file sdl_resource_manager.cpp.

50{
51#if defined(SDL_USE_COMPILED_RESOURCES)
52 std::string uuid = type + "/" + id;
53 auto val = resources().find(uuid);
54 if (val == resources().end())
55 return nullptr;
56
57 return &val->second;
58#else
59 return nullptr;
60#endif
61}

◆ filename()

std::string SDLResourceManager::filename ( const std::string & type,
const std::string & id )
staticnodiscardprotected

Definition at line 63 of file sdl_resource_manager.cpp.

65{
66#if defined(SDL_RESOURCE_ROOT)
67 std::string uuid = type + "/" + id;
68 fs::path path(SDL_RESOURCE_ROOT);
69 path /= type;
70 path /= id;
71
72 if (!fs::exists(path))
73 {
74 std::cerr << "sdl-freerdp expects resource '" << uuid << "' at location "
75 << fs::absolute(path) << std::endl;
76 std::cerr << "file not found, application will fail" << std::endl;
77 return "";
78 }
79 return path.u8string();
80#else
81 return "";
82#endif
83}

◆ insert()

void SDLResourceManager::insert ( const std::string & type,
const std::string & id,
const std::vector< unsigned char > & data )
staticprotected

Definition at line 32 of file sdl_resource_manager.cpp.

34{
35 std::string uuid = type + "/" + id;
36 resources().emplace(uuid, data);
37}

◆ typeFonts()

std::string SDLResourceManager::typeFonts ( )
staticnodiscard

FreeRDP: A Remote Desktop Protocol Implementation

Copyright 2023 Armin Novak armin.nosp@m..nov.nosp@m.ak@th.nosp@m.inca.nosp@m.st.co.nosp@m.m

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Definition at line 22 of file sdl_resource_manager.cpp.

23{
24 return "fonts";
25}

◆ typeImages()

std::string SDLResourceManager::typeImages ( )
staticnodiscard

Definition at line 27 of file sdl_resource_manager.cpp.

28{
29 return "images";
30}

◆ useCompiledResources()

bool SDLResourceManager::useCompiledResources ( )
staticnodiscardprotected

Definition at line 39 of file sdl_resource_manager.cpp.

40{
41#if defined(SDL_USE_COMPILED_RESOURCES)
42 return true;
43#else
44 return false;
45#endif
46}

◆ SDLResourceFile

friend class SDLResourceFile
friend

Definition at line 26 of file sdl_resource_manager.hpp.


The documentation for this class was generated from the following files: