OLD | NEW |
1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 | 4 |
5 from code import Code | 5 from code import Code |
6 from model import PropertyType | 6 from model import PropertyType |
7 import any_helper | 7 import any_helper |
8 import cpp_util | 8 import cpp_util |
9 import model | 9 import model |
10 import schema_util | 10 import schema_util |
(...skipping 15 matching lines...) Expand all Loading... |
26 def Generate(self): | 26 def Generate(self): |
27 """Generates a Code object with the .cc for a single namespace. | 27 """Generates a Code object with the .cc for a single namespace. |
28 """ | 28 """ |
29 c = Code() | 29 c = Code() |
30 (c.Append(cpp_util.CHROMIUM_LICENSE) | 30 (c.Append(cpp_util.CHROMIUM_LICENSE) |
31 .Append() | 31 .Append() |
32 .Append(cpp_util.GENERATED_FILE_MESSAGE % self._namespace.source_file) | 32 .Append(cpp_util.GENERATED_FILE_MESSAGE % self._namespace.source_file) |
33 .Append() | 33 .Append() |
34 .Append(self._util_cc_helper.GetIncludePath()) | 34 .Append(self._util_cc_helper.GetIncludePath()) |
35 .Append('#include "%s/%s.h"' % | 35 .Append('#include "%s/%s.h"' % |
36 (self._namespace.source_file_dir, self._namespace.name)) | 36 (self._namespace.source_file_dir, self._namespace.unix_name)) |
37 ) | 37 ) |
38 includes = self._cpp_type_generator.GenerateIncludes() | 38 includes = self._cpp_type_generator.GenerateIncludes() |
39 if not includes.IsEmpty(): | 39 if not includes.IsEmpty(): |
40 (c.Concat(includes) | 40 (c.Concat(includes) |
41 .Append() | 41 .Append() |
42 ) | 42 ) |
43 | 43 |
44 (c.Append() | 44 (c.Append() |
45 .Append('using base::Value;') | 45 .Append('using base::Value;') |
46 .Append('using base::DictionaryValue;') | 46 .Append('using base::DictionaryValue;') |
(...skipping 613 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
660 """ | 660 """ |
661 return (self._cpp_type_generator.GetReferencedProperty(prop).type_ == | 661 return (self._cpp_type_generator.GetReferencedProperty(prop).type_ == |
662 PropertyType.ARRAY) | 662 PropertyType.ARRAY) |
663 | 663 |
664 def _IsFundamentalOrFundamentalRef(self, prop): | 664 def _IsFundamentalOrFundamentalRef(self, prop): |
665 """Determines if this property is a Fundamental type or is a ref to a | 665 """Determines if this property is a Fundamental type or is a ref to a |
666 Fundamental type. | 666 Fundamental type. |
667 """ | 667 """ |
668 return (self._cpp_type_generator.GetReferencedProperty(prop).type_. | 668 return (self._cpp_type_generator.GetReferencedProperty(prop).type_. |
669 is_fundamental) | 669 is_fundamental) |
OLD | NEW |