2 * Copyright 2016 Haiku, Inc. All rights reserved.
3 * Distributed under the terms of the MIT License.
6 * John Scipione, jscpione@gmail.com
9 * headers/os/app/PropertyInfo.h hrev50253
10 * src/kits/app/PropertyInfo.cpp hrev50253
18 \brief Provides the BPropertyInfo class and support structures.
26 \brief Property info struct containing lists of commands and specifiers.
33 \var property_info::name
34 \brief The name of the property.
41 \var property_info::commands
42 \brief Zero-terminated array of commands understood by the property
43 e.g. \c B_GET_PROPERTY.
45 If the first element is 0 it is treated as a wildcard matching all
53 \var property_info::specifiers
54 \brief Zero-terminated array of the specifiers understood by the property
55 e.g. \c B_DIRECT_SPECIFIER.
57 If the first element is 0 it is treated as a wildcard matching all
65 \var property_info::usage
66 \brief Human-readable string describing the property and its supported
67 commands and specifiers.
74 \var property_info::extra_data
75 \brief Place to specify freeform data, it is not used by the OS.
82 \var property_info::types
90 \var property_info::ctypes
98 \var property_info::_reserved
99 \brief Reserved for future expansion, do not use.
107 \brief Enumerates value types.
114 \var value_kind B_COMMAND_KIND
115 \brief Command value.
122 \var value_kind B_TYPE_CODE_KIND
123 \brief Type code value.
133 \brief Class used to manage scripting.
141 \fn BPropertyInfo::BPropertyInfo(property_info* propertyInfo,
142 value_info* valueInfo, bool freeOnDelete)
143 \brief Initializes the object with the specified NULL-terminated arrays
144 \a propertyInfo and \a valueInfo.
146 The arrays are not copied so do not modify or delete the arrays while
147 they are in use by BPropertyInfo.
149 \param propertyInfo The NULL-terminated properties array.
150 \param valueInfo The NULL-terminated values array.
151 \param freeOnDelete if \c true, free the memory associated with
152 \a propertyInfo and \a valueInfo when the object is destroyed.
159 \fn BPropertyInfo::~BPropertyInfo()
160 \brief Destructor method.
162 If \a freeOnDelete is set to \c true in the constructor this method
163 frees all memory associated with \a propertyInfo and \a valueInfo.
170 \fn int32 BPropertyInfo::FindMatch(BMessage* message, int32 index,
171 BMessage* specifier, int32 form, const char* property, void* data) const
178 \fn bool BPropertyInfo::IsFixedSize() const
179 \brief Always returns \c false.
181 \see BFlattenable::IsFixedSize()
188 \fn type_code BPropertyInfo::TypeCode() const
189 \brief Always returns \c B_PROPERTY_INFO_TYPE.
191 \see BFlattenable::TypeCode()
198 \fn ssize_t BPropertyInfo::FlattenedSize() const
199 \brief Returns the size of the flattened object in bytes.
201 \see BFlattenable::FlattenedSize()
208 \fn status_t BPropertyInfo::Flatten(void* buffer, ssize_t numBytes) const
210 \see BFlattenable::Flatten()
217 \fn bool BPropertyInfo::AllowsTypeCode(type_code code) const
218 \brief Returns \c true if \a code is B_PROPERTY_INFO_TYPE,
221 \see BFlattenable::AllowsTypeCode()
228 \fn status_t BPropertyInfo::Unflatten(type_code code, const void* buffer,
231 \see BFlattenable::Unflatten()
238 \fn const property_info* BPropertyInfo::Properties() const
239 \brief Returns the properties as a \c property_info pointer.
241 Returns the pointer directly, does not make copy.
243 Called PropertyInfo() in the BeBook.
250 \fn const value_info* BPropertyInfo::Values() const
251 \brief Returns the values as a \c value_info pointer.
253 Returns the pointer directly, does not make copy.
260 \fn int32 BPropertyInfo::CountProperties() const
261 \brief Returns The number of properties specified as an int32.
268 \fn int32 BPropertyInfo::CountValues() const
269 \brief Returns The number of values specified as an int32.
276 \fn void BPropertyInfo::PrintToStream() const
277 \brief Prints each property, command, type, and specifier to standard
285 \fn bool BPropertyInfo::FindCommand(uint32 what, int32 index,
286 property_info* propertyInfo)
287 \brief Find the command inside of \a propertyInfo matching \a what and
290 You may want to override this method in derived classes.
292 \returns \c true if the command was found, \c false otherwise.
299 \fn bool BPropertyInfo::FindSpecifier(uint32 form,
300 property_info* propertyInfo)
301 \brief Find the specifier inside of \a propertyInfo matching \a form.
303 You may want to override this method in derived classes.
305 \returns \c true if the specifier was found, \c false otherwise.