// Copyright (C) 2000-2007, Luca Padovani . // // This file is part of GtkMathView, a flexible, high-quality rendering // engine for MathML documents. // // GtkMathView is free software; you can redistribute it and/or modify it // under the terms of the GNU Lesser General Public License as published // by the Free Software Foundation; either version 3 of the License, or // (at your option) any later version. // // GtkMathView is distributed in the hope that it will be useful, but // WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License // along with this program. If not, see . #ifndef __Configuration_hh__ #define __Configuration_hh__ #include #include "defs.h" #include "String.hh" #include "StringHash.hh" #include "RGBColor.hh" #include "Object.hh" #include "SmartPtr.hh" #include "HashMap.hh" #include "Length.hh" class GMV_MathView_EXPORT Configuration : public Object { protected: Configuration(void); virtual ~Configuration(); public: static SmartPtr create(void) { return new Configuration(); } class Entry : public Object { protected: Entry(const String&, const SmartPtr&); virtual ~Entry(); public: static SmartPtr create(const String&, const SmartPtr&); String getValue(void) const { return value; } String asString(void) const { return value; } bool asInt(int&) const; bool asBool(bool&) const; bool asRGBColor(RGBColor&) const; SmartPtr getNext(void) const; private: String value; SmartPtr next; }; static const char* getBinaryVersion(void); static void addConfigurationPath(const String&); static const std::vector& getConfigurationPaths(void); bool has(const String&) const; void add(const String&, const String&); SmartPtr get(const String&) const; std::vector > getAll(const String&) const; String getString(const SmartPtr&, const String&, const String&) const; std::vector getStringList(const String&) const; int getInt(const SmartPtr&, const String&, int) const; bool getBool(const SmartPtr&, const String&, bool) const; RGBColor getRGBColor(const SmartPtr&, const String&, const RGBColor&) const; Length getLength(const SmartPtr&, const String&, const Length&) const; private: static std::vector configurationPaths; typedef HASH_MAP_NS::hash_map, StringHashCompare> Map; Map map; }; #endif // __Configuration_hh__