+char InsetQuotesParams::getStyleChar(QuoteStyle const & style) const
+{
+ return style_char[static_cast<int>(style)];
+}
+
+
+QuoteStyle InsetQuotesParams::getQuoteStyle(string const & s,
+ bool const allow_wildcards, QuoteStyle fb) const
+{
+ QuoteStyle res = fb;
+
+ string str = s;
+ if (str.length() != 3) {
+ LYXERR0("ERROR (InsetQuotes::InsetQuotes):"
+ " bad string length.");
+ str = "eld";
+ }
+
+ // '.' wildcard means: keep current style
+ if (!allow_wildcards || str[0] != '.') {
+ int i;
+ for (i = 0; i < stylescount(); ++i) {
+ if (str[0] == style_char[i]) {
+ res = QuoteStyle(i);
+ break;
+ }
+ }
+ if (i >= stylescount()) {
+ LYXERR0("ERROR (InsetQuotes::InsetQuotes):"
+ " bad style specification.");
+ res = QuoteStyle::English;
+ }
+ }
+
+ return res;
+}
+
+
+QuoteSide InsetQuotesParams::getQuoteSide(string const & s,
+ bool const allow_wildcards, QuoteSide fb) const
+{
+ QuoteSide res = fb;
+
+ string str = s;
+ if (str.length() != 3) {
+ LYXERR0("ERROR (InsetQuotes::InsetQuotes):"
+ " bad string length.");
+ str = "eld";
+ }
+
+ // '.' wildcard means: keep current side
+ if (!allow_wildcards || str[1] != '.') {
+ int i;
+ for (i = 0; i < 2; ++i) {
+ if (str[1] == side_char[i]) {
+ res = QuoteSide(i);
+ break;
+ }
+ }
+ if (i >= 2) {
+ LYXERR0("ERROR (InsetQuotes::InsetQuotes):"
+ " bad side specification.");
+ res = QuoteSide::Opening;
+ }
+ }
+
+ return res;
+}
+
+
+QuoteLevel InsetQuotesParams::getQuoteLevel(string const & s,
+ bool const allow_wildcards, QuoteLevel fb) const
+{
+ QuoteLevel res = fb;
+
+ string str = s;
+ if (str.length() != 3) {
+ LYXERR0("ERROR (InsetQuotes::InsetQuotes):"
+ " bad string length.");
+ str = "eld";
+ }
+
+ // '.' wildcard means: keep current level
+ if (!allow_wildcards || str[2] != '.') {
+ int i;
+ for (i = 0; i < 2; ++i) {
+ if (str[2] == level_char[i]) {
+ res = QuoteLevel(i);
+ break;
+ }
+ }
+ if (i >= 2) {
+ LYXERR0("ERROR (InsetQuotes::InsetQuotes):"
+ " bad level specification.");
+ res = QuoteLevel::Primary;
+ }
+ }
+
+ return res;
+}
+
+