From 7468b8d3744fe85a0c65a8a6761d60de9234556c Mon Sep 17 00:00:00 2001 From: casey Date: Tue, 3 May 2016 23:58:13 -0700 Subject: [PATCH] Moved remaining core files to their new homes. --- src/contrib/taglib_plugin/TagReaderTaglib.h | 2 +- src/core/Crypt.cpp | 95 ------ src/core/Crypt.h | 56 ---- src/core/Image.cpp | 50 ---- src/core/Image.h | 61 ---- src/core/MessageQueue.cpp | 93 ------ src/core/MessageQueue.h | 81 ----- src/core/MetaKey.cpp | 62 ---- src/core/MetaKey.h | 66 ----- src/core/Server.cpp | 277 ------------------ src/core/Server.h | 135 --------- src/core/audio/Player.cpp | 2 +- src/core/audio/Stream.cpp | 2 +- src/core/core.vcxproj | 78 +++-- src/core/core.vcxproj.filters | 226 +++++++------- src/core/io/DataStreamFactory.cpp | 2 +- src/core/io/LocalFileStream.cpp | 2 +- src/core/{ => library}/Indexer.cpp | 8 +- src/core/{ => library}/Indexer.h | 2 +- src/core/library/LibraryBase.cpp | 4 +- src/core/{ => library}/LibraryFactory.cpp | 8 +- src/core/{ => library}/LibraryFactory.h | 0 src/core/library/LocalLibrary.cpp | 4 +- src/core/library/LocalLibrary.h | 4 +- .../{ => library/metadata}/MetadataValue.cpp | 2 +- .../{ => library/metadata}/MetadataValue.h | 5 +- .../library/query/LibraryTrackListQuery.cpp | 2 +- .../library/query/LibraryTrackListQuery.h | 2 - src/core/library/query/ListQueryBase.cpp | 4 +- src/core/library/query/ListQueryBase.h | 4 +- .../query/MultiLibraryTrackListQuery.cpp | 6 +- src/core/library/query/QueryBase.cpp | 2 +- .../library/query/SortTracksWithDataQuery.cpp | 4 +- .../library/query/SortTracksWithDataQuery.h | 2 +- src/core/library/query/TrackListQueryBase.h | 2 +- src/core/library/query/TrackMetadataQuery.cpp | 4 +- src/core/library/query/TrackMetadataQuery.h | 2 +- src/core/{ => library/track}/GenericTrack.cpp | 4 +- src/core/{ => library/track}/GenericTrack.h | 2 +- src/core/{ => library/track}/IndexerTrack.cpp | 4 +- src/core/{ => library/track}/IndexerTrack.h | 2 +- src/core/{ => library/track}/LibraryTrack.cpp | 6 +- src/core/{ => library/track}/LibraryTrack.h | 2 +- src/core/{ => library/track}/Track.cpp | 2 +- src/core/{ => library/track}/Track.h | 0 src/core/{ => library/track}/TrackFactory.cpp | 6 +- src/core/{ => library/track}/TrackFactory.h | 2 +- .../{ => playback}/NonLibraryTrackHelper.cpp | 4 +- .../{ => playback}/NonLibraryTrackHelper.h | 2 +- src/core/{ => playback}/PlaybackQueue.cpp | 6 +- src/core/{ => playback}/PlaybackQueue.h | 2 +- src/core/{audio => playback}/Transport.cpp | 2 +- src/core/{audio => playback}/Transport.h | 0 src/core/{ => plugin}/PluginFactory.cpp | 6 +- src/core/{ => plugin}/PluginFactory.h | 0 src/core/{ => support}/Common.cpp | 2 +- src/core/{ => support}/Common.h | 0 src/core/{ => support}/Preferences.cpp | 4 +- src/core/{ => support}/Preferences.h | 0 src/core/{ => support}/ThreadHelper.cpp | 2 +- src/core/{ => support}/ThreadHelper.h | 0 src/core/{ => support}/Version.cpp | 50 ++-- src/core/{ => support}/Version.h | 23 +- src/square/ConsoleUI.cpp | 8 +- src/square/ConsoleUI.h | 2 +- 65 files changed, 253 insertions(+), 1251 deletions(-) delete mode 100644 src/core/Crypt.cpp delete mode 100644 src/core/Crypt.h delete mode 100644 src/core/Image.cpp delete mode 100644 src/core/Image.h delete mode 100644 src/core/MessageQueue.cpp delete mode 100644 src/core/MessageQueue.h delete mode 100644 src/core/MetaKey.cpp delete mode 100644 src/core/MetaKey.h delete mode 100644 src/core/Server.cpp delete mode 100644 src/core/Server.h rename src/core/{ => library}/Indexer.cpp (96%) rename src/core/{ => library}/Indexer.h (96%) rename src/core/{ => library}/LibraryFactory.cpp (94%) rename src/core/{ => library}/LibraryFactory.h (100%) rename src/core/{ => library/metadata}/MetadataValue.cpp (95%) rename src/core/{ => library/metadata}/MetadataValue.h (94%) rename src/core/{ => library/track}/GenericTrack.cpp (94%) rename src/core/{ => library/track}/GenericTrack.h (96%) rename src/core/{ => library/track}/IndexerTrack.cpp (96%) rename src/core/{ => library/track}/IndexerTrack.h (96%) rename src/core/{ => library/track}/LibraryTrack.cpp (95%) rename src/core/{ => library/track}/LibraryTrack.h (96%) rename src/core/{ => library/track}/Track.cpp (95%) rename src/core/{ => library/track}/Track.h (100%) rename src/core/{ => library/track}/TrackFactory.cpp (92%) rename src/core/{ => library/track}/TrackFactory.h (95%) rename src/core/{ => playback}/NonLibraryTrackHelper.cpp (95%) rename src/core/{ => playback}/NonLibraryTrackHelper.h (96%) rename src/core/{ => playback}/PlaybackQueue.cpp (95%) rename src/core/{ => playback}/PlaybackQueue.h (96%) rename src/core/{audio => playback}/Transport.cpp (96%) rename src/core/{audio => playback}/Transport.h (100%) rename src/core/{ => plugin}/PluginFactory.cpp (96%) rename src/core/{ => plugin}/PluginFactory.h (100%) rename src/core/{ => support}/Common.cpp (96%) rename src/core/{ => support}/Common.h (100%) rename src/core/{ => support}/Preferences.cpp (96%) rename src/core/{ => support}/Preferences.h (100%) rename src/core/{ => support}/ThreadHelper.cpp (95%) rename src/core/{ => support}/ThreadHelper.h (100%) rename src/core/{ => support}/Version.cpp (61%) rename src/core/{ => support}/Version.h (79%) diff --git a/src/contrib/taglib_plugin/TagReaderTaglib.h b/src/contrib/taglib_plugin/TagReaderTaglib.h index 46a55c5e4..8ac183ed4 100644 --- a/src/contrib/taglib_plugin/TagReaderTaglib.h +++ b/src/contrib/taglib_plugin/TagReaderTaglib.h @@ -60,7 +60,7 @@ #include #include -#include +#include class TagReaderTaglib : public musik::core::Plugin::IMetaDataReader { public: diff --git a/src/core/Crypt.cpp b/src/core/Crypt.cpp deleted file mode 100644 index 7c16a7e57..000000000 --- a/src/core/Crypt.cpp +++ /dev/null @@ -1,95 +0,0 @@ -////////////////////////////////////////////////////////////////////////////// -// -// License Agreement: -// -// The following are Copyright © 2008, mC2 team -// -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// -// * Redistributions of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// * Neither the name of the author nor the names of other contributors may -// be used to endorse or promote products derived from this software -// without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE -// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. -// -////////////////////////////////////////////////////////////////////////////// -#include "pch.hpp" -#include -#include - -#include -#include - -////////////////////////////////////////////////////////////////////////////// - -using namespace musik::core; - -////////////////////////////////////////////////////////////////////////////// - -std::string Crypt::GenerateSalt(){ - const std::string characters("ABCDEFGHKLMNOPQRSTWXYZabcdefghjkmnpqrstwxyz123456789"); - - typedef boost::mt19937 RandomGenerator; - RandomGenerator randomGenerator; - - randomGenerator.seed(static_cast(std::time(0))); - - boost::uniform_int<> randDistribution(0,(int)characters.size()-1); - boost::variate_generator > rand(randomGenerator, randDistribution); - - std::string salt; - for(int i(0);i<64;++i){ - salt += characters.at(rand()); - } - return salt; -} - -std::string Crypt::StaticSalt(){ - return "mC2, don't be square"; -} - -std::string Crypt::Encrypt(std::string cryptContent,std::string salt){ - md5_state_t md5State; - md5_init(&md5State); - - std::string encryptString = cryptContent+salt; - - md5_append(&md5State,(const md5_byte_t *)encryptString.c_str(),(int)encryptString.size()); - - // Encrypted result - md5_byte_t result[16]; - - // Get the results - md5_finish(&md5State, result); - - // Add result to encryptedString - std::string encryptedHexString; - boost::format formatHex("%1$02x"); - for(int i=0;i<16;++i){ - int hex = result[i]; - formatHex%hex; - encryptedHexString += formatHex.str(); - formatHex.clear(); - } - return encryptedHexString; -} diff --git a/src/core/Crypt.h b/src/core/Crypt.h deleted file mode 100644 index f245bc93e..000000000 --- a/src/core/Crypt.h +++ /dev/null @@ -1,56 +0,0 @@ -////////////////////////////////////////////////////////////////////////////// -// -// License Agreement: -// -// The following are Copyright © 2008, mC2 team -// -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// -// * Redistributions of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// * Neither the name of the author nor the names of other contributors may -// be used to endorse or promote products derived from this software -// without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE -// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. -// -////////////////////////////////////////////////////////////////////////////// -#pragma once - -#include - -////////////////////////////////////////////////////////////////////////////// - -namespace musik{ namespace core{ - -////////////////////////////////////////////////////////////////////////////// - -class Crypt{ - public: - static std::string GenerateSalt(); - static std::string StaticSalt(); - - static std::string Encrypt(std::string cryptContent,std::string salt); -}; - -////////////////////////////////////////////////////////////////////////////// -} } -////////////////////////////////////////////////////////////////////////////// diff --git a/src/core/Image.cpp b/src/core/Image.cpp deleted file mode 100644 index ff8e1b7dc..000000000 --- a/src/core/Image.cpp +++ /dev/null @@ -1,50 +0,0 @@ -////////////////////////////////////////////////////////////////////////////// -// -// License Agreement: -// -// The following are Copyright © 2008, Daniel Önnerby -// -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// -// * Redistributions of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// * Neither the name of the author nor the names of other contributors may -// be used to endorse or promote products derived from this software -// without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE -// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. -// -////////////////////////////////////////////////////////////////////////////// -#include "pch.hpp" -#include - -#include -#include - -using namespace musik::core; - -Image::Image(void) -{ -} - -Image::~Image(void) -{ -} diff --git a/src/core/Image.h b/src/core/Image.h deleted file mode 100644 index 6b3ec9e41..000000000 --- a/src/core/Image.h +++ /dev/null @@ -1,61 +0,0 @@ -////////////////////////////////////////////////////////////////////////////// -// -// License Agreement: -// -// The following are Copyright © 2008, Daniel Önnerby -// -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// -// * Redistributions of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// * Neither the name of the author nor the names of other contributors may -// be used to endorse or promote products derived from this software -// without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE -// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. -// -////////////////////////////////////////////////////////////////////////////// -#pragma once - -#include -#define XMD_H -#include - -////////////////////////////////////////////////////////////////////////////// - -namespace musik{ namespace core{ - -////////////////////////////////////////////////////////////////////////////// - -class Image{ - public: - Image(void); - ~Image(void); - bool Load(std::string image); - - typedef boost::shared_ptr ImageBufferPtr; -}; - -////////////////////////////////////////////////////////////////////////////// -} } -////////////////////////////////////////////////////////////////////////////// - - diff --git a/src/core/MessageQueue.cpp b/src/core/MessageQueue.cpp deleted file mode 100644 index 52b901c29..000000000 --- a/src/core/MessageQueue.cpp +++ /dev/null @@ -1,93 +0,0 @@ -////////////////////////////////////////////////////////////////////////////// -// -// License Agreement: -// -// The following are Copyright © 2008, Daniel Önnerby -// -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// -// * Redistributions of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// * Neither the name of the author nor the names of other contributors may -// be used to endorse or promote products derived from this software -// without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE -// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. -// -////////////////////////////////////////////////////////////////////////////// - -#include "pch.hpp" - -#include - -////////////////////////////////////////////////////////////////////////////// - -using namespace musik::core; - -////////////////////////////////////////////////////////////////////////////// - -MessageQueue MessageQueue::sInstance; - -/*MessageQueue& MessageQueue::Instance(){ - return MessageQueue::sInstance; -}*/ - -MessageQueue::MessageQueue(void) -{ -} - -MessageQueue::~MessageQueue(void) -{ -} - -MessageQueue::ControllerEventSignal& MessageQueue::EventController(){ - return MessageQueue::sInstance.controllerEvent; -} - -MessageQueue::EventSignal& MessageQueue::MessageEvent(const char* identifier){ - return MessageQueue::sInstance.eventMap[identifier]; -} - -void MessageQueue::SendMessage(const char* identifier,void* data){ - { - EventSignalMap::iterator eventSignal = MessageQueue::sInstance.eventMap.find(identifier); - if(eventSignal!=MessageQueue::sInstance.eventMap.end()){ - // First call the controllers - MessageQueue::sInstance.controllerEvent(identifier,data); - } - } - { - // Just in case the controller would change the eventMap, lets find the eventSignal again. - EventSignalMap::iterator eventSignal = MessageQueue::sInstance.eventMap.find(identifier); - if(eventSignal!=MessageQueue::sInstance.eventMap.end()){ - // Call the evenSignals - eventSignal->second(data); - } - } -} - -MessageQueueData::MessageQueueData(){ -} - -MessageQueueData::~MessageQueueData(){ -} - - diff --git a/src/core/MessageQueue.h b/src/core/MessageQueue.h deleted file mode 100644 index e0611b0d9..000000000 --- a/src/core/MessageQueue.h +++ /dev/null @@ -1,81 +0,0 @@ -////////////////////////////////////////////////////////////////////////////// -// -// License Agreement: -// -// The following are Copyright © 2008, Daniel Önnerby -// -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// -// * Redistributions of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// * Neither the name of the author nor the names of other contributors may -// be used to endorse or promote products derived from this software -// without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE -// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. -// -////////////////////////////////////////////////////////////////////////////// - -#pragma once - -#include -#include -#include - -////////////////////////////////////////////////////////////////////////////// - -namespace musik { namespace core { - -////////////////////////////////////////////////////////////////////////////// - -struct MessageQueueData{ - MessageQueueData(); - virtual ~MessageQueueData(); -}; - -class MessageQueue { - - public: - typedef sigslot::signal2 ControllerEventSignal; - typedef sigslot::signal1 EventSignal; - - static ControllerEventSignal& EventController(); - static EventSignal& MessageEvent(const char* identifier); - static void SendMessage(const char* identifier,void* data=NULL); - - - private: - ~MessageQueue(); - MessageQueue(); - - //static MessageQueue& Instance(); - private: - // The one and only instance - static MessageQueue sInstance; - - typedef std::map EventSignalMap; - EventSignalMap eventMap; - ControllerEventSignal controllerEvent; -}; - -////////////////////////////////////////////////////////////////////////////// -} } // musik::core -////////////////////////////////////////////////////////////////////////////// diff --git a/src/core/MetaKey.cpp b/src/core/MetaKey.cpp deleted file mode 100644 index 52d3a1525..000000000 --- a/src/core/MetaKey.cpp +++ /dev/null @@ -1,62 +0,0 @@ -////////////////////////////////////////////////////////////////////////////// -// -// License Agreement: -// -// The following are Copyright © 2008, Daniel Önnerby -// -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// -// * Redistributions of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// * Neither the name of the author nor the names of other contributors may -// be used to endorse or promote products derived from this software -// without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE -// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. -// -////////////////////////////////////////////////////////////////////////////// -#include "pch.hpp" -#include -#include - -using namespace musik::core; - -MetaKey::MetaKey(void){ -} - -MetaKey::~MetaKey(void){ -} - -MetaKey::Type MetaKey::TypeOf(std::string metaKey){ - if(metaKey=="bpm"){ - return MetaKey::Float; - }else if(metaKey=="track" || metaKey=="year"){ - return MetaKey::Int; - }else if(metaKey=="filetime"){ - return MetaKey::Date; - }else if(metaKey=="duration"){ - return MetaKey::Duration; - }else if(metaKey=="filesize"){ - return MetaKey::Size; - } - return MetaKey::String; -} - diff --git a/src/core/MetaKey.h b/src/core/MetaKey.h deleted file mode 100644 index 609b39c52..000000000 --- a/src/core/MetaKey.h +++ /dev/null @@ -1,66 +0,0 @@ -////////////////////////////////////////////////////////////////////////////// -// -// License Agreement: -// -// The following are Copyright © 2008, Daniel Önnerby -// -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// -// * Redistributions of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// * Neither the name of the author nor the names of other contributors may -// be used to endorse or promote products derived from this software -// without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE -// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. -// -////////////////////////////////////////////////////////////////////////////// -#pragma once - -#include - -////////////////////////////////////////////////////////////////////////////// - -namespace musik{ namespace core{ - -////////////////////////////////////////////////////////////////////////////// - -class MetaKey{ - private: - MetaKey(void); - ~MetaKey(void); - - public: - typedef enum { - Int = 1, - Float = 2, - Date = 3, - Size = 4, - Duration = 5, - String = 6 - } Type; - - static Type TypeOf(std::string metaKey); -}; - -////////////////////////////////////////////////////////////////////////////// -} } // musik::core - diff --git a/src/core/Server.cpp b/src/core/Server.cpp deleted file mode 100644 index 7ccf03d59..000000000 --- a/src/core/Server.cpp +++ /dev/null @@ -1,277 +0,0 @@ -////////////////////////////////////////////////////////////////////////////// -// -// License Agreement: -// -// The following are Copyright © 2008, Daniel Önnerby -// -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// -// * Redistributions of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// * Neither the name of the author nor the names of other contributors may -// be used to endorse or promote products derived from this software -// without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE -// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. -// -////////////////////////////////////////////////////////////////////////////// -#include "pch.hpp" -#include "Server.h" - -#include -#include -#include -#include - -#include - - -using namespace musik::core; - - -Server::Server(unsigned int port,unsigned int httpPort) - :exitThread(false) - ,acceptor(ioService,boost::asio::ip::tcp::endpoint(boost::asio::ip::tcp::v4(), port)) - ,httpServer(httpPort) -{ - this->acceptor.set_option(boost::asio::ip::tcp::acceptor::reuse_address(true)); - this->httpServer.parent = this; // should fix this. -} - -Server::~Server(void){ - this->Exit(); - - { - server::UserSessionMap clearedConnectedUsers; - server::ConnectionVector clearedConnections; - { - boost::mutex::scoped_lock lock(this->serverMutex); - clearedConnectedUsers.swap(this->connectedUsers); - clearedConnections.swap(this->connections); - } - } - - this->nextConnection.reset(); - - this->threads.join_all(); -} - -void Server::Exit(){ - boost::mutex::scoped_lock lock(this->serverMutex); - this->exitThread = true; - this->ioService.stop(); -} - -bool Server::Exited(){ - boost::mutex::scoped_lock lock(this->serverMutex); - return this->exitThread; -} - -bool Server::Startup(){ - // Start the server thread - this->threads.create_thread(boost::bind(&Server::ThreadLoop,this)); - - return true; -} - -std::string Server::ServerIdentifier(){ - return "server"; -} - - -void Server::ThreadLoop(){ - // Get server preferences - musik::core::Preferences prefs("Server"); - - // Get directory and database paths - std::string directory( musik::core::GetDataDirectory()+this->ServerIdentifier()+"/" ); - std::string database(directory+"musik.db"); - - // Create directory if not existing - boost::filesystem::path folder(directory); - if(!boost::filesystem::exists(folder)){ - boost::filesystem::create_directories(folder); - } - - // Create database - this->db.Open(database.c_str(),0,prefs.GetInt("DatabaseCache",4096)); - Library::Base::CreateDatabase(this->db); - - - this->httpServer.Startup(database); - - // Start the indexer - this->indexer.database = database; - this->indexer.Startup(directory); - - - while(!this->Exited()){ - - // tcp/ip port -// int port( prefs.GetInt("ipPort",10543) ); - - boost::system::error_code error; - - // Connect the next socket connection - this->SetNextConnection(); - - // loop, waiting for incomming connections - this->ioService.run(error); - - } -} - -void Server::SetNextConnection(){ - this->nextConnection.reset( new musik::core::server::Connection(this->ioService,this) ); - this->acceptor.async_accept(this->nextConnection->Socket(),boost::bind(&Server::AcceptConnection,this,boost::asio::placeholders::error)); -} - -void Server::AcceptConnection(const boost::system::error_code& error){ - if(!error){ - // Start the connection - this->nextConnection->Startup(); - - { - boost::mutex::scoped_lock lock(this->serverMutex); - - this->connections.push_back(this->nextConnection); - this->SetNextConnection(); - } - - this->CleanupConnections(); - } -} - -void Server::CleanupConnections(){ - boost::mutex::scoped_lock lock(this->serverMutex); - for(server::ConnectionVector::iterator connection=this->connections.begin();connection!=this->connections.end();){ - if( (*connection)->Exited() ){ - connection = this->connections.erase(connection); - }else{ - ++connection; - } - } -} - -bool Server::CreateUser(const std::string username,const std::string plainTextPassword,const std::string name){ - - std::string password(musik::core::Crypt::Encrypt( - plainTextPassword,musik::core::Crypt::StaticSalt())); - - db::Statement stmt("INSERT INTO users (login,password,name) VALUES (?,?,?)",this->db); - stmt.BindText(0,username.c_str()); - stmt.BindText(1,password.c_str()); - stmt.BindText(2,name.c_str()); - - bool returnBool(stmt.Step()==db::Done); - - this->UsersUpdated(); - return returnBool; -} - -bool Server::DeleteUser(const std::string username){ - db::Statement stmt("DELETE FROM users WHERE login=?",this->db); - stmt.BindText(0,username.c_str()); - - bool returnBool(stmt.Step()==db::Done); - - this->UsersUpdated(); - return returnBool; -} - -server::UserVector Server::AllUsers(){ - server::UserVector users; - db::Statement stmt("SELECT id,name,login,password FROM users ORDER BY login",this->db); - while(stmt.Step()==db::Row){ - users.push_back(server::UserPtr(new server::User( - stmt.ColumnInt(0), - stmt.ColumnText(2), - stmt.ColumnText(3), - stmt.ColumnText(1) - ))); - } - return users; -} - -server::UserSessionVector Server::ConnectedUserSessions(){ - boost::mutex::scoped_lock lock(this->serverMutex); - server::UserSessionVector userSessionVector; - - for(server::UserSessionMap::iterator userSession=this->connectedUsers.begin();userSession!=this->connectedUsers.end();++userSession){ - userSessionVector.push_back(userSession->second); - } - - return userSessionVector; -} - -bool Server::AddUserSession(server::UserSessionPtr userSession){ - { - boost::mutex::scoped_lock lock(this->serverMutex); - this->connectedUsers[userSession->UniqueId()] = userSession; - } - this->UserSessionsUpdated(); - - return true; -} - -bool Server::RemoveUserSession(server::UserSessionPtr userSession){ - if(userSession){ - { - boost::mutex::scoped_lock lock(this->serverMutex); - this->connectedUsers.erase(userSession->UniqueId()); - } - this->UserSessionsUpdated(); - } - return true; -} - -server::UserPtr Server::GetUser(std::string username){ - server::UserPtr user; - db::Statement stmt("SELECT id,name,login,password FROM users WHERE login=?",this->db); - stmt.BindText(0,username); - if(stmt.Step()==db::Row){ - user.reset( new server::User( - stmt.ColumnInt(0), - stmt.ColumnText(2), - stmt.ColumnText(3), - stmt.ColumnText(1) - )); - } - return user; -} - -bool Server::UserIsAuthorized(const char *authorizationKey,boost::asio::ip::tcp::socket &socket){ - if(authorizationKey){ - boost::mutex::scoped_lock lock(this->serverMutex); - server::UserSessionMap::iterator foundUser = this->connectedUsers.find(authorizationKey); - if(foundUser!=this->connectedUsers.end()){ - // User found, but to be sure, lets check if the address is the same - boost::asio::ip::tcp::endpoint endpoint = socket.remote_endpoint(); - if(foundUser->second->IP()==endpoint.address().to_string()){ - // Same address = same user - return true; - } - } - } - - return false; -} - diff --git a/src/core/Server.h b/src/core/Server.h deleted file mode 100644 index f6114e2b4..000000000 --- a/src/core/Server.h +++ /dev/null @@ -1,135 +0,0 @@ -////////////////////////////////////////////////////////////////////////////// -// -// License Agreement: -// -// The following are Copyright © 2008, Daniel Önnerby -// -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// -// * Redistributions of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// * Neither the name of the author nor the names of other contributors may -// be used to endorse or promote products derived from this software -// without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE -// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. -// -////////////////////////////////////////////////////////////////////////////// -#pragma once - -#include -#include -#include - -#include -#include -#include -#include - -#include -#include -#include -#include - -#include -#include - -////////////////////////////////////////////////////////////////////////////// - -namespace musik{ namespace core{ - -////////////////////////////////////////////////////////////////////////////// - -////////////////////////////////////////// -///\brief -///musik::core::Server is the main class for the musikServer -/// -///the Server contains everything from an Indexer, -///a musik::core::server::Connection (Library::Base derivate) for each connected user -///and a HTTP server for streaming tracks. -/// -///\see -///Indexer | http::Server | server::Connection -////////////////////////////////////////// -class Server{ - public: - // Methods - Server(unsigned int port,unsigned int httpPort); - ~Server(void); - bool Startup(); - - bool CreateUser(const std::string username,const std::string plainTextPassword,const std::string name); - bool DeleteUser(const std::string username); - - server::UserVector AllUsers(); - server::UserSessionVector ConnectedUserSessions(); - - bool UserIsAuthorized(const char *authorizationKey,boost::asio::ip::tcp::socket &socket); - public: - // Events - typedef sigslot::signal0<> UserUpdatedEvent; - UserUpdatedEvent UsersUpdated; - UserUpdatedEvent UserSessionsUpdated; - - public: - Indexer indexer; - http::Server httpServer; - - private: - // Methods - void Exit(); - bool Exited(); - void ThreadLoop(); - void AcceptConnection(const boost::system::error_code& error); - void SetNextConnection(); - void CleanupConnections(); - - std::string ServerIdentifier(); - - friend class server::Connection; - server::UserPtr GetUser(std::string username); - - bool RemoveUserSession(server::UserSessionPtr userSession); - bool AddUserSession(server::UserSessionPtr userSession); - - private: - // Variables - boost::asio::io_service ioService; - boost::asio::ip::tcp::acceptor acceptor; - - bool exitThread; - boost::mutex serverMutex; - boost::thread_group threads; - - musik::core::server::ConnectionVector connections; - musik::core::server::ConnectionPtr nextConnection; - - server::UserSessionMap connectedUsers; - - db::Connection db; -}; - -typedef boost::shared_ptr ServerPtr; - -////////////////////////////////////////////////////////////////////////////// -} } - - diff --git a/src/core/audio/Player.cpp b/src/core/audio/Player.cpp index ae115d322..d3cef204e 100644 --- a/src/core/audio/Player.cpp +++ b/src/core/audio/Player.cpp @@ -34,7 +34,7 @@ #include "pch.hpp" #include -#include +#include using namespace musik::core::audio; diff --git a/src/core/audio/Stream.cpp b/src/core/audio/Stream.cpp index ef430df07..456d2de53 100644 --- a/src/core/audio/Stream.cpp +++ b/src/core/audio/Stream.cpp @@ -35,7 +35,7 @@ #include #include -#include +#include using namespace musik::core::audio; using musik::core::PluginFactory; diff --git a/src/core/core.vcxproj b/src/core/core.vcxproj index f990584f3..5c02e2438 100755 --- a/src/core/core.vcxproj +++ b/src/core/core.vcxproj @@ -79,7 +79,11 @@ - + + + + + @@ -90,42 +94,39 @@ + + + + + Create Create - - - - - - - - - - - - - - + + + - - - - - - + + + + + - + + + + + @@ -136,14 +137,17 @@ + + + + + - - - - - - + + + + @@ -156,28 +160,18 @@ - - - - - - - - - - - - - - + + + + diff --git a/src/core/core.vcxproj.filters b/src/core/core.vcxproj.filters index caf1452b5..2066616f9 100755 --- a/src/core/core.vcxproj.filters +++ b/src/core/core.vcxproj.filters @@ -8,12 +8,6 @@ {6a03fee0-b862-4be2-82df-5ecf9d5a2cf4} - - {9f9ee41d-111b-4dab-8663-946253eeb46f} - - - {928fef19-2739-4485-83ae-1e18892247b0} - {eb06b592-13c8-4826-b196-81f5783a3348} @@ -38,29 +32,17 @@ {0e929af8-372d-4326-a4c6-796ec5c709d4} + + {928fef19-2739-4485-83ae-1e18892247b0} + + + {9f9ee41d-111b-4dab-8663-946253eeb46f} + src - - src\support - - - src\support - - - src\support - - - src\support - - - src\support - - - src\support - src\db @@ -73,18 +55,6 @@ src\db - - src\metadata - - - src\metadata - - - src\metadata - - - src\plugins - src\audio @@ -94,27 +64,6 @@ src\audio - - src\library\track - - - src\library\track - - - src\library\track - - - src\library\track - - - src\library\track - - - src\library - - - src\library - src\library\query @@ -151,41 +100,65 @@ src\io - - src\library + + src\support - - src\library + + src\support - + + src\support + + src\playback - + src\playback + + src\library + + + src\library + + + src\library + + + src\library\track + + + src\library\track + + + src\library\track + + + src\library\track + + + src\library\track + + + src\library + + + src\plugin + + + src\support + + + src\playback + + + src\library\metadata + src - - src\support - - - src\support - - - src\support - - - src\support - - - src\support - - - src\support - src\db @@ -201,18 +174,6 @@ src\db - - src\metadata - - - src\metadata - - - src\metadata - - - src\plugins - src\audio @@ -222,21 +183,6 @@ src\audio - - src\library\track - - - src\library\track - - - src\library\track - - - src\library\track - - - src\library\track - src\sdk @@ -273,12 +219,6 @@ src\sdk - - src\library - - - src\library - src\library\query @@ -315,20 +255,62 @@ src\io - - src\library - - - src\library - src - + + src\support + + + src\support + + + src\support + + src\playback - + src\playback + + src\library + + + src\library + + + src\library + + + src\library\track + + + src\library\track + + + src\library\track + + + src\library\track + + + src\library\track + + + src\library + + + src\plugin + + + src\support + + + src\playback + + + src\library\metadata + \ No newline at end of file diff --git a/src/core/io/DataStreamFactory.cpp b/src/core/io/DataStreamFactory.cpp index ad5c60566..bee4b3b54 100644 --- a/src/core/io/DataStreamFactory.cpp +++ b/src/core/io/DataStreamFactory.cpp @@ -38,7 +38,7 @@ #include #include -#include +#include #include using namespace musik::core::io; diff --git a/src/core/io/LocalFileStream.cpp b/src/core/io/LocalFileStream.cpp index 0c85b6243..72a124e5a 100644 --- a/src/core/io/LocalFileStream.cpp +++ b/src/core/io/LocalFileStream.cpp @@ -38,7 +38,7 @@ #include #include -#include +#include #include #ifdef UTF_WIDECHAR diff --git a/src/core/Indexer.cpp b/src/core/library/Indexer.cpp similarity index 96% rename from src/core/Indexer.cpp rename to src/core/library/Indexer.cpp index b9cb9e09e..f23ff4166 100644 --- a/src/core/Indexer.cpp +++ b/src/core/library/Indexer.cpp @@ -36,15 +36,15 @@ #include "pch.hpp" -#include +#include #include #include -#include +#include #include #include -#include -#include +#include +#include #include #include diff --git a/src/core/Indexer.h b/src/core/library/Indexer.h similarity index 96% rename from src/core/Indexer.h rename to src/core/library/Indexer.h index 8a3a83b0e..e09f20b35 100644 --- a/src/core/Indexer.h +++ b/src/core/library/Indexer.h @@ -38,7 +38,7 @@ //#include -#include +#include #include #include diff --git a/src/core/library/LibraryBase.cpp b/src/core/library/LibraryBase.cpp index 0db0f0247..505946e2c 100644 --- a/src/core/library/LibraryBase.cpp +++ b/src/core/library/LibraryBase.cpp @@ -36,10 +36,10 @@ #include "pch.hpp" -#include +#include #include #include -#include +#include using namespace musik::core; using namespace musik::core::library; diff --git a/src/core/LibraryFactory.cpp b/src/core/library/LibraryFactory.cpp similarity index 94% rename from src/core/LibraryFactory.cpp rename to src/core/library/LibraryFactory.cpp index a9965c7eb..069d69b41 100644 --- a/src/core/LibraryFactory.cpp +++ b/src/core/library/LibraryFactory.cpp @@ -34,11 +34,11 @@ // ////////////////////////////////////////////////////////////////////////////// #include "pch.hpp" -#include -#include +#include +#include #include -#include -#include +#include +#include using namespace musik::core; diff --git a/src/core/LibraryFactory.h b/src/core/library/LibraryFactory.h similarity index 100% rename from src/core/LibraryFactory.h rename to src/core/library/LibraryFactory.h diff --git a/src/core/library/LocalLibrary.cpp b/src/core/library/LocalLibrary.cpp index 952172f1f..3a09c13d8 100644 --- a/src/core/library/LocalLibrary.cpp +++ b/src/core/library/LocalLibrary.cpp @@ -36,9 +36,9 @@ #include "pch.hpp" -#include +#include #include -#include +#include #include diff --git a/src/core/library/LocalLibrary.h b/src/core/library/LocalLibrary.h index 64f6ff829..e51ae42ca 100644 --- a/src/core/library/LocalLibrary.h +++ b/src/core/library/LocalLibrary.h @@ -49,8 +49,8 @@ namespace musik{ namespace core{ #include #include #include -#include -#include +#include +#include ////////////////////////////////////////////////////////////////////////////// diff --git a/src/core/MetadataValue.cpp b/src/core/library/metadata/MetadataValue.cpp similarity index 95% rename from src/core/MetadataValue.cpp rename to src/core/library/metadata/MetadataValue.cpp index 52a1a0eae..0021dcc75 100644 --- a/src/core/MetadataValue.cpp +++ b/src/core/library/metadata/MetadataValue.cpp @@ -35,7 +35,7 @@ ////////////////////////////////////////////////////////////////////////////// #include "pch.hpp" -#include +#include using namespace musik::core; diff --git a/src/core/MetadataValue.h b/src/core/library/metadata/MetadataValue.h similarity index 94% rename from src/core/MetadataValue.h rename to src/core/library/metadata/MetadataValue.h index 176a750cd..61321929c 100644 --- a/src/core/MetadataValue.h +++ b/src/core/library/metadata/MetadataValue.h @@ -43,8 +43,8 @@ #include #include -namespace musik{ namespace core{ - class MetadataValue{ +namespace musik { namespace core { + class MetadataValue{ public: MetadataValue(void); MetadataValue(const DBID newId,const char *value); @@ -54,6 +54,7 @@ namespace musik{ namespace core{ std::string value; }; + typedef boost::shared_ptr MetadataValuePtr; typedef std::vector MetadataValueVector; diff --git a/src/core/library/query/LibraryTrackListQuery.cpp b/src/core/library/query/LibraryTrackListQuery.cpp index f8952e2f4..f694beb85 100644 --- a/src/core/library/query/LibraryTrackListQuery.cpp +++ b/src/core/library/query/LibraryTrackListQuery.cpp @@ -37,7 +37,7 @@ #include "pch.hpp" #include -#include +#include #include ////////////////////////////////////////////////////////////////////////////// diff --git a/src/core/library/query/LibraryTrackListQuery.h b/src/core/library/query/LibraryTrackListQuery.h index 70457a55c..57c78a3df 100644 --- a/src/core/library/query/LibraryTrackListQuery.h +++ b/src/core/library/query/LibraryTrackListQuery.h @@ -47,8 +47,6 @@ #include #include - - ////////////////////////////////////////////////////////////////////////////// namespace musik{ namespace core{ namespace tracklist { ////////////////////////////////////////////////////////////////////////////// diff --git a/src/core/library/query/ListQueryBase.cpp b/src/core/library/query/ListQueryBase.cpp index 494aab198..68af3a42a 100644 --- a/src/core/library/query/ListQueryBase.cpp +++ b/src/core/library/query/ListQueryBase.cpp @@ -38,8 +38,8 @@ #include #include -#include -#include +#include +#include #include using namespace musik::core; diff --git a/src/core/library/query/ListQueryBase.h b/src/core/library/query/ListQueryBase.h index 5fead140c..eefce702c 100644 --- a/src/core/library/query/ListQueryBase.h +++ b/src/core/library/query/ListQueryBase.h @@ -37,8 +37,8 @@ #pragma once #include -#include -#include +#include +#include #include #include diff --git a/src/core/library/query/MultiLibraryTrackListQuery.cpp b/src/core/library/query/MultiLibraryTrackListQuery.cpp index 70fff6359..38668c37f 100644 --- a/src/core/library/query/MultiLibraryTrackListQuery.cpp +++ b/src/core/library/query/MultiLibraryTrackListQuery.cpp @@ -37,9 +37,9 @@ #include "pch.hpp" #include -#include -#include -#include +#include +#include +#include #include diff --git a/src/core/library/query/QueryBase.cpp b/src/core/library/query/QueryBase.cpp index f88697459..8cabbbba8 100644 --- a/src/core/library/query/QueryBase.cpp +++ b/src/core/library/query/QueryBase.cpp @@ -37,7 +37,7 @@ #include "pch.hpp" #include -#include +#include using namespace musik::core; using namespace musik::core::query; diff --git a/src/core/library/query/SortTracksWithDataQuery.cpp b/src/core/library/query/SortTracksWithDataQuery.cpp index 68dcabb07..285b7d8aa 100644 --- a/src/core/library/query/SortTracksWithDataQuery.cpp +++ b/src/core/library/query/SortTracksWithDataQuery.cpp @@ -40,8 +40,8 @@ #include #include #include -#include -#include +#include +#include using namespace musik::core; using namespace musik::core::query; diff --git a/src/core/library/query/SortTracksWithDataQuery.h b/src/core/library/query/SortTracksWithDataQuery.h index d8eaeeec0..1bc3143ca 100644 --- a/src/core/library/query/SortTracksWithDataQuery.h +++ b/src/core/library/query/SortTracksWithDataQuery.h @@ -38,7 +38,7 @@ #include #include -#include +#include #include #include diff --git a/src/core/library/query/TrackListQueryBase.h b/src/core/library/query/TrackListQueryBase.h index 7d15ebbde..4f10862f5 100644 --- a/src/core/library/query/TrackListQueryBase.h +++ b/src/core/library/query/TrackListQueryBase.h @@ -39,7 +39,7 @@ ////////////////////////////////////////////////////////////////////////////// #include -#include +#include #include #include diff --git a/src/core/library/query/TrackMetadataQuery.cpp b/src/core/library/query/TrackMetadataQuery.cpp index fc4c2916b..e6682e0fb 100644 --- a/src/core/library/query/TrackMetadataQuery.cpp +++ b/src/core/library/query/TrackMetadataQuery.cpp @@ -36,10 +36,10 @@ #include "pch.hpp" -#include +#include #include #include -#include +#include #include using namespace musik::core; diff --git a/src/core/library/query/TrackMetadataQuery.h b/src/core/library/query/TrackMetadataQuery.h index 4ed6bdf76..b400c19b0 100644 --- a/src/core/library/query/TrackMetadataQuery.h +++ b/src/core/library/query/TrackMetadataQuery.h @@ -44,7 +44,7 @@ #include #include -#include +#include #include #include diff --git a/src/core/GenericTrack.cpp b/src/core/library/track/GenericTrack.cpp similarity index 94% rename from src/core/GenericTrack.cpp rename to src/core/library/track/GenericTrack.cpp index 63b479847..cebe31c66 100644 --- a/src/core/GenericTrack.cpp +++ b/src/core/library/track/GenericTrack.cpp @@ -36,8 +36,8 @@ #include "pch.hpp" -#include -#include +#include +#include using namespace musik::core; diff --git a/src/core/GenericTrack.h b/src/core/library/track/GenericTrack.h similarity index 96% rename from src/core/GenericTrack.h rename to src/core/library/track/GenericTrack.h index 90ef55bed..b5b29f7f7 100644 --- a/src/core/GenericTrack.h +++ b/src/core/library/track/GenericTrack.h @@ -37,7 +37,7 @@ #pragma once #include -#include +#include #include #include #include diff --git a/src/core/IndexerTrack.cpp b/src/core/library/track/IndexerTrack.cpp similarity index 96% rename from src/core/IndexerTrack.cpp rename to src/core/library/track/IndexerTrack.cpp index 1f51eea5c..b288aa450 100644 --- a/src/core/IndexerTrack.cpp +++ b/src/core/library/track/IndexerTrack.cpp @@ -36,9 +36,9 @@ #include "pch.hpp" -#include +#include -#include +#include #include #include #include diff --git a/src/core/IndexerTrack.h b/src/core/library/track/IndexerTrack.h similarity index 96% rename from src/core/IndexerTrack.h rename to src/core/library/track/IndexerTrack.h index c3808af66..13b5af899 100644 --- a/src/core/IndexerTrack.h +++ b/src/core/library/track/IndexerTrack.h @@ -37,7 +37,7 @@ #pragma once #include -#include +#include #include namespace musik { namespace core { diff --git a/src/core/LibraryTrack.cpp b/src/core/library/track/LibraryTrack.cpp similarity index 95% rename from src/core/LibraryTrack.cpp rename to src/core/library/track/LibraryTrack.cpp index ffcbfa055..1f3c0f320 100644 --- a/src/core/LibraryTrack.cpp +++ b/src/core/library/track/LibraryTrack.cpp @@ -36,10 +36,10 @@ #include "pch.hpp" -#include -#include +#include +#include -#include +#include #include #include #include diff --git a/src/core/LibraryTrack.h b/src/core/library/track/LibraryTrack.h similarity index 96% rename from src/core/LibraryTrack.h rename to src/core/library/track/LibraryTrack.h index b97808a8c..26226741c 100644 --- a/src/core/LibraryTrack.h +++ b/src/core/library/track/LibraryTrack.h @@ -37,7 +37,7 @@ #pragma once #include -#include +#include #include namespace musik { namespace core { namespace http { diff --git a/src/core/Track.cpp b/src/core/library/track/Track.cpp similarity index 95% rename from src/core/Track.cpp rename to src/core/library/track/Track.cpp index 094c483a7..4f4de4851 100644 --- a/src/core/Track.cpp +++ b/src/core/library/track/Track.cpp @@ -36,7 +36,7 @@ #include "pch.hpp" -#include +#include #include using namespace musik::core; diff --git a/src/core/Track.h b/src/core/library/track/Track.h similarity index 100% rename from src/core/Track.h rename to src/core/library/track/Track.h diff --git a/src/core/TrackFactory.cpp b/src/core/library/track/TrackFactory.cpp similarity index 92% rename from src/core/TrackFactory.cpp rename to src/core/library/track/TrackFactory.cpp index 3551fb96b..717618411 100644 --- a/src/core/TrackFactory.cpp +++ b/src/core/library/track/TrackFactory.cpp @@ -35,9 +35,9 @@ ////////////////////////////////////////////////////////////////////////////// #include "pch.hpp" -#include -#include -#include +#include +#include +#include #include #include diff --git a/src/core/TrackFactory.h b/src/core/library/track/TrackFactory.h similarity index 95% rename from src/core/TrackFactory.h rename to src/core/library/track/TrackFactory.h index 180b923d7..35be397bb 100644 --- a/src/core/TrackFactory.h +++ b/src/core/library/track/TrackFactory.h @@ -37,7 +37,7 @@ #pragma once #include -#include +#include namespace musik { namespace core { diff --git a/src/core/NonLibraryTrackHelper.cpp b/src/core/playback/NonLibraryTrackHelper.cpp similarity index 95% rename from src/core/NonLibraryTrackHelper.cpp rename to src/core/playback/NonLibraryTrackHelper.cpp index b24840cd1..2908a88ca 100644 --- a/src/core/NonLibraryTrackHelper.cpp +++ b/src/core/playback/NonLibraryTrackHelper.cpp @@ -36,9 +36,9 @@ #include "pch.hpp" -#include +#include #include -#include +#include #include #include diff --git a/src/core/NonLibraryTrackHelper.h b/src/core/playback/NonLibraryTrackHelper.h similarity index 96% rename from src/core/NonLibraryTrackHelper.h rename to src/core/playback/NonLibraryTrackHelper.h index 245c386b6..76f2191eb 100644 --- a/src/core/NonLibraryTrackHelper.h +++ b/src/core/playback/NonLibraryTrackHelper.h @@ -37,7 +37,7 @@ #pragma once #include -#include +#include #include #include #include diff --git a/src/core/PlaybackQueue.cpp b/src/core/playback/PlaybackQueue.cpp similarity index 95% rename from src/core/PlaybackQueue.cpp rename to src/core/playback/PlaybackQueue.cpp index 70b805aae..270303a45 100644 --- a/src/core/PlaybackQueue.cpp +++ b/src/core/playback/PlaybackQueue.cpp @@ -30,9 +30,11 @@ // POSSIBILITY OF SUCH DAMAGE. // ////////////////////////////////////////////////////////////////////////////// + #include "pch.hpp" -#include -#include + +#include +#include #include #include diff --git a/src/core/PlaybackQueue.h b/src/core/playback/PlaybackQueue.h similarity index 96% rename from src/core/PlaybackQueue.h rename to src/core/playback/PlaybackQueue.h index 7258a3b0b..f6e8150ac 100644 --- a/src/core/PlaybackQueue.h +++ b/src/core/playback/PlaybackQueue.h @@ -35,7 +35,7 @@ ////////////////////////////////////////////////////////////////////////////// -#include +#include #include #include #include diff --git a/src/core/audio/Transport.cpp b/src/core/playback/Transport.cpp similarity index 96% rename from src/core/audio/Transport.cpp rename to src/core/playback/Transport.cpp index cc589d909..b0b68e0bb 100644 --- a/src/core/audio/Transport.cpp +++ b/src/core/playback/Transport.cpp @@ -33,7 +33,7 @@ #include "pch.hpp" -#include +#include using namespace musik::core::audio; diff --git a/src/core/audio/Transport.h b/src/core/playback/Transport.h similarity index 100% rename from src/core/audio/Transport.h rename to src/core/playback/Transport.h diff --git a/src/core/PluginFactory.cpp b/src/core/plugin/PluginFactory.cpp similarity index 96% rename from src/core/PluginFactory.cpp rename to src/core/plugin/PluginFactory.cpp index 64b77f6c8..4c36d9995 100644 --- a/src/core/PluginFactory.cpp +++ b/src/core/plugin/PluginFactory.cpp @@ -35,10 +35,10 @@ ////////////////////////////////////////////////////////////////////////////// #include "pch.hpp" -#include -#include -#include +#include +#include +#include using namespace musik::core; diff --git a/src/core/PluginFactory.h b/src/core/plugin/PluginFactory.h similarity index 100% rename from src/core/PluginFactory.h rename to src/core/plugin/PluginFactory.h diff --git a/src/core/Common.cpp b/src/core/support/Common.cpp similarity index 96% rename from src/core/Common.cpp rename to src/core/support/Common.cpp index d143bf993..ee531a341 100644 --- a/src/core/Common.cpp +++ b/src/core/support/Common.cpp @@ -35,7 +35,7 @@ ////////////////////////////////////////////////////////////////////////////// #include "pch.hpp" -#include +#include #include #include diff --git a/src/core/Common.h b/src/core/support/Common.h similarity index 100% rename from src/core/Common.h rename to src/core/support/Common.h diff --git a/src/core/Preferences.cpp b/src/core/support/Preferences.cpp similarity index 96% rename from src/core/Preferences.cpp rename to src/core/support/Preferences.cpp index 5411b045b..294417184 100644 --- a/src/core/Preferences.cpp +++ b/src/core/support/Preferences.cpp @@ -35,9 +35,9 @@ ////////////////////////////////////////////////////////////////////////////// #include "pch.hpp" -#include +#include -#include +#include #include #include diff --git a/src/core/Preferences.h b/src/core/support/Preferences.h similarity index 100% rename from src/core/Preferences.h rename to src/core/support/Preferences.h diff --git a/src/core/ThreadHelper.cpp b/src/core/support/ThreadHelper.cpp similarity index 95% rename from src/core/ThreadHelper.cpp rename to src/core/support/ThreadHelper.cpp index bec297077..f12a5e228 100644 --- a/src/core/ThreadHelper.cpp +++ b/src/core/support/ThreadHelper.cpp @@ -35,7 +35,7 @@ ////////////////////////////////////////////////////////////////////////////// #include "pch.hpp" -#include +#include using namespace musik::core; diff --git a/src/core/ThreadHelper.h b/src/core/support/ThreadHelper.h similarity index 100% rename from src/core/ThreadHelper.h rename to src/core/support/ThreadHelper.h diff --git a/src/core/Version.cpp b/src/core/support/Version.cpp similarity index 61% rename from src/core/Version.cpp rename to src/core/support/Version.cpp index 41ec150fc..a99a7c759 100644 --- a/src/core/Version.cpp +++ b/src/core/support/Version.cpp @@ -35,51 +35,51 @@ ////////////////////////////////////////////////////////////////////////////// #include "pch.hpp" -#include +#include #include using namespace musik::core; -Version::Version(void):iVersion(0){ +Version::Version() +: version(0) { } -Version::Version(VERSION iMajor,VERSION iMinor,VERSION iRevision,VERSION iBuild){ - iVersion = ((iMajor&0xff)<<48) | ((iMinor&0xff)<<32) | ((iRevision&0xff)<<16) | (iBuild&0xff); +Version::Version(VERSION major, VERSION minor, VERSION revision, VERSION build) { + version = ((major & 0xff) << 48) | ((minor & 0xff) << 32) | ((revision & 0xff) << 16) | (build & 0xff); } -Version::Version(VERSION iNewVersion):iVersion(iNewVersion){ +Version::Version(VERSION version) +: version(version){ } -void Version::setVersion(VERSION iMajor,VERSION iMinor,VERSION iRevision,VERSION iBuild){ - iVersion = ((iMajor&0xff)<<48) | ((iMinor&0xff)<<32) | ((iRevision&0xff)<<16) | (iBuild&0xff); +void Version::setVersion(VERSION major, VERSION minor, VERSION revision, VERSION build){ + version = ((major & 0xff) << 48) | ((minor & 0xff) << 32) | ((revision & 0xff) << 16) | (build & 0xff); } -void Version::setVersion(VERSION iNewVersion){ - iVersion = iNewVersion; +void Version::setVersion(VERSION version){ + version = version; } Version::~Version(void){ } -utfstring Version::getVersion(){ - utfstring sVersion; - sVersion = boost::str( boost::wformat(UTF("%1%.%2%.%3%.%4%")) % - ((iVersion>>48) & 0xff) % - ((iVersion>>32) & 0xff) % - ((iVersion>>16) & 0xff) % - (iVersion & 0xff) ); - return sVersion; +std::string Version::getVersion() { + return boost::str(boost::format("%1%.%2%.%3%.%4%") + % ((version >> 48) & 0xff) + % ((version >> 32) & 0xff) + % ((version >> 16) & 0xff) + % (version & 0xff)); } -int Version::getMajorVersion(){ - return (int)((iVersion>>48) & 0xff); +int Version::getMajorVersion() { + return (int)((version >> 48) & 0xff); } -int Version::getMinorVersion(){ - return (int)((iVersion>>32) & 0xff); +int Version::getMinorVersion() { + return (int)((version >> 32) & 0xff); } -int Version::getRevisionVersion(){ - return (int)((iVersion>>16) & 0xff); +int Version::getRevisionVersion() { + return (int)((version >> 16) & 0xff); } -int Version::getBuildVersion(){ - return (int)(iVersion & 0xff); +int Version::getBuildVersion() { + return (int)(version & 0xff); } diff --git a/src/core/Version.h b/src/core/support/Version.h similarity index 79% rename from src/core/Version.h rename to src/core/support/Version.h index 5205c949f..17cdaca40 100644 --- a/src/core/Version.h +++ b/src/core/support/Version.h @@ -40,24 +40,25 @@ #include -namespace musik{ namespace core{ - class Version{ +namespace musik { namespace core { + class Version{ public: - Version(void); - Version(VERSION iMajor,VERSION iMinor,VERSION iRevision,VERSION iBuild); - Version(VERSION iNewVersion); - ~Version(void); - VERSION iVersion; - - utfstring getVersion(); - void setVersion(VERSION iMajor,VERSION iMinor,VERSION iRevision,VERSION iBuild); - void setVersion(VERSION iNewVersion); + Version(); + Version(VERSION major, VERSION minor, VERSION revision, VERSION build); + Version(VERSION version); + ~Version(); + std::string getVersion(); + void setVersion(VERSION major, VERSION minor, VERSION revision, VERSION build); + void setVersion(VERSION version); int getMajorVersion(); int getMinorVersion(); int getRevisionVersion(); int getBuildVersion(); + + private: + VERSION version; }; } } diff --git a/src/square/ConsoleUI.cpp b/src/square/ConsoleUI.cpp index 360198da7..d1096faf7 100644 --- a/src/square/ConsoleUI.cpp +++ b/src/square/ConsoleUI.cpp @@ -40,11 +40,11 @@ #include #include -#include +#include -#include -#include -#include +#include +#include +#include using namespace musik::square; diff --git a/src/square/ConsoleUI.h b/src/square/ConsoleUI.h index 3c303e6cd..65f2ad10c 100644 --- a/src/square/ConsoleUI.h +++ b/src/square/ConsoleUI.h @@ -41,7 +41,7 @@ #include -#include +#include #include "DummyAudioEventHandler.h"