tools/json_schema_compiler/cpp_bundle_generator.py
def _GetPlatformIfdefs(self, model_object):
    """Generates the "defined" conditional for an #if check if |model_object|
    has platform restrictions. Returns None if there are no restrictions.
    """
    if model_object.platforms is None:
      return None
    ifdefs = []
    for platform in model_object.platforms:
      if platform == Platforms.CHROMEOS:
        # TODO(https://crbug.com/1052397): For readability, this should become
        # defined(OS_CHROMEOS) && BUILDFLAG(IS_CHROMEOS_ASH).
        ifdefs.append('(defined(OS_CHROMEOS) && '
                      '!BUILDFLAG(IS_CHROMEOS_LACROS))')
      elif platform == Platforms.LACROS:
        # TODO(https://crbug.com/1052397): For readability, this should become
        # defined(OS_CHROMEOS) && BUILDFLAG(IS_CHROMEOS_LACROS).
        ifdefs.append('BUILDFLAG(IS_CHROMEOS_LACROS)')
      elif platform == Platforms.LINUX:
        ifdefs.append('(defined(OS_LINUX) && !defined(OS_CHROMEOS))')
      elif platform == Platforms.MAC:
        ifdefs.append('defined(OS_MAC)')
      elif platform == Platforms.WIN:
        ifdefs.append('defined(OS_WIN)')
      else:
        raise ValueError("Unsupported platform ifdef: %s" % platform.name)
    return ' || '.join(ifdefs)
Generates the "defined" conditional for an #if check if |model_object|
    has platform restrictions. Returns None if there are no restrictions.
    
Generates the "defined" conditional for an #if check if |model_object|
has platform restrictions. Returns None if there are no restrictions.
Generates the " defined " conditional for an #if check if |model_object| has platform restrictions . Returns None if there are no restrictions .
def _GetPlatformIfdefs(self, model_object):
    if model_object.platforms is None:
      return None
    ifdefs = []
    for platform in model_object.platforms:
      if platform == Platforms.CHROMEOS:
        ifdefs.append('(defined(OS_CHROMEOS) && '
                      '!BUILDFLAG(IS_CHROMEOS_LACROS))')
      elif platform == Platforms.LACROS:
        ifdefs.append('BUILDFLAG(IS_CHROMEOS_LACROS)')
      elif platform == Platforms.LINUX:
        ifdefs.append('(defined(OS_LINUX) && !defined(OS_CHROMEOS))')
      elif platform == Platforms.MAC:
        ifdefs.append('defined(OS_MAC)')
      elif platform == Platforms.WIN:
        ifdefs.append('defined(OS_WIN)')
      else:
        raise ValueError("Unsupported platform ifdef: %s" % platform.name)
    return ' || '.join(ifdefs)
def _GetPlatformIfdefs ( self , model_object ) : if model_object . platforms is None : return None ifdefs = [ ] for platform in model_object . platforms : if platform == Platforms . CHROMEOS : ifdefs . append ( '(defined(OS_CHROMEOS) && ' '!BUILDFLAG(IS_CHROMEOS_LACROS))' ) elif platform == Platforms . LACROS : ifdefs . append ( 'BUILDFLAG(IS_CHROMEOS_LACROS)' ) elif platform == Platforms . LINUX : ifdefs . append ( '(defined(OS_LINUX) && !defined(OS_CHROMEOS))' ) elif platform == Platforms . MAC : ifdefs . append ( 'defined(OS_MAC)' ) elif platform == Platforms . WIN : ifdefs . append ( 'defined(OS_WIN)' ) else : raise ValueError ( "Unsupported platform ifdef: %s" % platform . name ) return ' || ' . join ( ifdefs )
Generates the "defined" conditional for an #if check if |model_object|
has platform restrictions.
Generates the " defined " conditional for an #if check if |model_object| has platform restrictions .
"""Generates the "defined" conditional for an #if check if |model_object|
    has platform restrictions. Returns None if there are no restrictions.
    """ # TODO(https://crbug.com/1052397): For readability, this should become # defined(OS_CHROMEOS) && BUILDFLAG(IS_CHROMEOS_ASH). # TODO(https://crbug.com/1052397): For readability, this should become # defined(OS_CHROMEOS) && BUILDFLAG(IS_CHROMEOS_LACROS).
self
model_object