5 #ifndef BPP_GRAPHICS_FONT_FONTMANAGER_H 6 #define BPP_GRAPHICS_FONT_FONTMANAGER_H 14 #include "../../Text/TextTools.h" 15 #include "../../Exceptions.h" 24 template<
class CodeType>
36 virtual CodeType
getCode(
const Font& font)
const = 0;
43 virtual const Font&
getFont(CodeType& code)
const = 0;
48 virtual std::vector<CodeType>
getCodes()
const = 0;
53 virtual std::vector<Font>
getFonts()
const = 0;
62 template<
class CodeType>
76 for (
unsigned int i = 0; i < fonts_.size(); i++)
78 if (fonts_[i] == font)
83 throw Exception(
"AbstractFontManager::getCode. Unknown font: " + font.
toString());
88 for (
unsigned int i = 0; i < codes_.size(); i++)
90 if (codes_[i] == code)
97 std::vector<CodeType>
getCodes()
const {
return codes_; }
98 std::vector<Font>
getFonts()
const {
return fonts_; }
104 codes_.push_back(code);
105 fonts_.push_back(font);
109 #endif // BPP_GRAPHICS_FONT_FONTMANAGER_H std::vector< Font > getFonts() const
const Font & getFont(int &code) const
Data structure for fonts.
void registerFont_(const Font &font, int code)
virtual const Font & getFont(CodeType &code) const =0
virtual std::vector< CodeType > getCodes() const =0
std::string toString() const
size_t getNumberOfFonts() const
virtual size_t getNumberOfFonts() const =0
std::vector< CodeType > codes_
Exception base class. Overload exception constructor (to control the exceptions mechanism). Destructor is already virtual (from std::exception)
virtual std::vector< Font > getFonts() const =0
CodeType getCode(const Font &font) const
std::string toString(T t)
General template method to convert to a string.
Associate special fonts to a code.
virtual CodeType getCode(const Font &font) const =0
std::vector< CodeType > getCodes() const
std::vector< Font > fonts_