]> git.lyx.org Git - lyx.git/blob - src/chset.h
Fix export of graphics file with relative path name.
[lyx.git] / src / chset.h
1 // -*- C++ -*-
2 /**
3  * \file chset.h
4  * Copyright 2002 the LyX Team
5  * Read the file COPYING
6  */
7
8 #ifndef CHSET_H
9 #define CHSET_H
10
11 #ifdef __GNUG__
12 #pragma interface
13 #endif
14
15 #include <map>
16 #include <utility>
17
18 #include "LString.h"
19
20 /// a class for mapping char strings such as "\^{A}" to the integer value
21 class CharacterSet {
22 public:
23         /**
24          * initialise this charset from the given .cdef file
25          * param charset the charset to look for
26          *
27          * Finds a .cdef file corresponding to the named charset
28          * and parses it. This function is only intended to be
29          * called once.
30          */
31         bool loadFile(string const & charset);
32         /// return the name of the current charset
33         string const & getName() const;
34         /**
35          * Return the encoded charset value of the given string.
36          *
37          * The bool value is false if an encoding could not be found
38          * in this charset, and true otherwise.
39          */
40         std::pair<bool, int> const encodeString(string const &) const;
41 private:
42         /// charset name
43         string name_;
44         ///
45         typedef std::map<string, unsigned char> Cdef;
46         /// mapping from string representation to encoded value
47         Cdef map_;
48 };
49 #endif