Encodings: Add CharInfo to Encoding.h

This commit is contained in:
Vincent van Ravesteijn 2013-09-29 14:27:48 +02:00
parent 72c13323d8
commit 01e94f5e03
2 changed files with 53 additions and 51 deletions

View File

@ -231,57 +231,6 @@ char_type const arabic_start = 0x0621;
char_type const arabic_end = 0x06cc;
enum CharInfoFlags {
///
CharInfoCombining = 1,
///
CharInfoTextFeature = 2,
///
CharInfoMathFeature = 4,
///
CharInfoForce = 8,
///
CharInfoTextNoTermination = 16,
///
CharInfoMathNoTermination = 32,
///
CharInfoForceSelected = 64,
};
/// Information about a single UCS4 character
struct CharInfo {
/// LaTeX command (text mode) for this character
docstring textcommand;
/// LaTeX command (math mode) for this character
docstring mathcommand;
/// Needed LaTeX preamble (or feature) for text mode
string textpreamble;
/// Needed LaTeX preamble (or feature) for math mode
string mathpreamble;
/// Is this a combining character?
bool combining() const { return flags & CharInfoCombining ? true : false; }
/// Is \c textpreamble a feature known by LaTeXFeatures, or a raw LaTeX
/// command?
bool textfeature() const { return flags & CharInfoTextFeature ? true : false; }
/// Is \c mathpreamble a feature known by LaTeXFeatures, or a raw LaTeX
/// command?
bool mathfeature() const { return flags & CharInfoMathFeature ? true : false; }
/// Always force the LaTeX command, even if the encoding contains
/// this character?
bool force() const { return flags & CharInfoForce ? true : false; }
/// Force the LaTeX command for some encodings?
bool forceselected() const { return flags & CharInfoForceSelected ? true : false; }
/// TIPA shortcut
string tipashortcut;
/// \c textcommand needs no termination (such as {} or space).
bool textnotermination() const { return flags & CharInfoTextNoTermination ? true : false; }
/// \c mathcommand needs no termination (such as {} or space).
bool mathnotermination() const { return flags & CharInfoMathNoTermination ? true : false; }
///
unsigned int flags;
};
typedef map<char_type, CharInfo> CharInfoMap;
CharInfoMap unicodesymbols;

View File

@ -39,6 +39,59 @@ public:
};
enum CharInfoFlags {
///
CharInfoCombining = 1,
///
CharInfoTextFeature = 2,
///
CharInfoMathFeature = 4,
///
CharInfoForce = 8,
///
CharInfoTextNoTermination = 16,
///
CharInfoMathNoTermination = 32,
///
CharInfoForceSelected = 64,
};
/// Information about a single UCS4 character
class CharInfo {
public:
/// LaTeX command (text mode) for this character
docstring textcommand;
/// LaTeX command (math mode) for this character
docstring mathcommand;
/// Needed LaTeX preamble (or feature) for text mode
std::string textpreamble;
/// Needed LaTeX preamble (or feature) for math mode
std::string mathpreamble;
/// Is this a combining character?
bool combining() const { return flags & CharInfoCombining ? true : false; }
/// Is \c textpreamble a feature known by LaTeXFeatures, or a raw LaTeX
/// command?
bool textfeature() const { return flags & CharInfoTextFeature ? true : false; }
/// Is \c mathpreamble a feature known by LaTeXFeatures, or a raw LaTeX
/// command?
bool mathfeature() const { return flags & CharInfoMathFeature ? true : false; }
/// Always force the LaTeX command, even if the encoding contains
/// this character?
bool force() const { return flags & CharInfoForce ? true : false; }
/// Force the LaTeX command for some encodings?
bool forceselected() const { return flags & CharInfoForceSelected ? true : false; }
/// TIPA shortcut
std::string tipashortcut;
/// \c textcommand needs no termination (such as {} or space).
bool textnotermination() const { return flags & CharInfoTextNoTermination ? true : false; }
/// \c mathcommand needs no termination (such as {} or space).
bool mathnotermination() const { return flags & CharInfoMathNoTermination ? true : false; }
///
unsigned int flags;
};
///
class Encoding {
public: