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 sys | 10 import sys |
(...skipping 14 matching lines...) Expand all Loading... |
25 def Generate(self): | 25 def Generate(self): |
26 """Generates a Code object with the .cc for a single namespace. | 26 """Generates a Code object with the .cc for a single namespace. |
27 """ | 27 """ |
28 c = Code() | 28 c = Code() |
29 (c.Append(cpp_util.CHROMIUM_LICENSE) | 29 (c.Append(cpp_util.CHROMIUM_LICENSE) |
30 .Append() | 30 .Append() |
31 .Append(cpp_util.GENERATED_FILE_MESSAGE % self._namespace.source_file) | 31 .Append(cpp_util.GENERATED_FILE_MESSAGE % self._namespace.source_file) |
32 .Append() | 32 .Append() |
33 .Append(self._util_cc_helper.GetIncludePath()) | 33 .Append(self._util_cc_helper.GetIncludePath()) |
34 .Append('#include "%s/%s.h"' % | 34 .Append('#include "%s/%s.h"' % |
35 (self._namespace.source_file_dir, self._namespace.name)) | 35 (self._namespace.source_file_dir, self._namespace.unix_name)) |
36 ) | 36 ) |
37 includes = self._cpp_type_generator.GenerateIncludes() | 37 includes = self._cpp_type_generator.GenerateIncludes() |
38 if not includes.IsEmpty(): | 38 if not includes.IsEmpty(): |
39 (c.Concat(includes) | 39 (c.Concat(includes) |
40 .Append() | 40 .Append() |
41 ) | 41 ) |
42 | 42 |
43 (c.Append() | 43 (c.Append() |
44 .Append('using base::Value;') | 44 .Append('using base::Value;') |
45 .Append('using base::DictionaryValue;') | 45 .Append('using base::DictionaryValue;') |
(...skipping 613 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
659 """ | 659 """ |
660 return (self._cpp_type_generator.GetReferencedProperty(prop).type_ == | 660 return (self._cpp_type_generator.GetReferencedProperty(prop).type_ == |
661 PropertyType.ARRAY) | 661 PropertyType.ARRAY) |
662 | 662 |
663 def _IsFundamentalOrFundamentalRef(self, prop): | 663 def _IsFundamentalOrFundamentalRef(self, prop): |
664 """Determines if this property is a Fundamental type or is a ref to a | 664 """Determines if this property is a Fundamental type or is a ref to a |
665 Fundamental type. | 665 Fundamental type. |
666 """ | 666 """ |
667 return (self._cpp_type_generator.GetReferencedProperty(prop).type_. | 667 return (self._cpp_type_generator.GetReferencedProperty(prop).type_. |
668 is_fundamental) | 668 is_fundamental) |
OLD | NEW |