Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(148)

Side by Side Diff: ppapi/c/ppb_var.h

Issue 7282015: Misc. changes. Mostly formatting. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 /* Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 /* Copyright (c) 2011 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 #ifndef PPAPI_C_PPB_VAR_H_ 5 #ifndef PPAPI_C_PPB_VAR_H_
6 #define PPAPI_C_PPB_VAR_H_ 6 #define PPAPI_C_PPB_VAR_H_
7 7
8 #include "ppapi/c/pp_bool.h" 8 #include "ppapi/c/pp_bool.h"
9 #include "ppapi/c/pp_instance.h" 9 #include "ppapi/c/pp_instance.h"
10 #include "ppapi/c/pp_macros.h" 10 #include "ppapi/c/pp_macros.h"
11 #include "ppapi/c/pp_module.h" 11 #include "ppapi/c/pp_module.h"
12 #include "ppapi/c/pp_resource.h" 12 #include "ppapi/c/pp_resource.h"
13 #include "ppapi/c/pp_stdint.h" 13 #include "ppapi/c/pp_stdint.h"
14 #include "ppapi/c/pp_var.h" 14 #include "ppapi/c/pp_var.h"
15 15
16 #define PPB_VAR_INTERFACE_0_5 "PPB_Var;0.5" 16 #define PPB_VAR_INTERFACE_0_5 "PPB_Var;0.5"
17 #define PPB_VAR_INTERFACE PPB_VAR_INTERFACE_0_5 17 #define PPB_VAR_INTERFACE PPB_VAR_INTERFACE_0_5
18 18
19 /** 19 /**
20 * @file 20 * @file
21 * This file defines the PPB_Var struct. 21 * This file defines the <code>PPB_Var</code> struct.
22 */ 22 */
23 23
24 /** 24 /**
25 * @addtogroup Interfaces 25 * @addtogroup Interfaces
26 * @{ 26 * @{
27 */ 27 */
28 28
29 /** 29 /**
30 * PPB_Var API 30 * PPB_Var API
31 */ 31 */
32 struct PPB_Var { 32 struct PPB_Var {
33 /** 33 /**
34 * Adds a reference to the given var. If this is not a refcounted object, 34 * AddRef() adds a reference to the given var. If this is not a refcounted
35 * this function will do nothing so you can always call it no matter what the 35 * object, this function will do nothing so you can always call it no matter
36 * type. 36 * what the type.
37 *
38 * @param[in] var A <code>PP_Var</code> that will have a reference added.
37 */ 39 */
38 void (*AddRef)(struct PP_Var var); 40 void (*AddRef)(struct PP_Var var);
39 41
40 /** 42 /**
41 * Removes a reference to given var, deleting it if the internal refcount 43 * Release() removes a reference to given var, deleting it if the internal
42 * becomes 0. If the given var is not a refcounted object, this function will 44 * reference count becomes 0. If the given var is not a refcounted object,
43 * do nothing so you can always call it no matter what the type. 45 * this function will do nothing so you can always call it no matter what
46 * the type.
47 *
48 * @param[in] var A <code>PP_Var</code> that will have a reference removed.
44 */ 49 */
45 void (*Release)(struct PP_Var var); 50 void (*Release)(struct PP_Var var);
46 51
47 /** 52 /**
48 * Creates a string var from a string. The string must be encoded in valid 53 * VarFromUtf8() creates a string var from a string. The string must be
49 * UTF-8 and is NOT NULL-terminated, the length must be specified in |len|. 54 * encoded in valid UTF-8 and is NOT NULL-terminated, the length must be
50 * It is an error if the string is not valid UTF-8. 55 * specified in <code>len</code>. It is an error if the string is not
56 * valid UTF-8.
51 * 57 *
52 * If the length is 0, the |data| pointer will not be dereferenced and may 58 * If the length is 0, the <code>*data</code> pointer will not be dereferenced
53 * be NULL. Note, however, that if you do this, the "NULL-ness" will not be 59 * and may be <code>NULL</code>. Note, however if length is 0, the
54 * preserved, as VarToUtf8 will never return NULL on success, even for empty 60 * "NULL-ness" will not be preserved, as <code>VarToUtf8</code> will never
55 * strings. 61 * return <code>NULL</code> on success, even for empty strings.
56 * 62 *
57 * The resulting object will be a refcounted string object. It will be 63 * The resulting object will be a refcounted string object. It will be
58 * AddRef()ed for the caller. When the caller is done with it, it should be 64 * AddRef'ed for the caller. When the caller is done with it, it should be
59 * Release()d. 65 * Released.
60 * 66 *
61 * On error (basically out of memory to allocate the string, or input that 67 * On error (basically out of memory to allocate the string, or input that
62 * is not valid UTF-8), this function will return a Null var. 68 * is not valid UTF-8), this function will return a Null var.
69 *
70 * @param[in] module A PP_Module uniquely identifying the module or .nexe.
71 * @param[in] data A string
72 * @param[in] len The length of the string.
73 *
74 * @return A <code>PP_Var</code> structure containing a reference counted
75 * string object.
63 */ 76 */
64 struct PP_Var (*VarFromUtf8)(PP_Module module, 77 struct PP_Var (*VarFromUtf8)(PP_Module module,
65 const char* data, uint32_t len); 78 const char* data, uint32_t len);
66 79
67 /** 80 /**
68 * Converts a string-type var to a char* encoded in UTF-8. This string is NOT 81 * VarToUtf8() converts a string-type var to a char* encoded in UTF-8. This
69 * NULL-terminated. The length will be placed in |*len|. If the string is 82 * string is NOT NULL-terminated. The length will be placed in
70 * valid but empty the return value will be non-NULL, but |*len| will still 83 * <code>*len</code>. If the string is valid but empty the return value will
71 * be 0. 84 * be non-NULL, but <code>*len</code> will still be 0.
72 * 85 *
73 * If the var is not a string, this function will return NULL and |*len| will 86 * If the var is not a string, this function will return NULL and
74 * be 0. 87 * <code>*len</code> will be 0.
75 * 88 *
76 * The returned buffer will be valid as long as the underlying var is alive. 89 * The returned buffer will be valid as long as the underlying var is alive.
77 * If the plugin frees its reference, the string will be freed and the pointer 90 * If the module frees its reference, the string will be freed and the pointer
dmichael (off chromium) 2011/07/01 16:45:00 module->instance
jond 2011/07/01 20:31:23 Done.
78 * will be to random memory. 91 * will be to random memory.
dmichael (off chromium) 2011/07/01 16:45:00 random->arbitrary
jond 2011/07/01 20:31:23 Done.
92 *
93 * @param[in] var A PP_Var struct containing a string-type var.
94 * @param[in,out] len A pointer to the length of the string-type var.
95 *
96 * @return A char* encoded in UTF-8.
79 */ 97 */
80 const char* (*VarToUtf8)(struct PP_Var var, uint32_t* len); 98 const char* (*VarToUtf8)(struct PP_Var var, uint32_t* len);
81 }; 99 };
82 /** 100 /**
83 * @} 101 * @}
84 */ 102 */
85 103
86 #endif /* PPAPI_C_PPB_VAR_H_ */ 104 #endif /* PPAPI_C_PPB_VAR_H_ */
87 105
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698