tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

CollatorOptionsV1.hpp (2257B)


      1 #ifndef icu4x_CollatorOptionsV1_HPP
      2 #define icu4x_CollatorOptionsV1_HPP
      3 
      4 #include "CollatorOptionsV1.d.hpp"
      5 
      6 #include <stdio.h>
      7 #include <stdint.h>
      8 #include <stddef.h>
      9 #include <stdbool.h>
     10 #include <memory>
     11 #include <functional>
     12 #include <optional>
     13 #include <cstdlib>
     14 #include "../diplomat_runtime.hpp"
     15 #include "CollatorAlternateHandling.hpp"
     16 #include "CollatorCaseLevel.hpp"
     17 #include "CollatorMaxVariable.hpp"
     18 #include "CollatorStrength.hpp"
     19 
     20 
     21 namespace icu4x {
     22 namespace capi {
     23    extern "C" {
     24 
     25    } // extern "C"
     26 } // namespace capi
     27 } // namespace
     28 
     29 
     30 inline icu4x::capi::CollatorOptionsV1 icu4x::CollatorOptionsV1::AsFFI() const {
     31  return icu4x::capi::CollatorOptionsV1 {
     32    /* .strength = */ strength.has_value() ? (icu4x::capi::CollatorStrength_option{ { strength.value().AsFFI() }, true }) : (icu4x::capi::CollatorStrength_option{ {}, false }),
     33    /* .alternate_handling = */ alternate_handling.has_value() ? (icu4x::capi::CollatorAlternateHandling_option{ { alternate_handling.value().AsFFI() }, true }) : (icu4x::capi::CollatorAlternateHandling_option{ {}, false }),
     34    /* .max_variable = */ max_variable.has_value() ? (icu4x::capi::CollatorMaxVariable_option{ { max_variable.value().AsFFI() }, true }) : (icu4x::capi::CollatorMaxVariable_option{ {}, false }),
     35    /* .case_level = */ case_level.has_value() ? (icu4x::capi::CollatorCaseLevel_option{ { case_level.value().AsFFI() }, true }) : (icu4x::capi::CollatorCaseLevel_option{ {}, false }),
     36  };
     37 }
     38 
     39 inline icu4x::CollatorOptionsV1 icu4x::CollatorOptionsV1::FromFFI(icu4x::capi::CollatorOptionsV1 c_struct) {
     40  return icu4x::CollatorOptionsV1 {
     41    /* .strength = */ c_struct.strength.is_ok ? std::optional(icu4x::CollatorStrength::FromFFI(c_struct.strength.ok)) : std::nullopt,
     42    /* .alternate_handling = */ c_struct.alternate_handling.is_ok ? std::optional(icu4x::CollatorAlternateHandling::FromFFI(c_struct.alternate_handling.ok)) : std::nullopt,
     43    /* .max_variable = */ c_struct.max_variable.is_ok ? std::optional(icu4x::CollatorMaxVariable::FromFFI(c_struct.max_variable.ok)) : std::nullopt,
     44    /* .case_level = */ c_struct.case_level.is_ok ? std::optional(icu4x::CollatorCaseLevel::FromFFI(c_struct.case_level.ok)) : std::nullopt,
     45  };
     46 }
     47 
     48 
     49 #endif // icu4x_CollatorOptionsV1_HPP