1 |
douglas |
552 |
// By |
2 |
|
|
// |
3 |
|
|
// Douglas Thrift |
4 |
|
|
// |
5 |
|
|
// $Id$ |
6 |
|
|
|
7 |
douglas |
560 |
#include <cxx/standard.hh> |
8 |
douglas |
552 |
|
9 |
|
|
#include "By.hpp" |
10 |
|
|
|
11 |
|
|
By::By(const cse::String& name) : by(LAST) |
12 |
|
|
{ |
13 |
|
|
if (name == _B("artist")) |
14 |
|
|
by = ARTIST; |
15 |
|
|
else if (name == _B("title")) |
16 |
|
|
by = TITLE; |
17 |
|
|
else if (name == _B("album")) |
18 |
|
|
by = ALBUM; |
19 |
|
|
else if (name == _B("genre")) |
20 |
|
|
by = GENRE; |
21 |
|
|
} |
22 |
|
|
|
23 |
|
|
cse::String By::GetName() const |
24 |
|
|
{ |
25 |
|
|
switch (by) |
26 |
|
|
{ |
27 |
|
|
case ARTIST: |
28 |
|
|
return _B("Artist"); |
29 |
|
|
case TITLE: |
30 |
|
|
return _B("Song Title"); |
31 |
|
|
case ALBUM: |
32 |
|
|
return _B("Album"); |
33 |
|
|
case GENRE: |
34 |
|
|
return _B("Genre"); |
35 |
|
|
default: |
36 |
|
|
return cse::EmptyString; |
37 |
|
|
} |
38 |
|
|
} |
39 |
|
|
|
40 |
|
|
ios::PrintWriter& operator<<(ios::PrintWriter& out, const By& by) |
41 |
|
|
{ |
42 |
|
|
switch (by.by) |
43 |
|
|
{ |
44 |
|
|
case By::ARTIST: |
45 |
|
|
return out << _B("artist"); |
46 |
|
|
case By::TITLE: |
47 |
|
|
return out << _B("title"); |
48 |
|
|
case By::ALBUM: |
49 |
|
|
return out << _B("album"); |
50 |
|
|
case By::GENRE: |
51 |
|
|
return out << _B("genre"); |
52 |
|
|
default: |
53 |
|
|
return out; |
54 |
|
|
} |
55 |
|
|
} |