case STRING_PATTERN:
if (pattern_value.regexp_init) regfree(&pattern_value.posix_regexp);
break;
+ case DECODE_MATCH:
+ if (dec_match->ref_count > 1) {
+ dec_match->ref_count--;
+ }
+ else if (dec_match->ref_count == 1) {
+ delete dec_match->instance;
+ delete dec_match;
+ }
+ else {
+ TTCN_error("Internal error: Invalid reference counter in a "
+ "decoded content match.");
+ }
+ break;
default:
break;
}
"not set when copying a charstring value range template.");
value_range = other_value.value_range;
break;
+ case DECODE_MATCH:
+ dec_match = other_value.dec_match;
+ dec_match->ref_count++;
+ break;
default:
TTCN_error("Copying an uninitialized/unsupported charstring template.");
}
}
return TRUE;
break; }
+ case DECODE_MATCH: {
+ TTCN_EncDec::set_error_behavior(TTCN_EncDec::ET_ALL, TTCN_EncDec::EB_WARNING);
+ TTCN_EncDec::clear_error();
+ TTCN_Buffer buff(other_value);
+ boolean ret_val = dec_match->instance->match(buff);
+ TTCN_EncDec::set_error_behavior(TTCN_EncDec::ET_ALL,TTCN_EncDec::EB_DEFAULT);
+ TTCN_EncDec::clear_error();
+ return ret_val; }
default:
TTCN_error("Matching with an uninitialized/unsupported charstring "
"template.");
value_range.min_is_set = FALSE;
value_range.max_is_set = FALSE;
break;
+ case DECODE_MATCH:
+ set_selection(DECODE_MATCH);
+ break;
default:
TTCN_error("Setting an invalid type for a charstring template.");
}
value_range.min_value);
}
+void CHARSTRING_template::set_decmatch(Dec_Match_Interface* new_instance)
+{
+ if (template_selection != DECODE_MATCH) {
+ TTCN_error("Setting the decoded content matching mechanism of a non-decmatch "
+ "charstring template.");
+ }
+ dec_match = new unichar_decmatch_struct;
+ dec_match->ref_count = 1;
+ dec_match->instance = new_instance;
+ // the character coding is only used if this template is copied to a
+ // universal charstring template
+ dec_match->coding = CharCoding::UTF_8;
+}
+
void CHARSTRING_template::log_pattern(int n_chars, const char *chars_ptr)
{
TTCN_Logger::log_event_str("pattern \"");
} else TTCN_Logger::log_event_str("<unknown upper bound>");
TTCN_Logger::log_char(')');
break;
+ case DECODE_MATCH:
+ TTCN_Logger::log_event_str("decmatch ");
+ dec_match->instance->log();
+ break;
default:
log_generic();
}
case STRING_PATTERN:
mp = new Module_Param_Pattern(mcopystr(single_value));
break;
+ case DECODE_MATCH:
+ mp->error("Referencing a decoded content matching template is not supported.");
+ break;
default:
break;
}