Mercurial > foo_out_sdl
comparison foosdk/sdk/foobar2000/SDK/playable_location.cpp @ 1:20d02a178406 default tip
*: check in everything else
yay
| author | Paper <paper@tflc.us> |
|---|---|
| date | Mon, 05 Jan 2026 02:15:46 -0500 |
| parents | |
| children |
comparison
equal
deleted
inserted
replaced
| 0:e9bb126753e7 | 1:20d02a178406 |
|---|---|
| 1 #include "foobar2000-sdk-pch.h" | |
| 2 | |
| 3 int playable_location::g_compare(const playable_location & p_item1,const playable_location & p_item2) { | |
| 4 int ret = metadb::path_compare(p_item1.get_path(),p_item2.get_path()); | |
| 5 if (ret != 0) return ret; | |
| 6 return pfc::compare_t(p_item1.get_subsong(),p_item2.get_subsong()); | |
| 7 } | |
| 8 int playable_location::path_compare( const char * p1, const char * p2 ) { | |
| 9 return metadb::path_compare(p1, p2); | |
| 10 } | |
| 11 | |
| 12 bool playable_location::g_equals( const playable_location & p_item1, const playable_location & p_item2) { | |
| 13 return g_compare(p_item1, p_item2) == 0; | |
| 14 } | |
| 15 | |
| 16 pfc::string_base & operator<<(pfc::string_base & p_fmt,const playable_location & p_location) | |
| 17 { | |
| 18 p_fmt << "\"" << file_path_display(p_location.get_path()) << "\""; | |
| 19 t_uint32 index = p_location.get_subsong_index(); | |
| 20 if (index != 0) p_fmt << " / index: " << p_location.get_subsong_index(); | |
| 21 return p_fmt; | |
| 22 } | |
| 23 | |
| 24 | |
| 25 bool playable_location::operator==(const playable_location & p_other) const { | |
| 26 return metadb::path_compare(get_path(),p_other.get_path()) == 0 && get_subsong() == p_other.get_subsong(); | |
| 27 } | |
| 28 bool playable_location::operator!=(const playable_location & p_other) const { | |
| 29 return !(*this == p_other); | |
| 30 } | |
| 31 | |
| 32 void playable_location::reset() { | |
| 33 set_path("");set_subsong(0); | |
| 34 } | |
| 35 | |
| 36 bool playable_location::is_empty() const { | |
| 37 return * get_path() == 0; | |
| 38 } | |
| 39 | |
| 40 bool playable_location::is_valid() const { | |
| 41 return !is_empty(); | |
| 42 } | |
| 43 | |
| 44 const char * playable_location_impl::get_path() const { | |
| 45 return m_path; | |
| 46 } | |
| 47 | |
| 48 void playable_location_impl::set_path(const char* p_path) { | |
| 49 m_path=p_path; | |
| 50 } | |
| 51 | |
| 52 t_uint32 playable_location_impl::get_subsong() const { | |
| 53 return m_subsong; | |
| 54 } | |
| 55 | |
| 56 void playable_location_impl::set_subsong(t_uint32 p_subsong) { | |
| 57 m_subsong=p_subsong; | |
| 58 } | |
| 59 | |
| 60 const playable_location_impl & playable_location_impl::operator=(const playable_location & src) { | |
| 61 copy(src);return *this; | |
| 62 } | |
| 63 | |
| 64 playable_location_impl::playable_location_impl() : m_subsong(0) {} | |
| 65 playable_location_impl::playable_location_impl(const char * p_path,t_uint32 p_subsong) : m_path(p_path), m_subsong(p_subsong) {} | |
| 66 playable_location_impl::playable_location_impl(const playable_location & src) {copy(src);} | |
| 67 | |
| 68 | |
| 69 | |
| 70 void make_playable_location::set_path(const char*) {throw pfc::exception_not_implemented();} | |
| 71 void make_playable_location::set_subsong(t_uint32) {throw pfc::exception_not_implemented();} | |
| 72 | |
| 73 const char * make_playable_location::get_path() const {return path;} | |
| 74 t_uint32 make_playable_location::get_subsong() const {return num;} | |
| 75 | |
| 76 make_playable_location::make_playable_location(const char * p_path,t_uint32 p_num) : path(p_path), num(p_num) {} |
