]> git.lyx.org Git - features.git/blobdiff - src/insets/InsetQuotes.h
DocBook, InsetFloat: avoid a potential nullptr dereference when detecting the type...
[features.git] / src / insets / InsetQuotes.h
index 5bc7f392696eeb72f4dbd4e561e9689af418201f..c4b525ce8c8de6757364af799779eb8cf26fd28a 100644 (file)
 
 #include "Inset.h"
 
-#include "support/docstring.h"
+#include <map>
 
 
 namespace lyx {
 
+///
+enum class QuoteStyle : int {
+       ///
+       English,
+       ///
+       Swedish,
+       ///
+       German,
+       ///
+       Polish,
+       ///
+       Swiss,
+       ///
+       Danish,
+       ///
+       Plain,
+       ///
+       British,
+       ///
+       SwedishG,
+       ///
+       French,
+       ///
+       FrenchIN,
+       ///
+       Russian,
+       ///
+       CJK,
+       ///
+       CJKAngle,
+       ///
+       Hungarian,
+       ///
+       Dynamic
+};
+
+///
+enum class QuoteSide : int {
+       ///
+       Opening,
+       ///
+       Closing
+};
+
+///
+enum class QuoteLevel : int {
+       ///
+       Secondary,
+       ///
+       Primary
+};
+
+
 /** Quotes.
   Used for the various quotes. German, English, French, all either
   double or single **/
 class InsetQuotesParams {
 public:
-       ///
-       enum QuoteStyle {
-               ///
-               EnglishQuotes,
-               ///
-               SwedishQuotes,
-               ///
-               GermanQuotes,
-               ///
-               PolishQuotes,
-               ///
-               SwissQuotes,
-               ///
-               DanishQuotes,
-               ///
-               PlainQuotes,
-               ///
-               BritishQuotes,
-               ///
-               SwedishGQuotes,
-               ///
-               FrenchQuotes,
-               ///
-               FrenchINQuotes,
-               ///
-               RussianQuotes,
-               ///
-               CJKQuotes,
-               ///
-               CJKAngleQuotes,
-               ///
-               DynamicQuotes
-       };
-       ///
-       enum QuoteSide {
-               ///
-               OpeningQuote,
-               ///
-               ClosingQuote
-       };
-       ///
-       enum QuoteLevel {
-               ///
-               SecondaryQuotes,
-               ///
-               PrimaryQuotes
-       };
        /// Returns the unicode character of a given quote
        char_type getQuoteChar(QuoteStyle const &, QuoteLevel const &,
                               QuoteSide const &, bool const rtl = false) const;
@@ -86,9 +92,9 @@ public:
        docstring getXMLQuote(char_type c) const;
        /// Returns a descriptive label of a style suitable for dialog and menu
        docstring const getGuiLabel(QuoteStyle const & qs,
-                                   bool langdef = false);
+                                   bool langdef = false) const;
        /// Returns a descriptive label of a given char
-       docstring const getShortGuiLabel(docstring const & str);
+       docstring const getShortGuiLabel(docstring const & str) const;
        ///
        int stylescount() const;
        /// Returns the matching style shortcut char
@@ -96,15 +102,15 @@ public:
        /// Returns the quote style from the shortcut string
        QuoteStyle getQuoteStyle(std::string const & s,
                bool const allow_wildcards = false,
-               QuoteStyle fallback = EnglishQuotes);
+               QuoteStyle fallback = QuoteStyle::English) const;
        /// Returns the quote sind from the shortcut string
        QuoteSide getQuoteSide(std::string const & s,
                bool const allow_wildcards = false,
-               QuoteSide fallback = OpeningQuote);
+               QuoteSide fallback = QuoteSide::Opening) const;
        /// Returns the quote level from the shortcut string
        QuoteLevel getQuoteLevel(std::string const & s,
                bool const allow_wildcards = false,
-               QuoteLevel fallback = PrimaryQuotes);
+               QuoteLevel fallback = QuoteLevel::Primary) const;
 };
 
 ///
@@ -125,7 +131,7 @@ public:
          */
        explicit InsetQuotes(Buffer * buf, std::string const & str = "eld");
        /// Direct access to inner/outer quotation marks
-       InsetQuotes(Buffer * buf, char_type c, InsetQuotesParams::QuoteLevel level,
+       InsetQuotes(Buffer * buf, char_type c, QuoteLevel level,
                    std::string const & side = std::string(),
                    std::string const & style = std::string());
        ///
@@ -184,28 +190,26 @@ private:
        ///
        docstring getQuoteEntity(bool isHTML) const;
        ///
-       InsetQuotesParams::QuoteStyle getStyle(std::string const &);
+       QuoteStyle getStyle(std::string const &);
 
        ///
-       InsetQuotesParams::QuoteStyle style_;
+       QuoteStyle style_ = QuoteStyle::English;
        ///
-       InsetQuotesParams::QuoteSide side_;
+       QuoteSide side_ = QuoteSide::Opening;
        ///
-       InsetQuotesParams::QuoteLevel level_;
+       QuoteLevel level_ = QuoteLevel::Primary;
        ///
-       InsetQuotesParams::QuoteStyle global_style_;
-       /// Current font encoding
-       std::string fontenc_;
+       QuoteStyle global_style_ = QuoteStyle::English;
        /// Code of the contextual language
        std::string context_lang_;
        /// Is this in a pass-thru context?
-       bool pass_thru_;
+       bool pass_thru_ = false;
        /// Do we use fontspec?
-       bool fontspec_;
+       bool fontspec_ = false;
        /// Do we have an internal font encoding?
-       bool internal_fontenc_;
+       bool internal_fontenc_ = false;
        /// Are we writing RTL?
-       bool rtl_;
+       bool rtl_ = false;
        ///
        friend class InsetQuotesParams;