src/ccutil/unicharset.cpp
void UNICHARSET::set_black_and_whitelist(const char *blacklist,
                                         const char *whitelist,
                                         const char *unblacklist) {
  bool def_enabled = whitelist == nullptr || whitelist[0] == '\0';
  // Set everything to default
  for (auto &uc : unichars) {
    uc.properties.enabled = def_enabled;
  }
  if (!def_enabled) {
    // Enable the whitelist.
    std::vector<UNICHAR_ID> encoding;
    encode_string(whitelist, false, &encoding, nullptr, nullptr);
    for (auto it : encoding) {
      if (it != INVALID_UNICHAR_ID) {
        unichars[it].properties.enabled = true;
      }
    }
  }
  if (blacklist != nullptr && blacklist[0] != '\0') {
    // Disable the blacklist.
    std::vector<UNICHAR_ID> encoding;
    encode_string(blacklist, false, &encoding, nullptr, nullptr);
    for (auto it : encoding) {
      if (it != INVALID_UNICHAR_ID) {
        unichars[it].properties.enabled = false;
      }
    }
  }
  if (unblacklist != nullptr && unblacklist[0] != '\0') {
    // Re-enable the unblacklist.
    std::vector<UNICHAR_ID> encoding;
    encode_string(unblacklist, false, &encoding, nullptr, nullptr);
    for (auto it : encoding) {
      if (it != INVALID_UNICHAR_ID) {
        unichars[it].properties.enabled = true;
      }
    }
  }
}
// Set a whitelist and/or blacklist of characters to recognize.
// An empty or nullptr whitelist enables everything (minus any blacklist).
// An empty or nullptr blacklist disables nothing.
// An empty or nullptr blacklist has no effect.
Set a whitelist and/or blacklist of characters to recognize.
An empty or nullptr whitelist enables everything (minus any blacklist).
An empty or nullptr blacklist disables nothing.
An empty or nullptr blacklist has no effect.
Set a whitelist and / or blacklist of characters to recognize . An empty or nullptr whitelist enables everything ( minus any blacklist ) . An empty or nullptr blacklist disables nothing . An empty or nullptr blacklist has no effect .
void UNICHARSET::set_black_and_whitelist(const char *blacklist,
                                         const char *whitelist,
                                         const char *unblacklist) {
  bool def_enabled = whitelist == nullptr || whitelist[0] == '\0';
  for (auto &uc : unichars) {
    uc.properties.enabled = def_enabled;
  }
  if (!def_enabled) {
    std::vector<UNICHAR_ID> encoding;
    encode_string(whitelist, false, &encoding, nullptr, nullptr);
    for (auto it : encoding) {
      if (it != INVALID_UNICHAR_ID) {
        unichars[it].properties.enabled = true;
      }
    }
  }
  if (blacklist != nullptr && blacklist[0] != '\0') {
    std::vector<UNICHAR_ID> encoding;
    encode_string(blacklist, false, &encoding, nullptr, nullptr);
    for (auto it : encoding) {
      if (it != INVALID_UNICHAR_ID) {
        unichars[it].properties.enabled = false;
      }
    }
  }
  if (unblacklist != nullptr && unblacklist[0] != '\0') {
    std::vector<UNICHAR_ID> encoding;
    encode_string(unblacklist, false, &encoding, nullptr, nullptr);
    for (auto it : encoding) {
      if (it != INVALID_UNICHAR_ID) {
        unichars[it].properties.enabled = true;
      }
    }
  }
}
void UNICHARSET :: set_black_and_whitelist ( const char * blacklist , const char * whitelist , const char * unblacklist ) { bool def_enabled = whitelist == nullptr || whitelist [ 0 ] == ' \0 ' ; for ( auto & uc : unichars ) { uc . properties . enabled = def_enabled ; } if ( ! def_enabled ) { std :: vector < UNICHAR_ID > encoding ; encode_string ( whitelist , false , & encoding , nullptr , nullptr ) ; for ( auto it : encoding ) { if ( it != INVALID_UNICHAR_ID ) { unichars [ it ] . properties . enabled = true ; } } } if ( blacklist != nullptr && blacklist [ 0 ] != ' \0 ' ) { std :: vector < UNICHAR_ID > encoding ; encode_string ( blacklist , false , & encoding , nullptr , nullptr ) ; for ( auto it : encoding ) { if ( it != INVALID_UNICHAR_ID ) { unichars [ it ] . properties . enabled = false ; } } } if ( unblacklist != nullptr && unblacklist [ 0 ] != ' \0 ' ) { std :: vector < UNICHAR_ID > encoding ; encode_string ( unblacklist , false , & encoding , nullptr , nullptr ) ; for ( auto it : encoding ) { if ( it != INVALID_UNICHAR_ID ) { unichars [ it ] . properties . enabled = true ; } } } }
Set a whitelist and/or blacklist of characters to recognize.
Set a whitelist and / or blacklist of characters to recognize .
// Set everything to default // Enable the whitelist. // Disable the blacklist. // Re-enable the unblacklist.