From: tweenk Date: Sun, 10 May 2009 02:02:33 +0000 (+0000) Subject: Remove test-stubs.cpp: no longer needed. X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=6bd7fe6ba5363dba428f1e07dbfc6217ce72fe7a;p=inkscape.git Remove test-stubs.cpp: no longer needed. --- diff --git a/build.xml b/build.xml index 0d917ca71..62eda3aaa 100644 --- a/build.xml +++ b/build.xml @@ -333,7 +333,6 @@ - @@ -693,6 +692,8 @@ + + diff --git a/src/test-stubs.cpp b/src/test-stubs.cpp deleted file mode 100644 index b0890fe29..000000000 --- a/src/test-stubs.cpp +++ /dev/null @@ -1,111 +0,0 @@ -/** @file - * @brief Alternate stub implementations for some functions. - * - * This file exists only for the benefit of the linker when building tests, - * to avoid circular dependencies. If some test causes link errors because of a function - * it doesn't need, feel free to add a stub here. - */ -/* Authors: Krzysztof Kosiński - * This file is in the public domain. - */ - -#include "preferences.h" -#include -#include -#include -#include - -int sp_main_gui(int /*argc*/, char const **/*argv*/) { return 0; } -int sp_main_console(int /*argc*/, char const **/*argv*/) { return 0; } - -// stubbed out preferences implementation using a simple map -namespace Inkscape { - -std::map _prefs; - -Preferences::Preferences() : - _prefs_basename(""), - _prefs_dir(""), - _prefs_filename(""), - _prefs_doc(NULL), - _writable(false) -{ -} - -Preferences::~Preferences() -{ -} - -void Preferences::save() {} - -// getter methods - -Preferences::Entry const Preferences::getEntry(Glib::ustring const &pref_path) -{ - return _prefs[pref_path]; -} -void Preferences::setBool(Glib::ustring const &pref_path, bool value) -{ - _prefs[pref_path] = _create_pref_value(pref_path, (void const*) (value ? "1" : "0")); -} -void Preferences::setInt(Glib::ustring const &pref_path, int value) -{ - gchar *intstr = (gchar*) g_malloc(32); - g_snprintf(intstr, 32, "%d", value); - _prefs[pref_path] = _create_pref_value(pref_path, (void const*) intstr); -} -void Preferences::setDouble(Glib::ustring const &pref_path, double value) -{ - gchar *buf = (gchar*) g_malloc(G_ASCII_DTOSTR_BUF_SIZE); - g_ascii_dtostr(buf, G_ASCII_DTOSTR_BUF_SIZE, value); - _prefs[pref_path] = _create_pref_value(pref_path, (void const*) buf); -} -void Preferences::setString(Glib::ustring const &pref_path, Glib::ustring const &value) -{ - _prefs[pref_path] = _create_pref_value(pref_path, (void const*) g_strdup(value.data())); -} - -bool Preferences::_extractBool(Entry const &v) -{ - gchar const *s = static_cast(v._value); - if ( !s[0] || !strcmp(s, "0") || !strcmp(s, "false") ) return false; - return true; -} -int Preferences::_extractInt(Entry const &v) -{ - gchar const *s = static_cast(v._value); - if ( !strcmp(s, "true") ) return true; - if ( !strcmp(s, "false") ) return false; - return atoi(s); -} -double Preferences::_extractDouble(Entry const &v) -{ - gchar const *s = static_cast(v._value); - return g_ascii_strtod(s, NULL); -} - -Glib::ustring Preferences::_extractString(Entry const &v) -{ - return Glib::ustring(static_cast(v._value)); -} -Preferences::Entry const Preferences::_create_pref_value(Glib::ustring const &path, void const *ptr) -{ - return Entry(path, ptr); -} - -Preferences *Preferences::_instance = NULL; - - -} // namespace Inkscape - - -/* - Local Variables: - mode:c++ - c-file-style:"stroustrup" - c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +)) - indent-tabs-mode:nil - fill-column:99 - End: -*/ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :