OLD | NEW |
---|---|
1 # Copyright (C) 2013 Google Inc. All rights reserved. | 1 # Copyright (C) 2013 Google Inc. All rights reserved. |
2 # | 2 # |
3 # Redistribution and use in source and binary forms, with or without | 3 # Redistribution and use in source and binary forms, with or without |
4 # modification, are permitted provided that the following conditions are | 4 # modification, are permitted provided that the following conditions are |
5 # met: | 5 # met: |
6 # | 6 # |
7 # * Redistributions of source code must retain the above copyright | 7 # * Redistributions of source code must retain the above copyright |
8 # notice, this list of conditions and the following disclaimer. | 8 # notice, this list of conditions and the following disclaimer. |
9 # * Redistributions in binary form must reproduce the above | 9 # * Redistributions in binary form must reproduce the above |
10 # copyright notice, this list of conditions and the following disclaimer | 10 # copyright notice, this list of conditions and the following disclaimer |
(...skipping 703 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
714 | 714 |
715 def literal_cpp_value(idl_type, idl_literal): | 715 def literal_cpp_value(idl_type, idl_literal): |
716 """Converts an expression that is a valid C++ literal for this type.""" | 716 """Converts an expression that is a valid C++ literal for this type.""" |
717 # FIXME: add validation that idl_type and idl_literal are compatible | 717 # FIXME: add validation that idl_type and idl_literal are compatible |
718 literal_value = str(idl_literal) | 718 literal_value = str(idl_literal) |
719 if idl_type.base_type in CPP_UNSIGNED_TYPES: | 719 if idl_type.base_type in CPP_UNSIGNED_TYPES: |
720 return literal_value + 'u' | 720 return literal_value + 'u' |
721 return literal_value | 721 return literal_value |
722 | 722 |
723 IdlType.literal_cpp_value = literal_cpp_value | 723 IdlType.literal_cpp_value = literal_cpp_value |
724 | |
725 | |
726 def is_nullable_simple(idl_type): | |
727 # Nullable type where the corresponding C++ type supports a null value. | |
haraken
2014/07/10 14:43:57
Let's add a comment about what C++ type supports i
Jens Widell
2014/07/10 14:56:44
Done.
| |
728 return idl_type.is_nullable and ( | |
729 (idl_type.is_string_type or idl_type.is_wrapper_type) and | |
730 not idl_type.native_array_element_type) | |
731 | |
732 IdlType.is_nullable_simple = property(is_nullable_simple) | |
733 IdlUnionType.is_nullable_simple = False | |
OLD | NEW |