X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Fchset.h;h=a3691af1df5e1308193ad97a60cf4d27f35f69b8;hb=5091380d6bad1686800e384ed1bbb03836a15aab;hp=6156606571c566d318bfb354eaa9cad428a8087a;hpb=27de1486ca34aaad446adb798d71a77d6f6304da;p=lyx.git diff --git a/src/chset.h b/src/chset.h index 6156606571..a3691af1df 100644 --- a/src/chset.h +++ b/src/chset.h @@ -1,44 +1,49 @@ // -*- C++ -*- -#ifndef _Chset_h_ -#define _Chset_h_ +/** + * \file chset.h + * Copyright 2002 the LyX Team + * Read the file COPYING + */ + +#ifndef CHSET_H +#define CHSET_H #ifdef __GNUG__ #pragma interface #endif +#include +#include + #include "LString.h" -/// +/// a class for mapping char strings such as "\^{A}" to the integer value class CharacterSet { public: - /// - CharacterSet(); - /// - ~CharacterSet(); - - /// - bool loadFile(const LString&); - /// - LString getName(); - /// - bool encodeString(LString&); + /** + * initialise this charset from the given .cdef file + * param charset the charset to look for + * + * Finds a .cdef file corresponding to the named charset + * and parses it. This function is only intended to be + * called once. + */ + bool loadFile(string const & charset); + /// return the name of the current charset + string const & getName() const; + /** + * Return the encoded charset value of the given string. + * + * The bool value is false if an encoding could not be found + * in this charset, and true otherwise. + */ + std::pair const encodeString(string const &) const; private: + /// charset name + string name_; /// - LString name_; - - /// - struct Cdef { - /// - unsigned char ic; - /// - LString str; - /// - Cdef *next; - }; - - /// - Cdef *map_; - /// - void freeMap(); + typedef std::map Cdef; + /// mapping from string representation to encoded value + Cdef map_; }; #endif