Introduce CefString and cef_string_t implementations that support string type conversions and customization of the API string type (issue #146).

git-svn-id: https://chromiumembedded.googlecode.com/svn/trunk@145 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
This commit is contained in:
Marshall Greenblatt
2010-11-22 17:49:46 +00:00
parent 1e1c2ad8d7
commit 7d60642638
121 changed files with 2598 additions and 3209 deletions

View File

@ -1047,7 +1047,7 @@ class obj_analysis:
def _get_basic(self, value):
# check for string values
if value == "std::wstring":
if value == "CefString":
return {
'result_type' : 'string',
'result_value' : None
@ -1192,13 +1192,16 @@ class obj_analysis:
def get_result_string_type(self):
""" Return the string type. """
# if the string is a return value, or if the string is passed by
# reference or address then use the read-write string type
if not self.has_name():
return 'cef_string_t'
# Return values are string structs that the user must free. Use
# the name of the structure as a hint.
return 'cef_string_userfree_t'
elif not self.is_const() and (self.is_byref() or self.is_byaddr()):
# Parameters passed by reference or address. Use the normal
# non-const string struct.
return 'cef_string_t*'
return 'const wchar_t*'
# Const parameters use the const string struct.
return 'const cef_string_t*'
def is_result_vector(self):
""" Returns true if this is a vector type. """

View File

@ -12,7 +12,7 @@ def make_capi_global_funcs(funcs, defined_names, translate_map, indent):
if first or len(comment) > 0:
result += '\n'+format_comment(comment, indent, translate_map);
if func.get_retval().get_type().is_result_string():
result += indent+'// The resulting string must be freed by calling cef_string_free().\n'
result += indent+'// The resulting string must be freed by calling cef_string_userfree_free().\n'
result += wrap_code(indent+'CEF_EXPORT '+
func.get_capi_proto(defined_names)+';')
if first:
@ -27,7 +27,7 @@ def make_capi_member_funcs(funcs, defined_names, translate_map, indent):
if first or len(comment) > 0:
result += '\n'+format_comment(comment, indent, translate_map)
if func.get_retval().get_type().is_result_string():
result += indent+'// The resulting string must be freed by calling cef_string_free().\n'
result += indent+'// The resulting string must be freed by calling cef_string_userfree_free().\n'
parts = func.get_capi_parts()
result += wrap_code(indent+parts['retval']+' (CEF_CALLBACK *'+
parts['name']+')('+