From: <man...@us...> - 2013-11-06 21:27:40
|
Revision: 3109 http://sourceforge.net/p/modplug/code/3109 Author: manxorist Date: 2013-11-06 21:27:32 +0000 (Wed, 06 Nov 2013) Log Message: ----------- [Ref] libopenmpt: Merge libopenmpt_version.cpp into libopenmpt_impl.cpp and kill it. Modified Paths: -------------- trunk/OpenMPT/libopenmpt/libopenmpt.vcxproj trunk/OpenMPT/libopenmpt/libopenmpt.vcxproj.filters trunk/OpenMPT/libopenmpt/libopenmpt_impl.cpp trunk/OpenMPT/openmpt123/Makefile Removed Paths: ------------- trunk/OpenMPT/libopenmpt/libopenmpt_version.cpp Modified: trunk/OpenMPT/libopenmpt/libopenmpt.vcxproj =================================================================== --- trunk/OpenMPT/libopenmpt/libopenmpt.vcxproj 2013-11-06 20:41:45 UTC (rev 3108) +++ trunk/OpenMPT/libopenmpt/libopenmpt.vcxproj 2013-11-06 21:27:32 UTC (rev 3109) @@ -578,7 +578,6 @@ <CompileAs Condition="'$(Configuration)|$(Platform)'=='Test|x64'">CompileAsC</CompileAs> </ClCompile> <ClCompile Include="libopenmpt_test.cpp" /> - <ClCompile Include="libopenmpt_version.cpp" /> <ClCompile Include="libopenmpt_winamp.cpp" /> <ClCompile Include="libopenmpt_xmplay.cpp" /> </ItemGroup> Modified: trunk/OpenMPT/libopenmpt/libopenmpt.vcxproj.filters =================================================================== --- trunk/OpenMPT/libopenmpt/libopenmpt.vcxproj.filters 2013-11-06 20:41:45 UTC (rev 3108) +++ trunk/OpenMPT/libopenmpt/libopenmpt.vcxproj.filters 2013-11-06 21:27:32 UTC (rev 3109) @@ -478,9 +478,6 @@ <ClCompile Include="libopenmpt_cxx.cpp"> <Filter>Source Files</Filter> </ClCompile> - <ClCompile Include="libopenmpt_version.cpp"> - <Filter>Source Files</Filter> - </ClCompile> <ClCompile Include="libopenmpt_interactive.cpp"> <Filter>Source Files</Filter> </ClCompile> Modified: trunk/OpenMPT/libopenmpt/libopenmpt_impl.cpp =================================================================== --- trunk/OpenMPT/libopenmpt/libopenmpt_impl.cpp 2013-11-06 20:41:45 UTC (rev 3108) +++ trunk/OpenMPT/libopenmpt/libopenmpt_impl.cpp 2013-11-06 21:27:32 UTC (rev 3109) @@ -17,18 +17,82 @@ #include <algorithm> #include <iostream> #include <iterator> +#include <sstream> #include <cmath> #include <cstdlib> #include <cstring> +#include "common/version.h" #include "soundlib/Sndfile.h" #include "soundlib/AudioReadTarget.h" #include "soundlib/FileReader.h" namespace openmpt { -log_interface::log_interface() { +namespace version { + +std::uint32_t get_library_version() { + return OPENMPT_API_VERSION | ( MptVersion::GetRevision() & 0xffff ); +} + +std::uint32_t get_core_version() { + return MptVersion::num; +} + +static std::string get_library_version_string() { + std::ostringstream str; + std::uint32_t version = get_library_version(); + if ( ( version & 0xffff ) == 0 ) { + str << ((version>>24) & 0xff) << "." << ((version>>16) & 0xff); + } else { + str << ((version>>24) & 0xff) << "." << ((version>>16) & 0xff) << "." << ((version>>0) & 0xffff); + } + if ( MptVersion::IsDirty() ) { + str << ".2-modified"; + } else if ( MptVersion::HasMixedRevisions() ) { + str << ".1-modified"; + } + return str.str(); +} + +static std::string get_core_version_string() { + return MptVersion::GetVersionStringExtended(); +} + +static std::string get_build_string() { + return MptVersion::GetBuildDateString(); +} + +static std::string get_credits_string() { + return mpt::String::Convert( MptVersion::GetFullCreditsString(), mpt::CharsetISO8859_1, mpt::CharsetUTF8 ); +} + +static std::string get_contact_string() { + return mpt::String::Convert( MptVersion::GetContactString(), mpt::CharsetISO8859_1, mpt::CharsetUTF8 ); +} + +std::string get_string( const std::string & key ) { + if ( key == "" ) { + return std::string(); + } else if ( key == string::library_version ) { + return get_library_version_string(); + } else if ( key == string::core_version ) { + return get_core_version_string(); + } else if ( key == string::build ) { + return get_build_string(); + } else if ( key == string::credits ) { + return get_credits_string(); + } else if ( key == string::contact ) { + return get_contact_string(); + } else { + return std::string(); + } +} + +} // namespace version + + log_interface::log_interface() { return; } log_interface::~log_interface() { Deleted: trunk/OpenMPT/libopenmpt/libopenmpt_version.cpp =================================================================== --- trunk/OpenMPT/libopenmpt/libopenmpt_version.cpp 2013-11-06 20:41:45 UTC (rev 3108) +++ trunk/OpenMPT/libopenmpt/libopenmpt_version.cpp 2013-11-06 21:27:32 UTC (rev 3109) @@ -1,82 +0,0 @@ -/* - * libopenmpt_version.cpp - * ---------------------- - * Purpose: libopenmpt versioning helpers - * Notes : (currently none) - * Authors: OpenMPT Devs - * The OpenMPT source code is released under the BSD license. Read LICENSE for more details. - */ - -#include "common/stdafx.h" - -#include "libopenmpt_internal.h" -#include "libopenmpt.hpp" -#include "libopenmpt.h" - -#include <sstream> - -#include "common/version.h" - -#include "svn_version.h" - -namespace openmpt { namespace version { - -std::uint32_t get_library_version() { - return OPENMPT_API_VERSION | ( MptVersion::GetRevision() & 0xffff ); -} - -std::uint32_t get_core_version() { - return MptVersion::num; -} - -static std::string get_library_version_string() { - std::ostringstream str; - std::uint32_t version = get_library_version(); - if ( ( version & 0xffff ) == 0 ) { - str << ((version>>24) & 0xff) << "." << ((version>>16) & 0xff); - } else { - str << ((version>>24) & 0xff) << "." << ((version>>16) & 0xff) << "." << ((version>>0) & 0xffff); - } - if ( MptVersion::IsDirty() ) { - str << ".2-modified"; - } else if ( MptVersion::HasMixedRevisions() ) { - str << ".1-modified"; - } - return str.str(); -} - -static std::string get_core_version_string() { - return MptVersion::GetVersionStringExtended(); -} - -static std::string get_build_string() { - return MptVersion::GetBuildDateString(); -} - -static std::string get_credits_string() { - return mpt::String::Convert( MptVersion::GetFullCreditsString(), mpt::CharsetISO8859_1, mpt::CharsetUTF8 ); -} - -static std::string get_contact_string() { - return mpt::String::Convert( MptVersion::GetContactString(), mpt::CharsetISO8859_1, mpt::CharsetUTF8 ); -} - -std::string get_string( const std::string & key ) { - if ( key == "" ) { - return std::string(); - } else if ( key == string::library_version ) { - return get_library_version_string(); - } else if ( key == string::core_version ) { - return get_core_version_string(); - } else if ( key == string::build ) { - return get_build_string(); - } else if ( key == string::credits ) { - return get_credits_string(); - } else if ( key == string::contact ) { - return get_contact_string(); - } else { - return std::string(); - } -} - -} } // namespace openmpt::version Modified: trunk/OpenMPT/openmpt123/Makefile =================================================================== --- trunk/OpenMPT/openmpt123/Makefile 2013-11-06 20:41:45 UTC (rev 3108) +++ trunk/OpenMPT/openmpt123/Makefile 2013-11-06 21:27:32 UTC (rev 3109) @@ -213,7 +213,6 @@ ../libopenmpt/libopenmpt_cxx.cpp \ ../libopenmpt/libopenmpt_impl.cpp \ ../libopenmpt/libopenmpt_interactive.cpp \ - ../libopenmpt/libopenmpt_version.cpp \ ifeq ($(NO_ZLIB),1) LIBOPENMPT_C_SOURCES += ../include/miniz/miniz.c This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |