Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
VideoLAN
VLMC
Commits
f9efa913
Commit
f9efa913
authored
Dec 29, 2009
by
Vincent Carrubba
Browse files
Adding SimpleObjectsReferencer to avoid gore code in EffectNode.cpp, concerning the connected slots
parent
34817589
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/EffectsEngine/SimpleObjectsReferencer.hpp
0 → 100644
View file @
f9efa913
/*****************************************************************************
* SimpleObjectsReferencer.h: Template class use to store obj reference
* ( not cpp refs, in internal it's pointers).
*****************************************************************************
* Copyright (C) 2008-2009 the VLMC team
*
* Authors: Vincent Carrubba <cyberbouba@gmail.com>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#ifndef SIMPLEOBJECTSREFERENCER_H_
#define SIMPLEOBJECTSREFERENCER_H_
#include
<QtGlobal>
#include
<QMap>
template
<
typename
T
>
class
SimpleObjectsReferencer
{
public:
SimpleObjectsReferencer
()
{};
~
SimpleObjectsReferencer
()
{}
bool
addObjectReference
(
T
*
obj
,
quint32
objId
)
{
if
(
m_objRefs
.
find
(
objId
)
==
m_objRefs
.
end
()
)
{
m_objRefs
[
objId
]
=
obj
;
return
(
true
);
}
return
(
false
);
};
bool
delObjectReference
(
quint32
objId
)
{
QMap
<
quint32
,
T
*>::
iterator
it
=
m_objRefs
.
find
(
objId
);
if
(
it
!=
m_objRefs
.
end
()
)
{
m_objRefs
.
erase
(
it
);
return
(
true
);
}
return
(
false
);
};
quint32
getNBObjectsReferences
(
void
)
const
{
return
(
m_objRefs
.
size
()
);
};
QList
<
T
*>
getObjectsReferencesList
(
void
)
const
{
return
(
m_objRefs
.
values
()
);
};
private:
QMap
<
quint32
,
T
*>
m_objRefs
;
};
#endif // SIMPLEOBJECTSREFERENCER_H_
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment