<HTML><HEAD><link type="text/css" href="../css/main_styles.css" rel="stylesheet"></HEAD>
<BODY><TITLE>%mqc_check_file_name</TITLE><H1>%mqc_check_file_name </H1><P CLASS="Paragraph">Classname: <B>%mqc_check_file_name </B></P><P CLASS="Paragraph">Inherits from: <B><A href=..\checkmate\xug_base_checker.html>%ug_base_checker </A></B></P><PRE STYLE=\"text-align : left;\" CLASS=\"Code\"> </PRE><PRE STYLE=\"text-align : left;\" CLASS=\"Code\"> 
<B>Description:</B>
    Check the current working part file name matching to the string pattern described as regular expression
 Parameters:
       (String ) file_name_rexp:     - (required) Regular expression to describe file name pattern.
                                       
<B>Example:</B> a regular expression like this "[0-9]{2,5}\.prt"
                                       means the part name must consist of 2 to 5 numberic character
                                       followed by the extension ".prt"
    (Boolean)  disabled?        -  If it is true, the checker is disabled.
                                     Default is False.
    (Boolean)  save_log_in_part -  The flag indicates whether the checking results can
                                     be saved to the part file
                                     Default is True.
       (Integer) log_type:           -  (optional) Indicate which logging type to use to report
                                           the violation
                                           1 - log error
                                           2 - log warning
                                           3 - log information
                                        The default value is 1 which is to log error.
       (String)  log_msg:               -  (optional) User defined message to be added when the system
                                           reports the violation.
                                           The default is no additional message.
 Results:
   PASS - if file name matches the pattern specified in the regular expression
   FAILED - if file name does not match the pattern
============================================================================================
Tips of configuring a file naming checker from this template:
(Analysis -> Check-Mate -> Author a test -> Configure Checker
  Configure a new checker from this template by providing the required parameters:
    1. (Must) provide a unique class name (No spaces allowed in the class name)
    2. Change the Test Category "Template.File Name"
    3. (Must) specify the regular expression for file name matching pattern
    4. (Optional) change log type if you do not like it to report "FAILED"
        (Integer)    log_type:   1;
=============================================================================================
</PRE><PRE><FONT COLOR= blue>DefClass: %mqc_check_file_name( %ug_base_checker );
</FONT></PRE><PRE STYLE=\"text-align : left;\" CLASS=\"Code\">  Check-Mate attributes and parameters </PRE><DIV><PRE STYLE=\"text-align : left;\" CLASS=\"Code\"><FONT COLOR=blue>( String )                        %test_category: "Template.File Name";
( String )                        %displayed_name: "Check File Name";

</SPAN></FONT></PRE></DIV><DIV><PRE STYLE=\"text-align : left;\" CLASS=\"Code\"><FONT COLOR=blue>( Boolean Parameter )             disabled?: false;
( Boolean Parameter )             save_log_in_part: true;
</SPAN></FONT></PRE></DIV><PRE STYLE=\"text-align : left;\" CLASS=\"Code\">  Checker specific parameters and attributes</PRE><DIV><PRE STYLE=\"text-align : left;\" CLASS=\"Code\"><FONT COLOR=blue>( String Parameter )             file_name_rexp: "";
</SPAN></FONT></PRE></DIV><PRE STYLE=\"text-align : left;\" CLASS=\"Code\">  parameter for log_option                                       </PRE><DIV><PRE STYLE=\"text-align : left;\" CLASS=\"Code\"><FONT COLOR=blue>( String )                       file_name_rexp_label: %ug_MSGTXT("File Name Pattern in Regular Expression");

</SPAN></FONT></PRE></DIV><DIV><PRE STYLE=\"text-align : left;\" CLASS=\"Code\"><FONT COLOR=blue>( List )                         log_type_option: { LOG_ERROR, LOG_WARNING, LOG_INFO };
( String )                       log_type_label: "Log Option";

 # parameter for log_message     
</SPAN></FONT></PRE></DIV><DIV><PRE STYLE=\"text-align : left;\" CLASS=\"Code\"><FONT COLOR=blue>( Integer Parameter Modifiable ) log_type: 1;
( String Parameter )              log_msg: "";
</SPAN></FONT></PRE></DIV><PRE STYLE=\"text-align : left;\" CLASS=\"Code\">  checking ...</PRE><DIV><PRE STYLE=\"text-align : left;\" CLASS=\"Code\"><FONT COLOR=blue>( String )                        log_msg_label: "Log Message";


</SPAN></FONT></PRE></DIV><DIV><PRE STYLE=\"text-align : left;\" CLASS=\"Code\"><FONT COLOR=blue>( Any Uncached ) do_check: 
@{ 
      If  file_name_rexp: = ""
      Then  ug_mqc_empty_param_warning()
      Else If ug_rexp_is_valid(file_name_rexp:) Then 
      @{ 
            $file_name << ug_askCurrentWorkpart();
            If  -( Ug_rexp_match( $file_name, file_name_rexp: ) )
            Then
            @{
                  $usr_msg << If ( "" = log_msg: ) Then "" Else log_msg: + "~n";

                  $detail_msg << 
                          %ug_MSGTXT( "File name does not match the pattern specified in regular expression. ~n File name: ") 
                          + $file_name 
                          + %ug_MSGTXT( ".~n Regular expression: " ) + file_name_rexp: + ".";
 
                  ug_mqc_log( Nth( log_type:, log_type_option: ), {}, $usr_msg + $detail_msg );
            }
            Else
                donothing;
      }
      Else
          ug_mqc_log( LOG_WARNING, {}, "Invalid regular expression" );
};


</SPAN></FONT></PRE></DIV></TABLE><p class=EndLine>&nbsp;</p><p class=blank>&nbsp;</p></BODY></HTML>