Distinguish between Uuid API and Uuid type in JSDoc

This commit is contained in:
David Rowe 2019-06-05 14:39:05 +12:00
parent c48ecb5f67
commit 6299d38673
9 changed files with 36 additions and 31 deletions

View file

@ -77,7 +77,7 @@ public:
* @hifi-avatar
*
* @property {Uuid} keyboardFocusOverlay - Get or set the {@link Entities.EntityTypes|Web} entity that has keyboard focus.
* If no entity has keyboard focus, get returns <code>null</code>; set to <code>null</code> or {@link Uuid|Uuid.NULL} to
* If no entity has keyboard focus, get returns <code>null</code>; set to <code>null</code> or {@link Uuid(0)|Uuid.NULL} to
* clear keyboard focus.
*/
@ -122,7 +122,7 @@ public slots:
* @function Overlays.addOverlay
* @param {Overlays.OverlayType} type - The type of the overlay to add.
* @param {Overlays.OverlayProperties} properties - The properties of the overlay to add.
* @returns {Uuid} The ID of the newly created overlay if successful, otherwise {@link Uuid|Uuid.NULL}.
* @returns {Uuid} The ID of the newly created overlay if successful, otherwise {@link Uuid(0)|Uuid.NULL}.
* @example <caption>Add a cube overlay in front of your avatar.</caption>
* var overlay = Overlays.addOverlay("cube", {
* position: Vec3.sum(MyAvatar.position, Vec3.multiplyQbyV(MyAvatar.orientation, { x: 0, y: 0, z: -3 })),
@ -137,7 +137,7 @@ public slots:
* Create a clone of an existing entity (or 2D overlay).
* @function Overlays.cloneOverlay
* @param {Uuid} id - The ID of the entity/2D overlay to clone.
* @returns {Uuid} The ID of the new object if successful, otherwise {@link Uuid|Uuid.NULL}.
* @returns {Uuid} The ID of the new object if successful, otherwise {@link Uuid(0)|Uuid.NULL}.
*/
QUuid cloneOverlay(const QUuid& id);
@ -562,7 +562,7 @@ public slots:
* Set the Web3D entity that has keyboard focus.
* @function Overlays.setKeyboardFocusOverlay
* @param {Uuid} id - The ID of the {@link Entities.EntityTypes|Web} entity to set keyboard focus to. Use
* <code>null</code> or {@link Uuid|Uuid.NULL} to unset keyboard focus from an overlay.
* <code>null</code> or {@link Uuid(0)|Uuid.NULL} to unset keyboard focus from an overlay.
*/
void setKeyboardFocusOverlay(const QUuid& id) { DependencyManager::get<EntityScriptingInterface>()->setKeyboardFocusEntity(id); }

View file

@ -441,7 +441,7 @@ public:
/**jsdoc
* Gets the ID of the entity of avatar that the avatar is parented to.
* @function MyAvatar.getParentID
* @returns {Uuid} The ID of the entity or avatar that the avatar is parented to. {@link Uuid|Uuid.NULL} if not parented.
* @returns {Uuid} The ID of the entity or avatar that the avatar is parented to. {@link Uuid(0)|Uuid.NULL} if not parented.
*/
// This calls through to the SpatiallyNestable versions, but is here to expose these to JavaScript.
Q_INVOKABLE virtual const QUuid getParentID() const override { return SpatiallyNestable::getParentID(); }
@ -450,7 +450,7 @@ public:
* Sets the ID of the entity of avatar that the avatar is parented to.
* @function MyAvatar.setParentID
* @param {Uuid} parentID - The ID of the entity or avatar that the avatar should be parented to. Set to
* {@link Uuid|Uuid.NULL} to unparent.
* {@link Uuid(0)|Uuid.NULL} to unparent.
*/
// This calls through to the SpatiallyNestable versions, but is here to expose these to JavaScript.
Q_INVOKABLE virtual void setParentID(const QUuid& parentID) override;

View file

@ -263,7 +263,7 @@ namespace controller {
* methods. The mapping can then be enabled using {@link Controller.enableMapping|enableMapping} for it to take effect.
* @function Controller.newMapping
* @param {string} [mappingName=Uuid.generate()] - A unique name for the mapping. If not specified a new UUID generated
* by {@link Uuid.generate} is used.
* by {@link Uuid(0).generate} is used.
* @returns {MappingObject} A controller mapping object.
* @example <caption>Create a simple mapping that makes the right trigger move your avatar up.</caption>
* var MAPPING_NAME = "com.highfidelity.controllers.example.newMapping";

View file

@ -630,7 +630,7 @@ EntityPropertyFlags EntityItemProperties::getChangedProperties() const {
* The value can only be set at entity creation by using the <code>entityHostType</code> parameter in
* {@link Entities.addEntity}. Read-only.
* @property {Uuid} owningAvatarID=Uuid.NULL - The session ID of the owning avatar if <code>avatarEntity</code> is
* <code>true</code>, otherwise {@link Uuid|Uuid.NULL}. <em>Read-only.</em>
* <code>true</code>, otherwise {@link Uuid(0)|Uuid.NULL}. <em>Read-only.</em>
*
* @property {string} created - The UTC date and time that the entity was created, in ISO 8601 format as
* <code>yyyy-MM-ddTHH:mm:ssZ</code>. <em>Read-only.</em>
@ -728,7 +728,7 @@ EntityPropertyFlags EntityItemProperties::getChangedProperties() const {
* button beside the "script URL" field in properties tab of the Create app works.
* @property {string} serverScripts="" - The URL of the server entity script, if any, that is attached to the entity.
*
* @property {Uuid} parentID=Uuid.NULL - The ID of the entity or avatar that this entity is parented to. {@link Uuid|Uuid.NULL}
* @property {Uuid} parentID=Uuid.NULL - The ID of the entity or avatar that this entity is parented to. {@link Uuid(0)|Uuid.NULL}
* if the entity is not parented.
* @property {number} parentJointIndex=65535 - The joint of the entity or avatar that this entity is parented to. Use
* <code>65535</code> or <code>-1</code> to parent to the entity or avatar's position and orientation rather than a joint.
@ -1174,17 +1174,17 @@ EntityPropertyFlags EntityItemProperties::getChangedProperties() const {
* @property {string} zTextureURL="" - URL of the texture to map to surfaces perpendicular to the entity's local z-axis. JPG or
* PNG format. If no texture is specified the surfaces display white.
* @property {Uuid} xNNeighborID=Uuid.NULL - ID of the neighboring PolyVox entity in the entity's -ve local x-axis direction,
* if you want them joined. Set to {@link Uuid|Uuid.NULL} if there is none or you don't want to join them.
* if you want them joined. Set to {@link Uuid(0)|Uuid.NULL} if there is none or you don't want to join them.
* @property {Uuid} yNNeighborID=Uuid.NULL - ID of the neighboring PolyVox entity in the entity's -ve local y-axis direction,
* if you want them joined. Set to {@link Uuid|Uuid.NULL} if there is none or you don't want to join them.
* if you want them joined. Set to {@link Uuid(0)|Uuid.NULL} if there is none or you don't want to join them.
* @property {Uuid} zNNeighborID=Uuid.NULL - ID of the neighboring PolyVox entity in the entity's -ve local z-axis direction,
* if you want them joined. Set to {@link Uuid|Uuid.NULL} if there is none or you don't want to join them.
* if you want them joined. Set to {@link Uuid(0)|Uuid.NULL} if there is none or you don't want to join them.
* @property {Uuid} xPNeighborID=Uuid.NULL - ID of the neighboring PolyVox entity in the entity's +ve local x-axis direction,
* if you want them joined. Set to {@link Uuid|Uuid.NULL} if there is none or you don't want to join them.
* if you want them joined. Set to {@link Uuid(0)|Uuid.NULL} if there is none or you don't want to join them.
* @property {Uuid} yPNeighborID=Uuid.NULL - ID of the neighboring PolyVox entity in the entity's +ve local y-axis direction,
* if you want them joined. Set to {@link Uuid|Uuid.NULL} if there is none or you don't want to join them.
* if you want them joined. Set to {@link Uuid(0)|Uuid.NULL} if there is none or you don't want to join them.
* @property {Uuid} zPNeighborID=Uuid.NULL - ID of the neighboring PolyVox entity in the entity's +ve local z-axis direction,
* if you want them joined. Set to {@link Uuid|Uuid.NULL} if there is none or you don't want to join them.
* if you want them joined. Set to {@link Uuid(0)|Uuid.NULL} if there is none or you don't want to join them.
* @example <caption>Create a textured PolyVox sphere.</caption>
* var position = Vec3.sum(MyAvatar.position, Vec3.multiplyQbyV(MyAvatar.orientation, { x: 0, y: 0.5, z: -8 }));
* var texture = "http://public.highfidelity.com/cozza13/tuscany/Concrete2.jpg";

View file

@ -114,7 +114,7 @@ public:
* @hifi-assignment-client
*
* @property {Uuid} keyboardFocusEntity - Get or set the {@link Entities.EntityType|Web} entity that has keyboard focus.
* If no entity has keyboard focus, get returns <code>null</code>; set to <code>null</code> or {@link Uuid|Uuid.NULL} to
* If no entity has keyboard focus, get returns <code>null</code>; set to <code>null</code> or {@link Uuid(0)|Uuid.NULL} to
* clear keyboard focus.
*/
/// handles scripting of Entity commands from JS passed to assigned clients
@ -267,7 +267,7 @@ public slots:
* follows you to each domain you visit, rendering at the same world coordinates unless it's parented to your avatar.
* If <code>"local"</code>, the entity is created as a local entity, which will only render for you and isn't sent over the wire.
* Otherwise it is created as a normal entity and sent over the entity server.
* @returns {Uuid} The ID of the entity if successfully created, otherwise {@link Uuid|Uuid.NULL}.
* @returns {Uuid} The ID of the entity if successfully created, otherwise {@link Uuid(0)|Uuid.NULL}.
* @example <caption>Create a box entity in front of your avatar.</caption>
* var entityID = Entities.addEntity({
* type: "Box",
@ -294,7 +294,7 @@ public slots:
* @function Entities.addEntity
* @param {Entities.EntityProperties} properties - The properties of the entity to create.
* @param {boolean} [avatarEntity=false] - Whether to create an avatar entity or a domain entity
* @returns {Uuid} The ID of the entity if successfully created, otherwise {@link Uuid|Uuid.NULL}.
* @returns {Uuid} The ID of the entity if successfully created, otherwise {@link Uuid(0)|Uuid.NULL}.
*/
Q_INVOKABLE QUuid addEntity(const EntityItemProperties& properties, bool avatarEntity = false) {
entity::HostType entityHostType = avatarEntity ? entity::HostType::AVATAR : entity::HostType::DOMAIN;
@ -312,7 +312,7 @@ public slots:
* properties set per its clone related-properties, and its clone-related properties are set to defaults.
* @function Entities.cloneEntity
* @param {Uuid} entityID - The ID of the entity to clone.
* @returns {Uuid} The ID of the new entity if successfully cloned, otherwise {@link Uuid|Uuid.NULL}.
* @returns {Uuid} The ID of the new entity if successfully cloned, otherwise {@link Uuid(0)|Uuid.NULL}.
*/
Q_INVOKABLE QUuid cloneEntity(const QUuid& entityID);
@ -1446,7 +1446,7 @@ public slots:
* Set the {@link Entities.EntityType|Web} entity that has keyboard focus.
* @function Entities.setKeyboardFocusEntity
* @param {Uuid} id - The ID of the {@link Entities.EntityType|Web} entity to set keyboard focus to. Use
* <code>null</code> or {@link Uuid|Uuid.NULL} to unset keyboard focus from an entity.
* <code>null</code> or {@link Uuid(0)|Uuid.NULL} to unset keyboard focus from an entity.
*/
Q_INVOKABLE void setKeyboardFocusEntity(const QUuid& id);

View file

@ -46,7 +46,7 @@ const QString GET_PLACE = "/api/v1/places/%1";
* @hifi-avatar
* @hifi-assignment-client
*
* @property {Uuid} domainID - A UUID uniquely identifying the domain you're visiting. Is {@link Uuid|Uuid.NULL} if you're not
* @property {Uuid} domainID - A UUID uniquely identifying the domain you're visiting. Is {@link Uuid(0)|Uuid.NULL} if you're not
* connected to the domain or are in a serverless domain.
* <em>Read-only.</em>
* @property {string} hostname - The name of the domain for your current metaverse address (e.g., <code>"AvatarIsland"</code>,

View file

@ -623,7 +623,7 @@ public:
/**jsdoc
* @function Script.generateUUID
* @returns {Uuid} A new UUID.
* @deprecated This function is deprecated and will be removed. Use {@link Uuid.generate} instead.
* @deprecated This function is deprecated and will be removed. Use {@link Uuid(0).generate|Uuid.generate} instead.
*/
Q_INVOKABLE QUuid generateUUID() { return QUuid::createUuid(); }

View file

@ -19,11 +19,10 @@
#include <QtScript/QScriptable>
/**jsdoc
* A UUID (Universally Unique IDentifier) is used to uniquely identify entities, avatars, and the like. It is
* represented in JavaScript as a string in the format, <code>{nnnnnnnn-nnnn-nnnn-nnnn-nnnnnnnnnnnn}</code>, where the "n"s are
* hexadecimal digits.
* The <code>Uuid</code> API provides facilities for working with UUIDs.
*
* @namespace Uuid
* @variation 0
*
* @hifi-interface
* @hifi-client-entity
@ -42,7 +41,7 @@ class ScriptUUID : public QObject, protected QScriptable {
public slots:
/**jsdoc
* Generates a UUID from a string representation of the UUID.
* @function Uuid.fromString
* @function Uuid(0).fromString
* @param {string} string - A string representation of a UUID. The curly braces are optional.
* @returns {Uuid} A UUID if the given <code>string</code> is valid, <code>null</code> otherwise.
* @example <caption>Valid and invalid parameters.</caption>
@ -60,7 +59,7 @@ public slots:
/**jsdoc
* Generates a string representation of a UUID. However, because UUIDs are represented in JavaScript as strings, this is in
* effect a no-op.
* @function Uuid.toString
* @function Uuid(0).toString
* @param {Uuid} id - The UUID to generate a string from.
* @returns {string} - A string representation of the UUID.
*/
@ -68,7 +67,7 @@ public slots:
/**jsdoc
* Generate a new UUID.
* @function Uuid.generate
* @function Uuid(0).generate
* @returns {Uuid} A new UUID.
* @example <caption>Generate a new UUID and reports its JavaScript type.</caption>
* var uuid = Uuid.generate();
@ -79,7 +78,7 @@ public slots:
/**jsdoc
* Test whether two given UUIDs are equal.
* @function Uuid.isEqual
* @function Uuid(0).isEqual
* @param {Uuid} idA - The first UUID to compare.
* @param {Uuid} idB - The second UUID to compare.
* @returns {boolean} <code>true</code> if the two UUIDs are equal, otherwise <code>false</code>.
@ -94,7 +93,7 @@ public slots:
/**jsdoc
* Test whether a given UUID is null.
* @function Uuid.isNull
* @function Uuid(0).isNull
* @param {Uuid} id - The UUID to test.
* @returns {boolean} <code>true</code> if the UUID equals Uuid.NULL or is <code>null</code>, otherwise <code>false</code>.
* @example <caption>Demonstrate <code>true</code> and <code>false</code> cases.</caption>
@ -111,7 +110,7 @@ public slots:
/**jsdoc
* Print to the program log a text label followed by the UUID value.
* @function Uuid.print
* @function Uuid(0).print
* @param {string} label - The label to print.
* @param {Uuid} id - The UUID to print.
* @example <caption>Two ways of printing a label plus UUID.</caption>

View file

@ -640,6 +640,12 @@ Q_DECLARE_METATYPE(Collision)
QScriptValue collisionToScriptValue(QScriptEngine* engine, const Collision& collision);
void collisionFromScriptValue(const QScriptValue &object, Collision& collision);
/**jsdoc
* UUIDs (Universally Unique IDentifiers) are used to uniquely identify entities, avatars, and the like. They are represented
* in JavaScript as strings in the format, <code>"{nnnnnnnn-nnnn-nnnn-nnnn-nnnnnnnnnnnn}"</code>, where the "n"s are
* hexadecimal digits.
* @typedef {string} Uuid
*/
//Q_DECLARE_METATYPE(QUuid) // don't need to do this for QUuid since it's already a meta type
QScriptValue quuidToScriptValue(QScriptEngine* engine, const QUuid& uuid);
void quuidFromScriptValue(const QScriptValue& object, QUuid& uuid);