tools/json_schema_compiler/h_generator.py
def _GenerateParseFromDictionary(self, type_, classname):
    # type: (Type, str) -> Code
    """Generates the ParseFromDictionary method declaration.
    """
    # Omit |key| and |error_path_reversed| argument for the top level
    # ManifestKeys type. These are an implementation detail for the inner
    # manifest types.
    if type_.IsRootManifestKeyType():
      params = [
        'const base::DictionaryValue& root_dict',
        '%s* out' % classname,
        'std::u16string* error'
      ]
      comment = (
        'Parses manifest keys for this namespace. Any keys not available to the'
        ' manifest will be ignored. On a parsing error, false is returned and '
        '|error| is populated.')
    else:
      params = [
        'const base::DictionaryValue& root_dict',
        'base::StringPiece key',
        '%s* out' % classname,
        'std::u16string* error',
        'std::vector<base::StringPiece>* error_path_reversed'
      ]
      comment = (
        'Parses the given |key| from |root_dict|. Any keys not available to the'
        ' manifest will be ignored. On a parsing error, false is returned and '
        '|error| and |error_path_reversed| are populated.')

    c = Code()
    c.Append().Comment(comment)

    # Make |generate_error_messages| False since |error| is already included
    # within |params|.
    params = self._GenerateParams(params, generate_error_messages=False)
    c.Append('static bool ParseFromDictionary(%s);' % params)
    return c
Generates the ParseFromDictionary method declaration.
    
Generates the ParseFromDictionary method declaration.
Generates the ParseFromDictionary method declaration .
def _GenerateParseFromDictionary(self, type_, classname):
    if type_.IsRootManifestKeyType():
      params = [
        'const base::DictionaryValue& root_dict',
        '%s* out' % classname,
        'std::u16string* error'
      ]
      comment = (
        'Parses manifest keys for this namespace. Any keys not available to the'
        ' manifest will be ignored. On a parsing error, false is returned and '
        '|error| is populated.')
    else:
      params = [
        'const base::DictionaryValue& root_dict',
        'base::StringPiece key',
        '%s* out' % classname,
        'std::u16string* error',
        'std::vector<base::StringPiece>* error_path_reversed'
      ]
      comment = (
        'Parses the given |key| from |root_dict|. Any keys not available to the'
        ' manifest will be ignored. On a parsing error, false is returned and '
        '|error| and |error_path_reversed| are populated.')
    c = Code()
    c.Append().Comment(comment)
    params = self._GenerateParams(params, generate_error_messages=False)
    c.Append('static bool ParseFromDictionary(%s);' % params)
    return c
def _GenerateParseFromDictionary ( self , type_ , classname ) : if type_ . IsRootManifestKeyType ( ) : params = [ 'const base::DictionaryValue& root_dict' , '%s* out' % classname , 'std::u16string* error' ] comment = ( 'Parses manifest keys for this namespace. Any keys not available to the' ' manifest will be ignored. On a parsing error, false is returned and ' '|error| is populated.' ) else : params = [ 'const base::DictionaryValue& root_dict' , 'base::StringPiece key' , '%s* out' % classname , 'std::u16string* error' , 'std::vector<base::StringPiece>* error_path_reversed' ] comment = ( 'Parses the given |key| from |root_dict|. Any keys not available to the' ' manifest will be ignored. On a parsing error, false is returned and ' '|error| and |error_path_reversed| are populated.' ) c = Code ( ) c . Append ( ) . Comment ( comment ) params = self . _GenerateParams ( params , generate_error_messages = False ) c . Append ( 'static bool ParseFromDictionary(%s);' % params ) return c
Generates the ParseFromDictionary method declaration.
Generates the ParseFromDictionary method declaration .
# type: (Type, str) -> Code """Generates the ParseFromDictionary method declaration.
    """ # Omit |key| and |error_path_reversed| argument for the top level # ManifestKeys type. These are an implementation detail for the inner # manifest types. # Make |generate_error_messages| False since |error| is already included # within |params|.
self
type_
classname