QSDK 1.1 Documentation
Main Page | Modules | Class Hierarchy | Alphabetical List | Compound List | File List | Compound Members | File Members | Related Pages

gamedev.h

Go to the documentation of this file.
00001 /*-
00002  * Copyright (c) 2001-2003 Qube Software, Ltd.
00003  * All rights reserved.
00004  * 
00005  *      $Qube: Q/gamedev/include/gamedev.h,v 1.149.2.17 2004/03/26 15:48:02 yannick Exp $
00006  */
00007 
00008 #ifndef __gamedev_h__
00009 #define __gamedev_h__
00010 
00011 #ifndef Q_BEGIN
00012 #define Q_BEGIN namespace Q {
00013 #endif
00014     
00015 #ifndef Q_END    
00016 #define Q_END   }
00017 #endif
00018 
00019 /*
00020  * Version number of this package. This value will be incremented for
00021  * each significant api change.
00022  */
00023 #ifndef QGamedev_version
00024 #define QGamedev_version        11001200
00025 #endif
00026 
00027 /*
00028  * Name of this package
00029  */
00030 #ifndef QGamedev_libname
00031 #define QGamedev_libname        "qgamedev"
00032 #endif
00033 
00034 #ifndef QServer_version
00035 #error "#include <Q/q.h> required before <Q/gamedev.h>"
00036 #endif
00037 
00038 #ifndef __com_h__
00039 #error "#include <Q/com.h> required before <Q/gamedev.h>"
00040 #endif
00041 
00042 #include <Q/string.h>
00043 
00044 namespace Net {
00045     struct ReadStream;
00046 };
00047 
00048 Q_BEGIN
00049 
00050 #define SUBSYSTEM_QGAMEDEV      9
00051 
00052 enum {
00053     ECantParse          = ERROR_CODE(SUBSYSTEM_QGAMEDEV, 1),
00054     ECantWrite          = ERROR_CODE(SUBSYSTEM_QGAMEDEV, 4),
00055     EInvalid            = ERROR_CODE(SUBSYSTEM_QGAMEDEV, 5),
00056     EDuplicate          = ERROR_CODE(SUBSYSTEM_QGAMEDEV, 6)
00057 };
00058 
00059 struct Property;
00060 struct PropertyIterator;
00061 struct MessagePeer;
00062 struct Entity;
00063 struct EntityIterator;
00064 struct VariantMap;
00065 struct VariantCollection;
00066 struct ScriptDriver;
00067 
00133 struct Variant: public Com::Unknown
00134 {
00138     static Com::UUID            IID;
00139 
00143     static Com::UUID            CLSID;
00144 
00148     typedef Com::Ptr<Variant> PTR;
00149 
00154     enum Type {
00155         Undefined,
00156         Bool,
00157         Int,
00158         Float,
00159         String,
00160         QObject,
00161         Vec3f,
00162         Quat4f,
00163         Collection,
00164         Map,
00165         MessagePeer,
00166         Event,
00167         Function,
00168         Execution,
00169         Rule
00170     };
00171 
00175     static PTR                  create();
00176 
00182     static Utils::Result        create(Variant**);
00183 
00187     static PTR                  create(bool);
00188 
00194     static Utils::Result        create(bool, Variant**);
00195 
00199     static PTR                  create(int);
00200 
00206     static Utils::Result        create(int, Variant**);
00207 
00211     static PTR                  create(float);
00212 
00218     static Utils::Result        create(float, Variant**);
00219 
00223     static PTR                  create(const char*);
00224 
00230     static Utils::Result        create(const char*, Variant**);
00231 
00235     static PTR                  create(const Object&);
00236 
00242     static Utils::Result        create(const Object&, Variant**);
00243 
00247     static PTR                  create(const Maths::Vec3f&);
00248 
00254     static Utils::Result        create(const Maths::Vec3f&, Variant**);
00255 
00259     static PTR                  create(const Maths::Quat4f&);
00260 
00266     static Utils::Result        create(const Maths::Quat4f&, Variant**);
00267 
00271     static PTR                  create(VariantCollection*);
00272 
00278     static Utils::Result        create(VariantCollection*, Variant**);
00279 
00283     static PTR                  create(VariantMap*);
00284 
00290     static Utils::Result        create(VariantMap*, Variant**);
00291 
00295     static PTR                  create(Q::MessagePeer*);
00296 
00302     static Utils::Result        create(Q::MessagePeer*, Variant**);
00303 
00307     virtual Type                type() const = 0;
00308 
00312     virtual Utils::Result       cast(Type) = 0;
00313 
00324     virtual bool                toBool() const = 0;
00325 
00333     virtual int                 toInt() const = 0;
00334 
00342     virtual float               toFloat() const = 0;
00343 
00359     virtual const Utils::String toString() const = 0;
00360 
00372     virtual Utils::Result       getCollection(VariantCollection**) const = 0;
00373 
00375     Com::Ptr<VariantCollection> toCollection() const;
00376 
00388     virtual Utils::Result       getMap(VariantMap**) const = 0;
00389 
00391     Com::Ptr<VariantMap>        toMap() const;
00392 
00400     virtual const Object        toQObject() const = 0;
00401 
00410     virtual const Maths::Vec3f  toVec3f() const = 0;
00411 
00419     virtual const Maths::Quat4f toQuat4f() const = 0;
00420 
00431     virtual Utils::Result       getMessagePeer(Q::MessagePeer**) const = 0;
00432 
00434     Com::Ptr<Q::MessagePeer>    toMessagePeer() const;
00435 
00443     virtual bool&               asBool() = 0;
00444 
00452     virtual int&                asInt() = 0;
00453 
00461     virtual float&              asFloat() = 0;
00462 
00470     virtual Utils::String&      asString() = 0;
00471 
00479     virtual Object&             asQObject() = 0;
00480 
00488     virtual Maths::Vec3f&       asVec3f() = 0;
00489 
00497     virtual Maths::Quat4f&      asQuat4f() = 0;
00498 
00503     virtual Utils::Result       setCollection(VariantCollection*) = 0;
00504 
00509     virtual Utils::Result       setMap(VariantMap*) = 0;
00510 
00515     virtual Utils::Result       setMessagePeer(Q::MessagePeer*) = 0;
00516 
00520     virtual Utils::Result       assign(Variant*) = 0;
00521 };
00522 
00533 struct VariantCollection: public Com::Unknown
00534 {
00538     static Com::UUID            IID;
00539 
00543     static Com::UUID            CLSID;
00544 
00548     typedef Com::Ptr<VariantCollection> PTR;
00549 
00553     static PTR                  create();
00554 
00558     virtual unsigned int        size() const = 0;
00559 
00566     virtual Utils::Result       get(unsigned int i, Variant**) const = 0;
00567 
00569     Variant::PTR                get(unsigned int) const;
00570 
00574     virtual Utils::Result       set(unsigned int, Variant*) = 0;
00575 
00579     virtual Utils::Result       add(Variant*) = 0;
00580 
00584     virtual Utils::Result       removeAt(unsigned int) = 0;
00585 };
00586 
00597 struct VariantMap: public Com::Unknown
00598 {
00602     static Com::UUID            IID;
00603 
00607     static Com::UUID            CLSID;
00608 
00612     typedef Com::Ptr<VariantMap> PTR;
00613 
00617     static PTR                  create();
00618 
00622     virtual unsigned int        size() const = 0;
00623 
00627     virtual Utils::Result       empty() = 0;
00628 
00637     virtual Utils::Result       add(Variant* key, Variant* value) = 0;
00638 
00647     virtual Utils::Result       get(Variant* key, Variant** value) const = 0;
00648 
00653     virtual Utils::Result       remove(Variant*) = 0;
00654 
00662     virtual Utils::Result       getValues(VariantCollection* keys,
00663                                           VariantCollection* values) const = 0;
00664 };
00665 
00683 struct MessageResult: public Com::Unknown
00684 {
00688     static Com::UUID            IID;
00689 
00693     static Com::UUID            CLSID;
00694 
00698     typedef Com::Ptr<MessageResult>  PTR;
00699 
00703     static PTR                  create();
00704 
00708     virtual bool                available() const = 0;
00709 
00713     virtual Utils::Result       setAvailable(bool) = 0;
00714 
00721     virtual Utils::Result       getValue(Variant**) const = 0;
00722 
00724     Variant::PTR                value() const;
00725 
00729     virtual Utils::Result       setValue(Variant*) = 0;
00730 };
00731 
00744 struct MessageType: public Com::Unknown
00745 {
00749     static Com::UUID            IID;
00750 
00754     static Com::UUID            CLSID;
00755 
00759     typedef Com::Ptr<MessageType> PTR;
00760 
00778     static PTR                  create(unsigned int category = 0);
00779 
00783     static PTR                  create(const char*);
00784 
00788     virtual Text                name() const = 0;
00789 
00806     virtual unsigned int        category() const = 0;
00807 
00824     virtual Utils::Result       setCategory(unsigned int) = 0;
00825 
00834     bool                        equals(MessageType*) const;
00835 };
00836 
00846 struct Message: public Com::Unknown
00847 {
00851     static Com::UUID            IID;
00852 
00856     static Com::UUID            CLSID;
00857 
00861     typedef Com::Ptr<Message>   PTR;
00862 
00866     static PTR                  create(MessageType*);
00867 
00874     virtual Utils::Result       getType(MessageType**) const = 0;
00875 
00877     MessageType::PTR            type() const;
00878 
00882     virtual Utils::Result       setType(MessageType*) = 0;
00883 
00887     virtual unsigned int        parameterCount() const = 0;
00888 
00897     virtual Utils::Result       get(unsigned int i, Variant**) const = 0;
00898 
00900     Variant::PTR                get(unsigned int) const;
00901 
00907     virtual Utils::Result       set(unsigned int i, Variant*) = 0;
00908 
00912     virtual Utils::Result       add(Variant*) = 0;
00913 };
00914 
00939 struct MessagePeer: public Com::Unknown
00940 {
00944     static Com::UUID            IID;
00945 
00949     typedef Com::Ptr<MessagePeer> PTR;
00950 
00964     virtual void                receive(MessagePeer* from,
00965                                         Message*,
00966                                         MessageResult* result) = 0;
00967 };
00968 
00990 struct MessageManager: public Com::Unknown
00991 {
00995     static Com::UUID            IID;
00996 
01000     static Com::UUID            CLSID;
01001 
01005     typedef Com::Ptr<MessageManager> PTR;
01006 
01010     static PTR                  theManager();
01011 
01018     virtual Utils::Result       createMessageType(const char*,
01019                                                   MessageType**) = 0;
01020 
01037     virtual Utils::Result       send(MessagePeer* from,
01038                                      MessagePeer* to,
01039                                      Message*,
01040                                      MessageResult* result) = 0;
01041 
01066     virtual Utils::Result       send(MessagePeer* from,
01067                                      MessagePeer* to,
01068                                      Message*,
01069                                      MessageResult*,
01070                                      float delay) = 0;
01071 
01077     virtual Utils::Result       add(MessagePeer* receiver,
01078                                     MessagePeer* sender) = 0;
01079 
01085     virtual Utils::Result       add(MessagePeer* receiver,
01086                                     MessagePeer* sender,
01087                                     MessageType*) = 0;
01088 
01108     virtual Utils::Result       add(MessagePeer* receiver,
01109                                     MessagePeer* sender,
01110                                     unsigned int categoryMask) = 0;
01111 
01115     virtual Utils::Result       remove(MessagePeer*, MessagePeer*) = 0;
01116 
01124     virtual Utils::Result       remove(MessagePeer*) = 0;
01125 };
01126 
01163 struct EntityInstance: public Com::Unknown
01164 {
01168     static Com::UUID            IID;
01169 
01176     static Com::UUID            CLSID;
01177 
01181     typedef Com::Ptr<EntityInstance> PTR;
01182 
01191     static PTR                  create(const char*,
01192                                        const Group& referenceGroup,
01193                                        const Concept& type,
01194                                        const Database& db = Database());
01198     static PTR                  find(const char*);
01199 
01203     static PTR                  find(const Utils::UID&);
01204 
01214     static Utils::Result        find(const Group&, EntityIterator**);
01215 
01217     static Com::Ptr<EntityIterator>
01218                                 find(const Group&);
01219 
01233     static Utils::Result        findActives(const Group&, EntityIterator**);
01234 
01236     static Com::Ptr<EntityIterator>
01237                                 findActives(const Group&);
01238 
01242     static PTR                  find(Entity*);
01243 
01247     virtual Text                name() const = 0;
01248 
01252     virtual Group               group() const = 0;
01253 
01257     virtual Concept             type() const = 0;
01258 
01262     virtual unsigned int        instanceCount() const = 0;
01263     
01267     virtual Instance            instance(unsigned int i) const = 0;
01268 
01272     virtual Utils::Result       setInstance(unsigned int i,
01273                                             const Instance&) = 0;
01274 
01278     virtual Utils::Result       removeInstance(unsigned int i) = 0;
01279 
01283     virtual Concept             concept() const = 0;
01284 
01288     virtual Utils::UID          uid() const = 0;
01289 
01295     virtual Utils::Result       getEntity(Entity**) const = 0;
01296 
01298     Com::Ptr<Entity>            entity() const;
01299 
01304     virtual bool                persistent() const = 0;
01305 
01310     virtual Utils::Result       setPersistent(bool) = 0;
01311 
01315     virtual bool                ticking() const = 0;
01316 
01321     virtual Utils::Result       setTicking(bool enabled) = 0;
01322 
01326     virtual float               tickDelay() const = 0;
01327 
01331     virtual Utils::Result       setTickDelay(float) = 0;
01332 
01336     virtual Utils::Result       embody() = 0;
01337 
01341     virtual Utils::Result       destroy() = 0;
01342 };
01343 
01360 struct EntityInstance2: public EntityInstance
01361 {
01367     enum MoveMode {
01368         
01375         NotMoving,
01376  
01387         MoveReferenceGroup,       
01388 
01401         StartPosition
01402     };
01403 
01407     static Com::UUID            IID;
01408 
01412     typedef Com::Ptr<EntityInstance2> PTR;
01413 
01452     static PTR                  create(const char* name,
01453                                        const Group& referenceGroup,
01454                                        const Concept& type,
01455                                        MoveMode moving,
01456                                        const Database& db = Database());
01457 
01464     virtual Group               referenceGroup() const = 0;
01465 
01472     virtual MoveMode            moveMode() const = 0;
01473 
01480     virtual Utils::Result       setMoveMode(MoveMode) = 0;
01481 
01487     virtual short               tickPriority() const = 0;
01488 
01494     virtual Utils::Result       setTickPriority(short) = 0;
01495 };
01496 
01528 struct Entity: public Com::Unknown
01529 {
01533     static Com::UUID            IID;
01534 
01538     typedef Com::Ptr<Entity>    PTR;
01539 
01547     virtual void                tick(float dt) = 0;
01548 
01557     virtual bool                embody(EntityInstance*) = 0;
01558 
01565     virtual void                disembody(bool destroyed) = 0;
01566 
01578     virtual void                entered(unsigned int yourType,
01579                                         EntityInstance* them,
01580                                         unsigned int theirType) = 0;
01581 
01593     virtual void                exited(unsigned int yourType,
01594                                        EntityInstance* them,
01595                                        unsigned int theirType) = 0;
01596 };
01597 
01617 struct EntityFactory: public Com::Unknown
01618 {
01622     static Com::UUID            IID;
01623 
01627     typedef Com::Ptr<EntityFactory>    PTR;
01628 
01640     virtual Utils::Result       get(const Concept& type, Entity**) = 0;
01641 
01650     virtual Utils::Result       recycle(Entity*) = 0;
01651 };
01652 
01660 struct EntityIterator: public Com::Unknown
01661 {
01665     static Com::UUID            IID;
01666 
01670     static Com::UUID            CLSID;
01671 
01675     typedef Com::Ptr<EntityIterator>    PTR;
01676 
01683     virtual Utils::Result       getCurrent(EntityInstance**) const = 0;
01684 
01686     EntityInstance::PTR         current() const;
01687 
01691     virtual Utils::Result       next() = 0;
01692 
01696     virtual bool                valid() const = 0;
01697 
01699     EntityInstance::PTR         operator*() const
01700                                   { return current(); }
01701 
01703     operator                    EntityInstance*() const
01704                                   { return current(); }
01705 
01707     EntityIterator&             operator++()
01708                                   { next(); return *this; }
01709 };
01710 
01725 struct EntityManager: public Com::Unknown
01726 {
01730     static Com::UUID            IID;
01731 
01735     static Com::UUID            CLSID;
01736 
01740     typedef Com::Ptr<EntityManager> PTR;
01741 
01745     static PTR                  theManager();
01746 
01750     virtual unsigned int        scopeAmount() const = 0;
01751 
01755     virtual Utils::Result       setScopeAmount(unsigned int) = 0;
01756 
01757 
01763     virtual Utils::Result       addFactory(EntityFactory*) = 0;
01764 
01768     virtual Utils::Result       removeFactory(EntityFactory*) = 0;
01769 
01773     virtual unsigned int        activeCount() const = 0;
01774 
01781     virtual Utils::Result       getActives(EntityIterator**) const = 0;
01782 
01784     EntityIterator::PTR         actives() const;
01785 
01792     virtual Utils::Result       getEntities(EntityIterator**) const = 0;
01793 
01795     EntityIterator::PTR         entities() const;
01796     
01803     virtual Utils::Result       find(const char*,
01804                                      EntityInstance**) const = 0;
01811     virtual Utils::Result       find(const Utils::UID&,
01812                                      EntityInstance**) const = 0;
01813 
01825     virtual Utils::Result       find(const Group&,
01826                                      EntityIterator**) const = 0;
01827 
01834     virtual Utils::Result       find(Entity*,
01835                                      EntityInstance**) const = 0;
01836 
01844     virtual Utils::Result       createEntityInstance(const char* name,
01845                                                      const Group&,
01846                                                      const Concept& type,
01847                                                      const Database&,
01848                                                      EntityInstance**) = 0;
01852     virtual Utils::Result       purge() = 0;
01853 };
01854 
01864 struct EntityManager2: public EntityManager
01865 {
01869     static Com::UUID            IID;
01870 
01874     static Com::UUID            CLSID;
01875 
01879     typedef Com::Ptr<EntityManager2> PTR;
01880 
01884     static PTR                  theManager();
01885 
01925     virtual Utils::Result       createEntityInstance(const char* name,
01926                                             const Group& referenceGroup,
01927                                             const Concept& type,
01928                                             EntityInstance2::MoveMode moveMode,
01929                                             const Database&,
01930                                             EntityInstance2**) = 0;
01931 
01946     virtual Utils::Result       findActives(const Group&,
01947                                             EntityIterator**) const = 0;
01948 };
01949 
01976 struct IntersectionManager: public Com::Unknown
01977 {
01981     static Com::UUID            IID;
01982 
01986     static Com::UUID            CLSID;
01987 
01991     typedef Com::Ptr<IntersectionManager> PTR;
01992 
01996     static PTR                  theManager();
01997 
02005     virtual Utils::Result       add(EntityInstance*,
02006                                     const Instance&,
02007                                     unsigned int type) = 0;
02008 
02014     virtual Utils::Result       remove(EntityInstance*,
02015                                        unsigned int type) = 0;
02016 
02022     virtual Utils::Result       remove(EntityInstance*) = 0;
02023 };
02024 
02042 struct AnimationMode: public Com::Unknown
02043 {
02047     static Com::UUID            IID;
02048 
02052     static Com::UUID            CLSID;
02053 
02057     typedef Com::Ptr<AnimationMode> PTR;    
02058 
02062     static PTR                  create(const char*);
02063 
02067     static PTR                  find(const char*);
02068 
02072     virtual Text                name() const = 0;
02073 };
02074 
02085 struct AnimationMachine: public Com::Unknown
02086 {
02090     static Com::UUID            IID;
02091 
02095     typedef Com::Ptr<AnimationMachine> PTR;    
02096     
02103     virtual Utils::Result       getMode(AnimationMode**) const = 0;
02104 
02106     AnimationMode::PTR          mode() const;
02107 
02111     virtual float               speed() const = 0;
02112 
02116     virtual Utils::Result       setSpeed(float) = 0;
02117 };
02118 
02126 struct AnimationFactory: public Com::Unknown
02127 {
02131     static Com::UUID            IID;
02132 
02136     static Com::UUID            CLSID;
02137 
02141     typedef Com::Ptr<AnimationFactory> PTR;
02142 
02146     static PTR                  theFactory();
02147 
02154     virtual Utils::Result       findMode(const char*,
02155                                          AnimationMode**) const = 0;
02156 };
02157 
02158 
02167 struct AnimationFactory2: public Com::Unknown
02168 {
02172     static Com::UUID            IID;
02173 
02177     static Com::UUID            CLSID;
02178 
02182     typedef Com::Ptr<AnimationFactory2> PTR;
02183 
02187     static PTR                  theFactory();
02188 
02195     virtual Utils::Result       createMode(const char*,
02196                                            AnimationMode**) = 0;
02197 };
02198 
02214 struct IndexMarkup: public Com::Unknown
02215 {
02219     static Com::UUID            IID;
02220 
02224     static Com::UUID            CLSID;
02225 
02229     typedef Com::Ptr<IndexMarkup>    PTR;
02230 
02234     static PTR                  create(const Object&,
02235                                        const Database& = Database());
02236 
02240     virtual Object              object() const = 0;
02241 
02245     virtual Utils::Result       setObject(const Object&) = 0;
02246 
02250     virtual Database            database() const = 0;
02251 
02255     virtual Utils::Result       setDatabase(const Database&) = 0;
02256 
02262     virtual bool                getIndex(const char*,
02263                                          unsigned int&) const = 0;
02264 };
02265 
02285 struct Puppet: public MessagePeer
02286 {
02290     static Com::UUID            IID;
02291 
02295     static Com::UUID            CLSID;
02296 
02300     typedef Com::Ptr<Puppet>    PTR;
02301 
02305     static PTR                  create();
02311     static PTR                  create(const Object&,
02312                                        const Animation&,
02313                                        const Clip&);
02314 
02323     virtual Object              model() const = 0;
02324 
02328     virtual Animation           animation() const = 0;
02329 
02336     virtual Utils::Result       getMachine(AnimationMachine**) const = 0;
02337 
02339     AnimationMachine::PTR       machine() const;
02340     
02347     virtual Utils::Result       getMachine(const char*,
02348                                            AnimationMachine**) const = 0;
02349 
02351     AnimationMachine::PTR       machine(const char*) const;
02352 
02364     virtual bool                changeMode(AnimationMode*) = 0;
02365 
02373     virtual Utils::Result       setValues(const Object& model,
02374                                           const Animation& animation,
02375                                           const Clip& clip) = 0;
02376 
02388     virtual Utils::Result       getClone(const Object& model,
02389                                          Puppet**) const = 0;
02391     PTR                         clone(const Object& model) const;
02392 };
02393 
02405 struct Puppet2: public Puppet
02406 {
02410     static Com::UUID            IID;
02411 
02415     static Com::UUID            CLSID;
02416 
02420     typedef Com::Ptr<Puppet2>    PTR;
02421 
02425     static PTR                  create();
02431     static PTR                  create(const Object&,
02432                                        const Animation&,
02433                                        const Clip&);
02434 
02438     virtual Utils::Result       start() = 0;
02439 
02443     virtual Utils::Result       stop() = 0;
02444 };
02445 
02467 struct Rule: public Com::Unknown
02468 {
02472     static Com::UUID            IID;
02473 
02477     static Com::UUID            CLSID;
02478 
02482     typedef Com::Ptr<Rule>      PTR;
02483 
02487     static PTR                  find(const char*);
02488 
02492     virtual Text                name() const = 0;
02493 
02498     virtual bool                enabled() const = 0;
02499 
02503     virtual unsigned int        executionCount() const = 0;
02504 
02509     virtual int                 executionMaximum() const = 0;
02510 
02514     virtual Utils::Result       setEnabled(bool) = 0;
02515 
02519     virtual Utils::Result       setExecutionCount(unsigned int) = 0;
02520 
02524     virtual Utils::Result       setExecutionMaximum(int) = 0;
02525 
02530     virtual Utils::Result       destroy() = 0;
02531 };
02532 
02544 struct ScriptRepository: public Com::Unknown
02545 {
02549     static Com::UUID            IID;
02550 
02554     static Com::UUID            CLSID;
02555 
02559     typedef Com::Ptr<ScriptRepository> PTR;
02560 
02564     static PTR                  theRepository();
02565 
02569     virtual Utils::Result       add(const char*, MessagePeer*) = 0;
02570 
02574     virtual Utils::Result       remove(const char*) = 0;
02575 };
02576 
02592 struct ScriptDriver2: public MessagePeer   
02593 {   
02597     static Com::UUID            IID;   
02598     
02602     typedef Com::Ptr<ScriptDriver2> PTR;   
02603     
02619     virtual Utils::Result       getVariable(const char*, Variant**) = 0;   
02620     
02635     virtual Utils::Result       activate(const char*, MessagePeer**) = 0;   
02636     
02643     virtual Utils::Result       call(Message*,
02644                                      MessageResult* result) = 0;   
02645 }; 
02646 
02659 struct ScriptExecutionListener: public Com::Unknown
02660 {
02664     static Com::UUID            IID;
02665 
02669     typedef Com::Ptr<ScriptExecutionListener> PTR;
02670 
02671 
02675     enum ErrorType
02676     {
02682         WrongStatement,
02683 
02689         WrongRuleProperty,
02690 
02696         InvalidCast,
02697 
02703         InvalidVecf,
02704 
02708         InvalidCompareEvent,
02709 
02714         UndefinedVariable,
02715 
02721         VariableRedefinition,
02722 
02726         InvalidLabel,
02727 
02732         UnmatchedComments,
02733 
02739         RedundantCast,
02740 
02747         InvalidInvocation,
02748 
02753         PackageNotFound,
02754 
02761         InvalidPropertyAssignment,
02762 
02769         InvalidProperty,
02770 
02776         InvalidOperator,
02777 
02784         InvalidFunctionCall,
02785 
02786 
02792         InvalidIndex,
02793 
02799         OutOfBounds,
02800 
02807         InvalidMap,
02808 
02815         InvalidMessagePeer
02816     };
02817 
02827     virtual void                onError(ErrorType,
02828                                         const char* msg,
02829                                         unsigned int lineno) = 0;
02830 
02834     virtual void                onTerminate() = 0;
02835 
02840     virtual void                onVariable(const char* name,
02841                                            Variant* value) = 0;
02842 };
02843 
02857 struct ScriptManager: public Com::Unknown
02858 {
02862     static Com::UUID            IID;
02863 
02867     static Com::UUID            CLSID;
02868 
02872     typedef Com::Ptr<ScriptManager> PTR;
02873 
02877     static PTR                  theManager();
02878 
02885     virtual Utils::Result       createRules(const Clip&) = 0;
02886 
02893     virtual Utils::Result       setDriver(ScriptDriver*) = 0;
02894 
02901     virtual Utils::Result       find(const char*, Rule**) const = 0;
02902 };
02903     
02914 struct ScriptController: public Com::Unknown
02915 {
02919     static Com::UUID            IID;
02920 
02924     typedef Com::Ptr<ScriptController> PTR;
02925 
02936     virtual Utils::Result       execute() = 0;
02937 
02938 
02942     virtual Utils::Result       clearRules() = 0;
02943 };
02944 
02956 struct ScriptManager2: public Com::Unknown
02957 {
02961     static Com::UUID            IID;
02962 
02966     static Com::UUID            CLSID;
02967 
02971     typedef Com::Ptr<ScriptManager2> PTR;
02972 
02976     static PTR                  theManager();
02977 
02993     virtual Utils::Result       readScript(const Clip&,
02994                                            ScriptExecutionListener*,
02995                                            ScriptController**) = 0;
02996 
03010     virtual Utils::Result       readScript(Net::ReadStream*,
03011                                            bool compiled,
03012                                            ScriptExecutionListener*,
03013                                            ScriptController**) = 0;
03014 
03018     virtual Utils::Result       clear() = 0;
03019 
03023     virtual Utils::Result       addDriver(ScriptDriver2*) = 0;
03024 
03028     virtual Utils::Result       removeDriver(ScriptDriver2*) = 0;
03029 
03034     virtual unsigned int        importPathCount() const = 0;
03035 
03040     virtual Utils::Result       getImportPath(unsigned int i,
03041                                               Utils::String*) const = 0;
03042 
03044     Utils::String               importPath(unsigned int) const;
03045 
03052     virtual Utils::Result       setImportPath(unsigned int i, const char*) = 0;
03053 };
03054 
03064 struct ScriptPropertyHolder: public Com::Unknown   
03065 {   
03069     static Com::UUID            IID;   
03070     
03074     typedef Com::Ptr<ScriptPropertyHolder>   PTR;   
03075     
03087     virtual Utils::Result       getProperty(MessageType* attribute,
03088                                             Variant**) = 0;   
03089     
03094     virtual Utils::Result       setProperty(MessageType* attribute,
03095                                             Variant*) = 0;   
03096 };   
03097 
03110 struct Property: public Com::Unknown
03111 {
03115     static Com::UUID            IID;
03116 
03120     static Com::UUID            CLSID;
03121 
03125     typedef Com::Ptr<Property>  PTR;
03126  
03130     enum Type
03131     {
03132         Null,
03133         Bool,
03134         Int,
03135         Float,
03136         Text,
03137         Concept
03138     };
03139 
03143     static PTR                  find(const Q::Concept& object,
03144                                      const Q::Concept& attribute);
03145 
03149     static Com::Ptr<PropertyIterator>
03150                                 find(const Q::Concept& object);
03154     static PTR                  create(const Q::Concept& object,
03155                                        const Q::Concept& attribute);
03159     static PTR                  create(const Q::Concept& object,
03160                                        const Q::Concept& attribute,
03161                                        bool);
03165     static PTR                  create(const Q::Concept& object,
03166                                        const Q::Concept& attribute,
03167                                        int);
03171     static PTR                  create(const Q::Concept& object,
03172                                        const Q::Concept& attribute,
03173                                        float);
03177     static PTR                  create(const Q::Concept& object,
03178                                        const Q::Concept& attribute,
03179                                        const char*);
03183     static PTR                  create(const Q::Concept& object,
03184                                        const Q::Concept& attribute,
03185                                        const Q::Concept&);
03186 
03190     virtual Q::Concept          object() const = 0;
03191 
03195     virtual Q::Concept          attribute() const = 0;
03196 
03200     virtual Type                type() const = 0;
03201 
03205     virtual bool                toBool() const = 0;
03206 
03210     virtual int                 toInt() const = 0;
03211 
03215     virtual float               toFloat() const = 0;
03216 
03220     virtual Q::Text             toText() const = 0;
03221 
03225     virtual Q::Concept          toConcept() const = 0;
03226 
03230     virtual Utils::Result       setValue(bool) = 0;
03231 
03235     virtual Utils::Result       setValue(int) = 0;
03236 
03240     virtual Utils::Result       setValue(float) = 0;
03241 
03245     virtual Utils::Result       setValue(const char*) = 0;
03246 
03250     virtual Utils::Result       setValue(const Q::Concept&) = 0;
03251 
03255     virtual Utils::Result       destroy() = 0;
03256     
03258     operator                    bool() const { return toBool(); }
03259 
03261     operator                    int() const { return toInt(); }
03262 
03264     operator                    float() const { return toFloat(); }
03265 
03267     operator                    Q::Text() const { return toText(); }
03268 
03270     operator                    Q::Concept() const { return toConcept(); }
03271 
03273     bool                        operator=(bool v) 
03274                                   { setValue(v); return v;  } 
03275 
03277     int                         operator=(int v) 
03278                                   { setValue(v); return v;  } 
03279 
03281     float                       operator=(float v) 
03282                                   { setValue(v); return v; } 
03283 
03285     const Q::Text&              operator=(const Q::Text& v) 
03286                                   { setValue(v); return v; } 
03287 
03289     const char*                 operator=(const char* v) 
03290                                   { setValue(v); return v; }
03291 
03293     const Q::Concept&           operator=(const Q::Concept& v) 
03294                                   { setValue(v); return v; } 
03295 };
03296 
03303 struct PropertyIterator: public Com::Unknown
03304 {
03308     static Com::UUID            IID;
03309 
03313     static Com::UUID            CLSID;
03314 
03318     typedef Com::Ptr<PropertyIterator>    PTR;
03319 
03326     virtual Utils::Result       getCurrent(Property**) const = 0;
03327 
03329     Property::PTR               current() const;
03330 
03334     virtual Utils::Result       next() = 0;
03335 
03339     virtual bool                valid() const = 0;
03340 
03342     Property::PTR               operator*() const
03343                                   { return current(); }
03344 
03346     PropertyIterator&           operator++()
03347                                   { next(); return *this; }
03348 };
03349 
03357 struct PropertyFactory: public Com::Unknown
03358 {
03362     static Com::UUID            IID;
03363 
03367     static Com::UUID            CLSID;
03368 
03372     typedef Com::Ptr<PropertyFactory> PTR;
03373 
03377     static PTR                  theFactory();      
03378  
03386     virtual Utils::Result       find(const Concept& object,
03387                                      const Concept& attribute,
03388                                      Property**) const = 0;
03389 
03396     virtual Utils::Result       find(const Concept& object,
03397                                      PropertyIterator**) const = 0;
03398 
03400     PropertyIterator::PTR       find(const Concept& object) const;
03401 
03409     virtual Utils::Result       create(const Concept& object,
03410                                        const Concept& attribute,
03411                                        Property**) = 0;
03412 };
03413 
03425 struct SchemaFactory: public Com::Unknown
03426 {
03430     static Com::UUID            IID;
03434     static Com::UUID            CLSID;
03435 
03439     typedef Com::Ptr<SchemaFactory>   PTR;
03440 
03444     static PTR                  theFactory();
03445 
03455     virtual Utils::Result       conceptToName(const Concept& con,
03456                                               Utils::String& name) = 0;
03463     virtual Utils::Result       nameToConcept(const char* name,
03464                                               Concept& concept) = 0;
03465 };
03466 
03467 
03468 
03469 
03470 
03471 
03472 //
03473 // Deprecated classes
03474 //
03475 
03481 struct ScriptDriver: public MessagePeer
03482 {
03486     static Com::UUID            IID;
03487 
03491     typedef Com::Ptr<ScriptDriver> PTR;
03492 
03498     virtual Utils::Result       getVariable(const char*, Variant**) = 0;
03499 
03503     virtual Utils::Result       activate(const char*, MessagePeer**) = 0;
03504 };
03505 
03506 Q_END
03507 
03508 #ifndef QGAMEDEV_NO_INLINES
03509 #include "gamedev.i.h"
03510 #endif
03511 
03512 #endif

Return to QSDK documentation Contents page. Contact details for support, information and fault-reporting.
Qube Software Limited © 2000-2004