mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-21 14:23:53 +00:00
Only allow character decoder compatibility mode if HAVE_ICU is defined since it relies on ICU to be available.
This commit is contained in:
@@ -126,8 +126,9 @@ IfcCharacterDecoder::operator std::string() {
|
|||||||
int codepage = 1;
|
int codepage = 1;
|
||||||
unsigned int hex = 0;
|
unsigned int hex = 0;
|
||||||
unsigned int hex_count = 0;
|
unsigned int hex_count = 0;
|
||||||
|
#ifdef HAVE_ICU
|
||||||
unsigned int old_hex = 0; // for compatibility_mode
|
unsigned int old_hex = 0; // for compatibility_mode
|
||||||
|
#endif
|
||||||
while ( current_char = file->Peek() ) {
|
while ( current_char = file->Peek() ) {
|
||||||
if ( EXPECTS_CHARACTER(parse_state) ) {
|
if ( EXPECTS_CHARACTER(parse_state) ) {
|
||||||
#ifdef HAVE_ICU
|
#ifdef HAVE_ICU
|
||||||
@@ -181,6 +182,7 @@ IfcCharacterDecoder::operator std::string() {
|
|||||||
if ( (hex_count == 2 && !(parse_state & EXTENDED2)) ||
|
if ( (hex_count == 2 && !(parse_state & EXTENDED2)) ||
|
||||||
(hex_count == 4 && !(parse_state & EXTENDED4)) ||
|
(hex_count == 4 && !(parse_state & EXTENDED4)) ||
|
||||||
(hex_count == 8) ) {
|
(hex_count == 8) ) {
|
||||||
|
#ifdef HAVE_ICU
|
||||||
if (compatibility_mode) {
|
if (compatibility_mode) {
|
||||||
if (old_hex == 0) {
|
if (old_hex == 0) {
|
||||||
old_hex = hex;
|
old_hex = hex;
|
||||||
@@ -193,8 +195,11 @@ IfcCharacterDecoder::operator std::string() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
#endif
|
||||||
addChar(s,(UChar32) hex);
|
addChar(s,(UChar32) hex);
|
||||||
|
#ifdef HAVE_ICU
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
if ( hex_count == 2 ) parse_state = 0;
|
if ( hex_count == 2 ) parse_state = 0;
|
||||||
else CLEAR_HEX(parse_state);
|
else CLEAR_HEX(parse_state);
|
||||||
hex = hex_count = 0;
|
hex = hex_count = 0;
|
||||||
@@ -281,13 +286,13 @@ int IfcCharacterDecoder::previous_codepage = -1;
|
|||||||
UErrorCode IfcCharacterDecoder::status = U_ZERO_ERROR;
|
UErrorCode IfcCharacterDecoder::status = U_ZERO_ERROR;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//#ifdef HAVE_ICU
|
#ifdef HAVE_ICU
|
||||||
IfcCharacterDecoder::ConversionMode IfcCharacterDecoder::mode = IfcCharacterDecoder::JSON;
|
IfcCharacterDecoder::ConversionMode IfcCharacterDecoder::mode = IfcCharacterDecoder::JSON;
|
||||||
|
|
||||||
// Many BIM software (eg. Revit, ArchiCAD, ...) has wrong behavior
|
// Many BIM software (eg. Revit, ArchiCAD, ...) has wrong behavior
|
||||||
bool IfcCharacterDecoder::compatibility_mode = false;
|
bool IfcCharacterDecoder::compatibility_mode = false;
|
||||||
std::string IfcCharacterDecoder::compatibility_charset = "";
|
std::string IfcCharacterDecoder::compatibility_charset = "";
|
||||||
|
|
||||||
//#else
|
#else
|
||||||
char IfcCharacterDecoder::substitution_character = '_';
|
char IfcCharacterDecoder::substitution_character = '_';
|
||||||
//#endif
|
#endif
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ namespace IfcParse {
|
|||||||
#endif
|
#endif
|
||||||
void addChar(std::stringstream& s,const UChar32& ch);
|
void addChar(std::stringstream& s,const UChar32& ch);
|
||||||
public:
|
public:
|
||||||
//#ifdef HAVE_ICU
|
#ifdef HAVE_ICU
|
||||||
enum ConversionMode {DEFAULT,UTF8,LATIN,JSON,PYTHON};
|
enum ConversionMode {DEFAULT,UTF8,LATIN,JSON,PYTHON};
|
||||||
static ConversionMode mode;
|
static ConversionMode mode;
|
||||||
|
|
||||||
@@ -62,9 +62,9 @@ namespace IfcParse {
|
|||||||
static bool compatibility_mode;
|
static bool compatibility_mode;
|
||||||
static std::string compatibility_charset;
|
static std::string compatibility_charset;
|
||||||
|
|
||||||
//#else
|
#else
|
||||||
static char substitution_character;
|
static char substitution_character;
|
||||||
//#endif
|
#endif
|
||||||
IfcCharacterDecoder(IfcParse::File* file);
|
IfcCharacterDecoder(IfcParse::File* file);
|
||||||
~IfcCharacterDecoder();
|
~IfcCharacterDecoder();
|
||||||
void dryRun();
|
void dryRun();
|
||||||
|
|||||||
Reference in New Issue
Block a user