diff options
| author | Krzysztof Kosi??ski <tweenk.pl@gmail.com> | 2009-05-10 02:02:33 +0000 |
|---|---|---|
| committer | tweenk <tweenk@users.sourceforge.net> | 2009-05-10 02:02:33 +0000 |
| commit | 634ba0ea39b5e74829d26d495519135868eeb416 (patch) | |
| tree | c93d640fc89f30b1ca74d5d2394a565d095fa4e2 /src | |
| parent | Set svn:ignore to '*.in' for a few dirs (diff) | |
| download | inkscape-634ba0ea39b5e74829d26d495519135868eeb416.tar.gz inkscape-634ba0ea39b5e74829d26d495519135868eeb416.zip | |
Remove test-stubs.cpp: no longer needed.
(bzr r7843)
Diffstat (limited to 'src')
| -rw-r--r-- | src/test-stubs.cpp | 111 |
1 files changed, 0 insertions, 111 deletions
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 <twwenk.pl@gmail.com> - * This file is in the public domain. - */ - -#include "preferences.h" -#include <glib.h> -#include <glib/gstdio.h> -#include <cstring> -#include <cstdlib> - -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<Glib::ustring, Preferences::Entry> _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<gchar const *>(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<gchar const *>(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<gchar const *>(v._value); - return g_ascii_strtod(s, NULL); -} - -Glib::ustring Preferences::_extractString(Entry const &v) -{ - return Glib::ustring(static_cast<gchar const *>(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 : |
