Inheritance: column_formatter_base
Exemple #1
0
        // note: it's possible to create a valid formatter, and have an error. Like, when the syntax is partially right
        //       In that case, I will just use what is valid
        private static column_formatter_base create_formatter(string name, string syntax, ref string error)
        {
            error = "";
            column_formatter_base result = null;

            switch (name)
            {
            case "cell":
                result = new cell();
                break;

            case "format":
                result = new column_formatters.format();
                break;

            case "picture":
                result = new picture();
                break;

            case "stack_trace":
            case "stack-trace":
                result = new stack_trace();
                break;

            case "xml":
                result = new xml();
                break;

            default:
                error = "Invalid formatter name: " + name;
                break;
            }
            // load_syntax
            if (result != null)
            {
                try {
                    result.load_syntax(new settings_as_string(syntax), ref error);
                } catch (Exception e) {
                    logger.Error("can't load formatter " + e.Message);
                    error = "Cannot load " + name + ". Invalid syntax";
                }
            }
            return(result);
        }
 // note: it's possible to create a valid formatter, and have an error. Like, when the syntax is partially right
 //       In that case, I will just use what is valid
 private static column_formatter_base create_formatter(string name, string syntax, ref string error) {
     error = "";
     column_formatter_base result = null;
     switch (name) {
     case "cell":
         result = new cell();
         break;
     case "format":
         result = new column_formatters.format();
         break;
     case "picture":
         result = new picture();
         break;
     case "stack_trace":
     case "stack-trace":
         result = new stack_trace();
         break;
     case "xml":
         result = new xml();
         break;
     default:
         error = "Invalid formatter name: " + name;
         break;
     }
     // load_syntax
     if (result != null)
         try {
             result.load_syntax(new settings_as_string(syntax), ref error);
         } catch (Exception e) {
             logger.Error("can't load formatter " + e.Message);
             error = "Cannot load " + name + ". Invalid syntax";
         }
     return result;
 }