Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mpd
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Иван Мажукин
mpd
Commits
231fffe5
Commit
231fffe5
authored
Nov 09, 2014
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
db/upnp/Directory: apply coding style
parent
e67afc35
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
23 deletions
+23
-23
Directory.cxx
src/db/plugins/upnp/Directory.cxx
+23
-23
No files found.
src/db/plugins/upnp/Directory.cxx
View file @
231fffe5
...
...
@@ -90,7 +90,7 @@ ParseDuration(const char *duration)
*/
gcc_pure
static
std
::
string
titleToPathEl
t
(
std
::
string
&&
s
)
TitleToPathSegmen
t
(
std
::
string
&&
s
)
{
std
::
replace
(
s
.
begin
(),
s
.
end
(),
'/'
,
'_'
);
return
s
;
...
...
@@ -100,7 +100,7 @@ titleToPathElt(std::string &&s)
* An XML parser which builds directory contents from DIDL lite input.
*/
class
UPnPDirParser
final
:
public
CommonExpatParser
{
UPnPDirContent
&
m_dir
;
UPnPDirContent
&
directory
;
enum
{
NONE
,
...
...
@@ -120,22 +120,22 @@ class UPnPDirParser final : public CommonExpatParser {
*/
std
::
string
value
;
UPnPDirObject
m_tobj
;
UPnPDirObject
object
;
TagBuilder
tag
;
public
:
UPnPDirParser
(
UPnPDirContent
&
dir
)
:
m_dir
(
dir
),
UPnPDirParser
(
UPnPDirContent
&
_directory
)
:
directory
(
_directory
),
state
(
NONE
),
tag_type
(
TAG_NUM_OF_ITEM_TYPES
)
{
m_tobj
.
Clear
();
object
.
Clear
();
}
protected
:
virtual
void
StartElement
(
const
XML_Char
*
name
,
const
XML_Char
**
attrs
)
{
if
(
m_tobj
.
type
!=
UPnPDirObject
::
Type
::
UNKNOWN
&&
if
(
object
.
type
!=
UPnPDirObject
::
Type
::
UNKNOWN
&&
tag_type
==
TAG_NUM_OF_ITEM_TYPES
)
{
tag_type
=
tag_table_lookup
(
upnp_tags
,
name
);
if
(
tag_type
!=
TAG_NUM_OF_ITEM_TYPES
)
...
...
@@ -147,31 +147,31 @@ protected:
switch
(
name
[
0
])
{
case
'c'
:
if
(
!
strcmp
(
name
,
"container"
))
{
m_tobj
.
Clear
();
m_tobj
.
type
=
UPnPDirObject
::
Type
::
CONTAINER
;
object
.
Clear
();
object
.
type
=
UPnPDirObject
::
Type
::
CONTAINER
;
const
char
*
id
=
GetAttribute
(
attrs
,
"id"
);
if
(
id
!=
nullptr
)
m_tobj
.
id
=
id
;
object
.
id
=
id
;
const
char
*
pid
=
GetAttribute
(
attrs
,
"parentID"
);
if
(
pid
!=
nullptr
)
m_tobj
.
parent_id
=
pid
;
object
.
parent_id
=
pid
;
}
break
;
case
'i'
:
if
(
!
strcmp
(
name
,
"item"
))
{
m_tobj
.
Clear
();
m_tobj
.
type
=
UPnPDirObject
::
Type
::
ITEM
;
object
.
Clear
();
object
.
type
=
UPnPDirObject
::
Type
::
ITEM
;
const
char
*
id
=
GetAttribute
(
attrs
,
"id"
);
if
(
id
!=
nullptr
)
m_tobj
.
id
=
id
;
object
.
id
=
id
;
const
char
*
pid
=
GetAttribute
(
attrs
,
"parentID"
);
if
(
pid
!=
nullptr
)
m_tobj
.
parent_id
=
pid
;
object
.
parent_id
=
pid
;
}
break
;
...
...
@@ -200,12 +200,12 @@ protected:
virtual
void
EndElement
(
const
XML_Char
*
name
)
{
if
(
tag_type
!=
TAG_NUM_OF_ITEM_TYPES
)
{
assert
(
m_tobj
.
type
!=
UPnPDirObject
::
Type
::
UNKNOWN
);
assert
(
object
.
type
!=
UPnPDirObject
::
Type
::
UNKNOWN
);
tag
.
AddItem
(
tag_type
,
value
.
c_str
());
if
(
tag_type
==
TAG_TITLE
)
m_tobj
.
name
=
titleToPathEl
t
(
std
::
move
(
value
));
object
.
name
=
TitleToPathSegmen
t
(
std
::
move
(
value
));
value
.
clear
();
tag_type
=
TAG_NUM_OF_ITEM_TYPES
;
...
...
@@ -213,9 +213,9 @@ protected:
}
if
((
!
strcmp
(
name
,
"container"
)
||
!
strcmp
(
name
,
"item"
))
&&
m_tobj
.
Check
())
{
tag
.
Commit
(
m_tobj
.
tag
);
m_dir
.
objects
.
emplace_back
(
std
::
move
(
m_tobj
));
object
.
Check
())
{
tag
.
Commit
(
object
.
tag
);
directory
.
objects
.
emplace_back
(
std
::
move
(
object
));
}
state
=
NONE
;
...
...
@@ -224,7 +224,7 @@ protected:
virtual
void
CharacterData
(
const
XML_Char
*
s
,
int
len
)
{
if
(
tag_type
!=
TAG_NUM_OF_ITEM_TYPES
)
{
assert
(
m_tobj
.
type
!=
UPnPDirObject
::
Type
::
UNKNOWN
);
assert
(
object
.
type
!=
UPnPDirObject
::
Type
::
UNKNOWN
);
value
.
append
(
s
,
len
);
return
;
...
...
@@ -235,11 +235,11 @@ protected:
break
;
case
RES
:
m_tobj
.
url
.
assign
(
s
,
len
);
object
.
url
.
assign
(
s
,
len
);
break
;
case
CLASS
:
m_tobj
.
item_class
=
ParseItemClass
(
s
,
len
);
object
.
item_class
=
ParseItemClass
(
s
,
len
);
break
;
}
}
...
...
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