Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
videolan
vlc
Commits
0fb4941e
Commit
0fb4941e
authored
Nov 22, 2009
by
JP Dinger
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Skins2: Reduce another macro to bare minimum and helper fuction.
parent
f500f796
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
13 deletions
+18
-13
modules/gui/skins2/parser/builder.cpp
modules/gui/skins2/parser/builder.cpp
+14
-13
modules/gui/skins2/parser/builder.hpp
modules/gui/skins2/parser/builder.hpp
+4
-0
No files found.
modules/gui/skins2/parser/builder.cpp
View file @
0fb4941e
...
...
@@ -75,24 +75,23 @@ CmdGeneric *Builder::parseAction( const string &rAction )
return
Interpreter
::
instance
(
getIntf
()
)
->
parseAction
(
rAction
,
m_pTheme
);
}
// Useful macro
#define ADD_OBJECTS( type ) \
list<BuilderData::type>::const_iterator it##type; \
for( it##type = m_rData.m_list##type.begin(); \
it##type != m_rData.m_list##type.end(); it##type++ ) \
{ \
add##type( *it##type ); \
}
template
<
class
T
>
inline
void
Builder
::
add_objects
(
const
std
::
list
<
T
>
&
list
,
void
(
Builder
::*
addfn
)(
const
T
&
))
{
typename
std
::
list
<
T
>::
const_iterator
i
;
for
(
i
=
list
.
begin
();
i
!=
list
.
end
();
++
i
)
(
this
->*
addfn
)(
*
i
);
}
Theme
*
Builder
::
build
()
{
m_pTheme
=
new
Theme
(
getIntf
()
);
#define ADD_OBJECTS( type ) \
add_objects(m_rData.m_list##type,&Builder::add##type)
m_pTheme
=
new
(
std
::
nothrow
)
Theme
(
getIntf
()
);
if
(
m_pTheme
==
NULL
)
{
return
NULL
;
}
// Create everything from the data in the XML
ADD_OBJECTS
(
Theme
);
...
...
@@ -123,6 +122,8 @@ Theme *Builder::build()
ADD_OBJECTS
(
MenuSeparator
);
return
m_pTheme
;
#undef ADD_OBJECTS
}
...
...
modules/gui/skins2/parser/builder.hpp
View file @
0fb4941e
...
...
@@ -91,6 +91,10 @@ private:
void
addTree
(
const
BuilderData
::
Tree
&
rData
);
void
addVideo
(
const
BuilderData
::
Video
&
rData
);
/// Helper for build(); gluing BuilderData::list<T>s to addType(T&)
template
<
class
T
>
void
add_objects
(
const
std
::
list
<
T
>
&
list
,
void
(
Builder
::*
addfn
)(
const
T
&
));
/// Compute the position of a control
const
Position
makePosition
(
const
string
&
rLeftTop
,
const
string
&
rRightBottom
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a 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