H3D API  2.4.1
Classes | Public Member Functions | List of all members
H3D::ProtoDeclaration Class Reference

The ProtoDeclaration class contains information about a PROTO node from the X3D standard. More...

#include <H3D/ProtoDeclaration.h>

Inheritance diagram for H3D::ProtoDeclaration:
Inheritance graph

Classes

class  FieldDeclaration
 Class that contains information about a field that is part of the prototype declaration. More...
 

Public Member Functions

 ProtoDeclaration (const string &_name, const string &_body="", const vector< string > &_body_extra=vector< string >(), X3D::PrototypeVector *_existing_protos=NULL)
 Constructor. More...
 
const string & getProtoBody ()
 Get the string with the internal scenegraph of the prototype.
 
void setProtoBody (const string &_body)
 Set the string with the internal scenegraph of the prototype.
 
void addProtoBodyExtra (const string &_body)
 Add one part of proto body that is not the main proto body(i.e. More...
 
const vector< string > & getProtoBodyExtra ()
 Get the proto body extras.
 
const string & getName ()
 Get the name of the prototype.
 
void setName (const string &_name)
 Get the name of the prototype.
 
string addFieldDeclaration (const string &_name, const X3DTypes::X3DType &type, const Field::AccessType &access_type, const string &value="")
 Add a field to the prototype. More...
 
FieldDeclarationgetFieldDeclaration (const string &_name)
 Get the field declaration of the given name. More...
 
void setFieldDeclarationsExternal (bool is_external)
 Call this to set the external property for all contained field declarations. More...
 
X3DPrototypeInstancenewProtoInstance ()
 Create a new X3DPrototypeInstance instance using the ProtoDeclaration.
 

Detailed Description

The ProtoDeclaration class contains information about a PROTO node from the X3D standard.

It contains everything that is needed to now about the prototype and allows you to create new instances of the prototype with the newProtoInstance function.

Examples:

Constructor & Destructor Documentation

◆ ProtoDeclaration()

ProtoDeclaration::ProtoDeclaration ( const string &  _name,
const string &  _body = "",
const vector< string > &  _body_extra = vector<string>(),
X3D::PrototypeVector *  _existing_protos = NULL 
)

Constructor.

Parameters
_nameThe name of the prototype.
_bodyString with the internal scenegraph of the prototype.
_body_extraContains extra proto bodies that are not part of the main proto body.
_existing_protosContains all the ProtoDeclarations that exists when this ProtoDeclaration is created.

Member Function Documentation

◆ addFieldDeclaration()

string H3D::ProtoDeclaration::addFieldDeclaration ( const string &  _name,
const X3DTypes::X3DType &  type,
const Field::AccessType access_type,
const string &  value = "" 
)
inline

Add a field to the prototype.

Parameters
_nameThe name of the field.
typeThe type of the field.
access_typeThe access_type of the field.
valueThe value of the field.
Returns
An empty string if adding the field succeeded otherwise the string is an error message.

◆ addProtoBodyExtra()

void H3D::ProtoDeclaration::addProtoBodyExtra ( const string &  _body)
inline

Add one part of proto body that is not the main proto body(i.e.

not the first )

◆ getFieldDeclaration()

FieldDeclaration* H3D::ProtoDeclaration::getFieldDeclaration ( const string &  _name)
inline

Get the field declaration of the given name.

Returns true if such a field declaration exists, false otherwise

◆ setFieldDeclarationsExternal()

void H3D::ProtoDeclaration::setFieldDeclarationsExternal ( bool  is_external)
inline

Call this to set the external property for all contained field declarations.

The external property should be set if this proto was created in an ExternalProto and the property is used to know how default values should be set.


The documentation for this class was generated from the following files: