2021-04-28 20:30:34 +02:00
/*
* ConfigPlist . cpp
*
* Created on : Oct 9 , 2020
* Author : jief
*/
# include "ConfigPlistClass.h"
# include "Config_ACPI.h"
# include "../../cpp_lib/XmlLiteSimpleTypes.h"
# include "../../cpp_lib/XmlLiteParser.h"
2021-09-28 15:54:31 +02:00
XmlAbstractType & ConfigPlistClass : : ACPI_Class : : DSDT_Class : : ACPI_DSDT_Fixes_Class : : parseValueFromXmlLite ( XmlLiteParser * xmlLiteParser , const XString8 & xmlPath , XBool generateErrors , const XmlParserPosition & keyPos , const char * keyValue , size_t keyValueLength , XBool * keyFound )
2021-04-28 20:30:34 +02:00
{
2021-05-19 14:11:21 +02:00
# ifdef JIEF_DEBUG
if ( strncmp ( keyValue , " FixHeaders " , strlen ( " FixHeaders " ) ) = = 0 ) {
NOP ;
}
# endif
2021-04-28 20:30:34 +02:00
for ( size_t idx = 0 ; idx < sizeof ( ACPI_DSDT_Fixe_Array ) / sizeof ( ACPI_DSDT_Fixe_Array [ 0 ] ) ; idx + + )
{
if ( ACPI_DSDT_Fixe_Array [ idx ] . getNewName ( ) & & strnIsEqualIC ( keyValue , keyValueLength , ACPI_DSDT_Fixe_Array [ idx ] . getNewName ( ) ) ) {
// new name
if ( ACPI_DSDT_Fixe_Array [ idx ] . oldEnabled . isDefined ( ) ) {
xmlLiteParser - > addWarning ( true , S8Printf ( " Tag '%s:%d' was already defined with the old name '%s'. Previous value ignored. " , xmlPath . c_str ( ) , keyPos . getLine ( ) , ACPI_DSDT_Fixe_Array [ idx ] . m_oldName ) ) ;
ACPI_DSDT_Fixe_Array [ idx ] . oldEnabled . reset ( ) ;
}
if ( ACPI_DSDT_Fixe_Array [ idx ] . newEnabled . isDefined ( ) ) {
xmlLiteParser - > addWarning ( true , S8Printf ( " Tag '%s:%d' was already defined. Previous value ignored. " , xmlPath . c_str ( ) , keyPos . getLine ( ) ) ) ;
ACPI_DSDT_Fixe_Array [ idx ] . newEnabled . reset ( ) ;
}
ACPI_DSDT_Fixe_Array [ idx ] . newEnabled . parseFromXmlLite ( xmlLiteParser , xmlPath , true ) ;
2021-05-19 14:11:21 +02:00
ACPI_DSDT_Fixe_Array [ idx ] . setDefined ( ) ;
2021-04-28 20:30:34 +02:00
* keyFound = true ;
return ACPI_DSDT_Fixe_Array [ idx ] . newEnabled ;
} else
if ( ACPI_DSDT_Fixe_Array [ idx ] . m_oldName & & strnIsEqualIC ( keyValue , keyValueLength , ACPI_DSDT_Fixe_Array [ idx ] . m_oldName ) ) {
// old name
if ( ACPI_DSDT_Fixe_Array [ idx ] . newEnabled . isDefined ( ) ) {
xmlLiteParser - > addWarning ( true , S8Printf ( " Tag '%s:%d' was already defined with the new name '%s'. Previous value ignored. " , xmlPath . c_str ( ) , keyPos . getLine ( ) , ACPI_DSDT_Fixe_Array [ idx ] . getNewName ( ) ) ) ;
ACPI_DSDT_Fixe_Array [ idx ] . newEnabled . reset ( ) ;
}
if ( ACPI_DSDT_Fixe_Array [ idx ] . oldEnabled . isDefined ( ) ) {
xmlLiteParser - > addWarning ( true , S8Printf ( " Tag '%s:%d' was already defined. Previous value ignored. " , xmlPath . c_str ( ) , keyPos . getLine ( ) ) ) ;
ACPI_DSDT_Fixe_Array [ idx ] . oldEnabled . reset ( ) ;
}
ACPI_DSDT_Fixe_Array [ idx ] . oldEnabled . parseFromXmlLite ( xmlLiteParser , xmlPath , true ) ;
2021-05-19 14:11:21 +02:00
ACPI_DSDT_Fixe_Array [ idx ] . setDefined ( ) ;
2021-04-28 20:30:34 +02:00
* keyFound = true ;
return ACPI_DSDT_Fixe_Array [ idx ] . oldEnabled ;
}
}
2021-05-04 12:03:40 +02:00
* keyFound = false ;
2021-04-28 20:30:34 +02:00
return nullXmlType ;
}