Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
G
Game Library
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Terraform modules
Monitor
Service Desk
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Onuralp SEZER
Game Library
Commits
2cb7b057
Commit
2cb7b057
authored
2 years ago
by
Joseph Walton-Rivers
Browse files
Options
Downloads
Patches
Plain Diff
move type safe wrapper to util because it's useful
parent
00bcae2d
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
include/fggl/assets/manager.hpp
+37
-0
37 additions, 0 deletions
include/fggl/assets/manager.hpp
include/fggl/modules/module.hpp
+3
-17
3 additions, 17 deletions
include/fggl/modules/module.hpp
include/fggl/util/safety.hpp
+51
-0
51 additions, 0 deletions
include/fggl/util/safety.hpp
with
91 additions
and
17 deletions
include/fggl/assets/manager.hpp
0 → 100644
+
37
−
0
View file @
2cb7b057
/*
* This file is part of FGGL.
*
* FGGL is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any
* later version.
*
* FGGL is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License along with FGGL.
* If not, see <https://www.gnu.org/licenses/>.
*/
//
// Created by webpigeon on 27/06/22.
//
#ifndef FGGL_ASSETS_MANAGER_HPP
#define FGGL_ASSETS_MANAGER_HPP
#include
<string_view>
#include
"fggl/util/safety.hpp"
namespace
fggl
::
assets
{
struct
AssetTag
{};
using
AssetType
=
util
::
OpaqueName
<
std
::
string_view
,
AssetTag
>
;
class
Manager
{
public:
};
}
// namespace fggl::assets
#endif //FGGL_ASSETS_MANAGER_HPP
This diff is collapsed.
Click to expand it.
include/fggl/modules/module.hpp
+
3
−
17
View file @
2cb7b057
...
...
@@ -24,30 +24,16 @@
#include
<functional>
#include
<map>
#include
<memory>
#include
"fggl/util/safety.hpp"
namespace
fggl
::
modules
{
using
ModuleIdentifier
=
std
::
string
;
struct
ModuleService
{
private:
std
::
string_view
value
;
public:
constexpr
ModuleService
(
std
::
string_view
value
)
:
value
(
value
)
{}
constexpr
explicit
operator
std
::
string_view
()
const
{
return
value
;
}
bool
operator
==
(
const
ModuleService
&
other
)
const
{
return
value
==
other
.
value
;
}
std
::
strong_ordering
operator
<=>
(
const
ModuleService
&
other
)
const
noexcept
{
return
value
<=>
other
.
value
;
}
};
using
ModuleService
=
util
::
OpaqueName
<
std
::
string_view
,
struct
ModuleServiceTag
>
;
constexpr
ModuleService
make_service
(
const
std
::
string_view
name
)
{
return
{
name
}
;
return
ModuleService
::
make
(
name
)
;
}
class
Services
{
...
...
This diff is collapsed.
Click to expand it.
include/fggl/util/safety.hpp
0 → 100644
+
51
−
0
View file @
2cb7b057
/*
* This file is part of FGGL.
*
* FGGL is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any
* later version.
*
* FGGL is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License along with FGGL.
* If not, see <https://www.gnu.org/licenses/>.
*/
//
// Created by webpigeon on 27/06/22.
//
#ifndef FGGL_UTIL_SAFETY_H
#define FGGL_UTIL_SAFETY_H
#include
<string>
namespace
fggl
::
util
{
template
<
typename
T
,
typename
Tag
>
struct
OpaqueName
{
private:
T
m_value
;
public:
constexpr
OpaqueName
(
T
value
)
:
m_value
(
value
)
{}
constexpr
explicit
operator
std
::
string_view
()
const
{
return
m_value
;
}
bool
operator
==
(
const
OpaqueName
<
T
,
Tag
>
&
other
)
const
{
return
m_value
==
other
.
m_value
;
}
std
::
strong_ordering
operator
<=>
(
const
OpaqueName
<
T
,
Tag
>
&
other
)
const
noexcept
{
return
m_value
<=>
other
.
m_value
;
}
constexpr
static
OpaqueName
<
T
,
Tag
>
make
(
T
value
)
{
return
OpaqueName
(
value
);
}
};
}
// namespace fggl::util
#endif //FGGL_UTIL_SAFETY_H
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment