use std::collections::HashMap;
pub struct ElemLocaleFormat {
date_regex: String,
date_replace: String,
integer_regex: String,
integer_replace: String,
decimal_regex: String,
decimal_replace: String,
currency_regex: String,
currency_replace: String,
}
impl ElemLocaleFormat {
#[allow(clippy::too_many_arguments)]
pub fn new(
date_regex_param: &str,
date_replace_param: &str,
integer_regex_param: &str,
integer_replace_param: &str,
decimal_regex_param: &str,
decimal_replace_param: &str,
currency_regex_param: &str,
currency_replace_param: &str,
) -> ElemLocaleFormat {
ElemLocaleFormat {
date_regex: String::from(date_regex_param),
date_replace: String::from(date_replace_param),
integer_regex: String::from(integer_regex_param),
integer_replace: String::from(integer_replace_param),
decimal_regex: String::from(decimal_regex_param),
decimal_replace: String::from(decimal_replace_param),
currency_regex: String::from(currency_regex_param),
currency_replace: String::from(currency_replace_param),
}
}
pub fn copy(&self) -> ElemLocaleFormat {
ElemLocaleFormat::new(
self.date_regex(),
self.date_replace(),
self.integer_regex(),
self.integer_replace(),
self.decimal_regex(),
self.decimal_replace(),
self.currency_regex(),
self.currency_replace(),
)
}
pub fn date_regex(&self) -> &str {
self.date_regex.as_str()
}
pub fn date_replace(&self) -> &str {
self.date_replace.as_str()
}
pub fn integer_regex(&self) -> &str {
self.integer_regex.as_str()
}
pub fn integer_replace(&self) -> &str {
self.integer_replace.as_str()
}
pub fn decimal_regex(&self) -> &str {
self.decimal_regex.as_str()
}
pub fn decimal_replace(&self) -> &str {
self.decimal_replace.as_str()
}
pub fn currency_regex(&self) -> &str {
self.currency_regex.as_str()
}
pub fn currency_replace(&self) -> &str {
self.currency_replace.as_str()
}
}
pub struct ElemLocale {
locale_str: String,
currency_code: String,
decimal_digits: usize,
format_in: ElemLocaleFormat,
format_out: ElemLocaleFormat,
resources: HashMap<String, String>,
}
impl ElemLocale {
pub fn new(
locale_str_param: &str,
currency_code_param: &str,
decimal_digits_param: usize,
format_in_param: ElemLocaleFormat,
format_out_param: ElemLocaleFormat,
resources_param: HashMap<String, String>,
) -> ElemLocale {
ElemLocale {
locale_str: String::from(locale_str_param),
currency_code: String::from(currency_code_param),
decimal_digits: decimal_digits_param,
format_in: format_in_param,
format_out: format_out_param,
resources: resources_param,
}
}
pub fn locale_str(&self) -> &str {
self.locale_str.as_str()
}
pub fn currency_code(&self) -> &str {
self.currency_code.as_str()
}
pub fn decimal_digits(&self) -> usize {
self.decimal_digits
}
pub fn format_in(&self) -> &ElemLocaleFormat {
&self.format_in
}
pub fn format_out(&self) -> &ElemLocaleFormat {
&self.format_out
}
pub fn resources(&self) -> &HashMap<String, String> {
&self.resources
}
}