diff options
Diffstat (limited to 'Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/include/efont/psres.hh')
-rw-r--r-- | Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/include/efont/psres.hh | 74 |
1 files changed, 74 insertions, 0 deletions
diff --git a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/include/efont/psres.hh b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/include/efont/psres.hh new file mode 100644 index 00000000000..ee302821fdb --- /dev/null +++ b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/include/efont/psres.hh @@ -0,0 +1,74 @@ +// -*- related-file-name: "../../libefont/psres.cc" -*- +#ifndef EFONT_PSRES_HH +#define EFONT_PSRES_HH +#include <lcdf/vector.hh> +#include <lcdf/hashmap.hh> +#include <lcdf/string.hh> +#include <lcdf/filename.hh> +class Slurper; +namespace Efont { +class PsresDatabaseSection; + +class PsresDatabase { public: + + PsresDatabase(); + ~PsresDatabase(); + + void add_psres_path(const char* path, const char* defaults, bool override); + bool add_psres_file(Filename&, bool override); + void add_database(PsresDatabase*, bool override); + + inline PsresDatabaseSection* section(PermString section) const; + const String& value(PermString section, PermString key) const; + const String& unescaped_value(PermString section, PermString key) const; + Filename filename_value(PermString section, PermString key) const; + + private: + + HashMap<PermString, int> _section_map; + Vector<PsresDatabaseSection*> _sections; + + PsresDatabaseSection* force_section(PermString); + bool add_one_psres_file(Slurper&, bool override); + void add_psres_directory(PermString); + +}; + +class PsresDatabaseSection { public: + + PsresDatabaseSection(PermString); + + PermString section_name() const { return _section_name; } + + void add_psres_file_section(Slurper&, PermString, bool); + void add_section(PsresDatabaseSection*, bool override); + + const String& value(PermString key) { return value(_map[key]); } + inline const String& unescaped_value(PermString key) const; + Filename filename_value(PermString key); + + private: + + PermString _section_name; + HashMap<PermString, int> _map; + Vector<PermString> _directories; + Vector<String> _values; + Vector<int> _value_escaped; + + const String& value(int index); + +}; + +inline PsresDatabaseSection* PsresDatabase::section(PermString n) const +{ + return _sections[_section_map[n]]; +} + +inline const String& PsresDatabaseSection::unescaped_value(PermString key) const +{ + assert(!_value_escaped[_map[key]]); + return _values[_map[key]]; +} + +} +#endif |