Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
smartpointer-ost-solution
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
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
cpp-course-day-3
smartpointer-ost-solution
Commits
2ee5d533
Commit
2ee5d533
authored
1 year ago
by
Christian Werner
Browse files
Options
Downloads
Patches
Plain Diff
update: optimize for size
parent
a997bc00
No related branches found
No related tags found
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
ButtonEvent.cpp
+0
-15
0 additions, 15 deletions
ButtonEvent.cpp
ButtonEvent.h
+9
-3
9 additions, 3 deletions
ButtonEvent.h
ButtonEventDispatcher.cpp
+0
-4
0 additions, 4 deletions
ButtonEventDispatcher.cpp
ButtonEventDispatcher.h
+4
-1
4 additions, 1 deletion
ButtonEventDispatcher.h
with
13 additions
and
23 deletions
ButtonEvent.cpp
deleted
100644 → 0
+
0
−
15
View file @
a997bc00
#pragma once
#include
"ButtonEvent.h"
ButtonEvent
::
ButtonEvent
(
press_t
type
,
button_t
source
)
{
typeId
=
type
;
sourceId
=
source
;
}
ButtonEvent
::
press_t
ButtonEvent
::
getType
()
const
{
return
typeId
;
}
ButtonEvent
::
button_t
ButtonEvent
::
getSource
()
const
{
return
sourceId
;
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
ButtonEvent.h
+
9
−
3
View file @
2ee5d533
...
...
@@ -5,10 +5,16 @@ class ButtonEvent {
enum
press_t
{
shortPress
,
longPress
,
veryLongPress
};
enum
button_t
{
button1
,
button2
};
ButtonEvent
(
press_t
type
=
shortPress
,
button_t
source
=
button1
);
ButtonEvent
(
press_t
type
=
shortPress
,
button_t
source
=
button1
)
// inline constructor an use initilizer list (-8 bytes in .text)
:
typeId
{
type
},
sourceId
{
source
}
{}
press_t
getType
()
const
;
button_t
getSource
()
const
;
press_t
getType
()
const
{
// inline (con change)
return
typeId
;
}
button_t
getSource
()
const
{
// inline (no change)
return
sourceId
;
}
private
:
press_t
typeId
;
...
...
This diff is collapsed.
Click to expand it.
ButtonEventDispatcher.cpp
+
0
−
4
View file @
2ee5d533
...
...
@@ -7,10 +7,6 @@
#include
"ButtonEventDispatcher.h"
ButtonEventDispatcher
::
ButtonEventDispatcher
()
:
callbackFuncPtr
{}
{}
void
ButtonEventDispatcher
::
Dispatch
(
const
ButtonEvent
&
e
)
const
{
for
(
size_t
i
=
0
;
i
<
capacity
;
i
++
)
{
if
(
callbackFuncPtr
[
i
])
callbackFuncPtr
[
i
](
e
);
...
...
This diff is collapsed.
Click to expand it.
ButtonEventDispatcher.h
+
4
−
1
View file @
2ee5d533
...
...
@@ -11,7 +11,10 @@ private:
public:
typedef
void
(
*
callbackPtr_t
)(
const
ButtonEvent
&
e
);
ButtonEventDispatcher
();
ButtonEventDispatcher
()
// inline ctor (-8 bytes in .text)
:
callbackFuncPtr
{}
{}
void
Dispatch
(
const
ButtonEvent
&
e
)
const
;
void
RegisterButtonHandler
(
callbackPtr_t
cb
);
void
UnregisterButtonHandler
(
callbackPtr_t
cb
);
...
...
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