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
 
SDLResourceManageroperator= (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 
)
staticprotected

Definition at line 56 of file sdl_resource_manager.cpp.

58{
59#if defined(SDL_USE_COMPILED_RESOURCES)
60 std::string uuid = type + "/" + id;
61 auto val = resources().find(uuid);
62 if (val == resources().end())
63 return nullptr;
64
65 return &val->second;
66#else
67 return nullptr;
68#endif
69}

◆ filename()

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

Definition at line 71 of file sdl_resource_manager.cpp.

73{
74#if defined(SDL_RESOURCE_ROOT)
75 std::string uuid = type + "/" + id;
76 fs::path path(SDL_RESOURCE_ROOT);
77 path /= type;
78 path /= id;
79
80 if (!fs::exists(path))
81 {
82 std::cerr << "sdl-freerdp expects resource '" << uuid << "' at location "
83 << fs::absolute(path) << std::endl;
84 std::cerr << "file not found, application will fail" << std::endl;
85 return "";
86 }
87 return path.u8string();
88#else
89 return "";
90#endif
91}

◆ insert()

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

Definition at line 40 of file sdl_resource_manager.cpp.

42{
43 std::string uuid = type + "/" + id;
44 resources().emplace(uuid, data);
45}

◆ typeFonts()

std::string SDLResourceManager::typeFonts ( )
static

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 30 of file sdl_resource_manager.cpp.

31{
32 return "fonts";
33}

◆ typeImages()

std::string SDLResourceManager::typeImages ( )
static

Definition at line 35 of file sdl_resource_manager.cpp.

36{
37 return "images";
38}

◆ useCompiledResources()

bool SDLResourceManager::useCompiledResources ( )
staticprotected

Definition at line 47 of file sdl_resource_manager.cpp.

48{
49#if defined(SDL_USE_COMPILED_RESOURCES)
50 return true;
51#else
52 return false;
53#endif
54}

Friends And Related Symbol Documentation

◆ 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: