X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Fchset.h;h=468ce2399540d2aee9d8b1f731370ff81dee9132;hb=78046794ccfce3a20751e00b35295c290853afd6;hp=17f08193fe7dcf4318fe25e8437eeab5dee62f6a;hpb=35584afc1162dec2cf9fff79305e95cb3b75aefb;p=lyx.git diff --git a/src/chset.h b/src/chset.h index 17f08193fe..468ce23995 100644 --- a/src/chset.h +++ b/src/chset.h @@ -1,44 +1,50 @@ // -*- C++ -*- +/** + * \file chset.h + * This file is part of LyX, the document processor. + * Licence details can be found in the file COPYING. + * + * \author Lars Gullik Bjønnes + * \author Jean-Marc Lasgouttes + * + * Full author contact details are available in file CREDITS. + */ + #ifndef CHSET_H #define CHSET_H -#ifdef __GNUG__ -#pragma interface -#endif +#include +#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 string&); - /// - string getName(); - /// - bool encodeString(string&); + /** + * 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(std::string const & charset); + /// return the name of the current charset + std::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(std::string const &) const; private: + /// charset name + std::string name_; /// - string name_; - - /// - struct Cdef { - /// - unsigned char ic; - /// - string str; - /// - Cdef *next; - }; - - /// - Cdef *map_; - /// - void freeMap(); + typedef std::map Cdef; + /// mapping from string representation to encoded value + Cdef map_; }; #endif