00001 #ifndef FBXFILESDK_FBXCORE_KFBXQUERY_H
00002 #define FBXFILESDK_FBXCORE_KFBXQUERY_H
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039 #include <fbxfilesdk/components/kbaselib/kaydaradef_h.h>
00040 #include <fbxfilesdk/fbxcore/kfbxpropertydef.h>
00041 #include <fbxfilesdk/kfbxplugins/kfbxproperty.h>
00042
00043 #include <fbxfilesdk/fbxfilesdk_nsbegin.h>
00044
00045
00046
00047
00048
00049
00053 class KFBX_DLL KFbxQuery {
00054
00055 public:
00057 virtual kFbxFilterId GetUniqueId() const { return 0x1452e230; }
00058
00063 virtual bool IsValid(KFbxProperty const &pProperty) const;
00064
00070 virtual bool IsValid(KFbxProperty const &pProperty,kFbxConnectionType pType) const;
00071
00076 virtual bool IsEqual(KFbxQuery *pOtherQuery) const;
00077
00078 public:
00080 void Ref();
00082 void Unref();
00083 protected:
00084 KFbxQuery();
00085 virtual ~KFbxQuery();
00086 private:
00087 class KFbxInternalFilter : public KFbxConnectionPointFilter{
00088 public:
00089 KFbxInternalFilter(KFbxQuery *pQuery);
00090 ~KFbxInternalFilter();
00091
00092
00093 public:
00094 KFbxConnectionPointFilter* Ref();
00095 void Unref();
00096 kFbxFilterId GetUniqueId() const { return mQuery->GetUniqueId(); }
00097 bool IsValid (KFbxConnectionPoint* pConnect) const;
00098 bool IsValidConnection (KFbxConnectionPoint* pConnect,kFbxConnectionType pType) const;
00099 bool IsEqual (KFbxConnectionPointFilter* pConnectFilter) const;
00100 public:
00101 KFbxQuery* mQuery;
00102
00103 };
00104
00105 KFbxInternalFilter mFilter;
00106 int mRefCount;
00107
00108 friend class KFbxProperty;
00109 friend class KFbxInternalFilter;
00110 };
00111
00112
00113
00114
00115 enum eFbxQueryOperator { eFbxAnd,eFbxOr } ;
00116
00121 class KFBX_DLL KFbxQueryOperator : public KFbxQuery {
00122
00123 public:
00129 static KFbxQueryOperator* Create(KFbxQuery* pA,eFbxQueryOperator pOperator,KFbxQuery* pB);
00130
00131 protected:
00132 KFbxQueryOperator(KFbxQuery* pA,eFbxQueryOperator pOperator,KFbxQuery* pB);
00133 virtual ~KFbxQueryOperator();
00134
00135
00136 public:
00137
00139 virtual kFbxFilterId GetUniqueId() const{ return 0x945874; }
00140
00145 virtual bool IsValid(KFbxProperty const &pProperty) const;
00146
00152 virtual bool IsValid(KFbxProperty const &pProperty,kFbxConnectionType pType) const;
00153
00158 virtual bool IsEqual(KFbxQuery *pOtherQuery) const;
00159 private:
00160 KFbxQuery *mA,*mB;
00161 eFbxQueryOperator mOperator;
00162 };
00163
00164
00165
00166
00167 enum eFbxUnaryQueryOperator { eFbxNot };
00168
00172 class KFBX_DLL KFbxUnaryQueryOperator : public KFbxQuery {
00173
00174 public:
00179 static KFbxUnaryQueryOperator* Create(KFbxQuery* pA,eFbxUnaryQueryOperator pOperator);
00180
00181 protected:
00182 KFbxUnaryQueryOperator(KFbxQuery* pA,eFbxUnaryQueryOperator pOperator);
00183 virtual ~KFbxUnaryQueryOperator();
00184
00185
00186 public:
00187
00189 virtual kFbxFilterId GetUniqueId() const{ return 0x945874BB; }
00190
00195 virtual bool IsValid(KFbxProperty const &pProperty) const;
00196
00202 virtual bool IsValid(KFbxProperty const &pProperty,kFbxConnectionType pType) const;
00203
00208 virtual bool IsEqual(KFbxQuery *pOtherQuery) const;
00209 private:
00210 KFbxQuery *mA;
00211 eFbxUnaryQueryOperator mOperator;
00212 };
00213
00214
00215
00216
00220 class KFBX_DLL KFbxQueryClassId : public KFbxQuery {
00221
00222 public:
00226 static KFbxQueryClassId* Create(kFbxClassId pClassId);
00227
00228 protected:
00229 KFbxQueryClassId(kFbxClassId pClassId);
00230
00231
00232 public:
00233
00235 virtual kFbxFilterId GetUniqueId() const{ return 0x14572785; }
00236
00241 virtual bool IsValid(KFbxProperty const &pProperty) const;
00242
00248 virtual bool IsValid(KFbxProperty const &pProperty,kFbxConnectionType pType) const;
00249
00254 virtual bool IsEqual(KFbxQuery *pOtherQuery) const;
00255 private:
00256 kFbxClassId mClassId;
00257 };
00258
00259
00260
00261
00262
00266 class KFBX_DLL KFbxQueryIsA : public KFbxQuery {
00267
00268 public:
00272 static KFbxQueryIsA* Create(kFbxClassId pClassId);
00273
00274 protected:
00275
00279 KFbxQueryIsA(kFbxClassId pClassId);
00280
00281
00282 public:
00283
00285 virtual kFbxFilterId GetUniqueId() const{ return 0x1457278F; }
00286
00291 virtual bool IsValid(KFbxProperty const &pProperty) const;
00292
00298 virtual bool IsValid(KFbxProperty const &pProperty,kFbxConnectionType pType) const;
00299
00304 virtual bool IsEqual(KFbxQuery *pOtherQuery) const;
00305 private:
00306 kFbxClassId mClassId;
00307 };
00308
00309
00310
00311
00312
00316 class KFBX_DLL KFbxQueryProperty : public KFbxQuery {
00317
00318 public:
00320 static KFbxQueryProperty* Create();
00321
00322 protected:
00323 KFbxQueryProperty();
00324
00325
00326 public:
00327
00329 virtual kFbxFilterId GetUniqueId() const{ return 0x9348203; }
00330
00335 virtual bool IsValid(KFbxProperty const &pProperty) const;
00336
00342 virtual bool IsValid(KFbxProperty const &pProperty,kFbxConnectionType pType) const;
00343
00347 virtual bool IsEqual(KFbxQuery *pOtherQuery) const;
00348 private:
00349 };
00350
00351
00352
00353
00354
00358 class KFBX_DLL KFbxQueryConnectionType : public KFbxQuery {
00359
00360 public:
00361
00365 static KFbxQueryConnectionType* Create(kFbxConnectionType pConnectionType);
00366
00367 protected:
00368 KFbxQueryConnectionType(kFbxConnectionType pConnectionType);
00369
00370
00371 public:
00372
00374 virtual kFbxFilterId GetUniqueId() const{ return 0x14587275; }
00375
00380 virtual bool IsValid(KFbxProperty const &pProperty) const;
00381
00387 virtual bool IsValid(KFbxProperty const &pProperty,kFbxConnectionType pType) const;
00388
00393 virtual bool IsEqual(KFbxQuery *pOtherQuery) const;
00394 private:
00395 kFbxConnectionType mConnectionType;
00396 };
00397
00398
00399
00400
00404 class KFbxCriteria {
00405 public:
00406 static KFbxCriteria ConnectionType(kFbxConnectionType pConnectionType)
00407 {
00408 return KFbxCriteria(KFbxQueryConnectionType::Create(pConnectionType));
00409 }
00410 static KFbxCriteria ObjectType(kFbxClassId pClassId)
00411 {
00412 return KFbxCriteria(KFbxQueryClassId::Create(pClassId));
00413 }
00414 static KFbxCriteria ObjectIsA(kFbxClassId pClassId)
00415 {
00416 return KFbxCriteria(KFbxQueryIsA::Create(pClassId));
00417 }
00418 static KFbxCriteria Property()
00419 {
00420 return KFbxCriteria(KFbxQueryProperty::Create());
00421 }
00422 inline KFbxCriteria()
00423 : mQuery(0)
00424 {
00425 }
00426 inline KFbxCriteria(KFbxCriteria const &pCriteria)
00427 : mQuery(pCriteria.mQuery)
00428 {
00429 if( mQuery )
00430 mQuery->Ref();
00431 }
00432
00433 inline ~KFbxCriteria()
00434 {
00435 if( mQuery )
00436 mQuery->Unref();
00437 }
00438 private:
00439 inline KFbxCriteria(KFbxQuery* pQuery)
00440 : mQuery(pQuery)
00441 {
00442 }
00443 public:
00444 inline KFbxCriteria &operator=(KFbxCriteria const &pCriteria)
00445 {
00446 if( this != &pCriteria )
00447 {
00448 KFbxQuery* lQuery = mQuery;
00449 mQuery = pCriteria.mQuery;
00450
00451 if( mQuery )
00452 mQuery->Ref();
00453
00454 if( lQuery )
00455 lQuery->Unref();
00456 }
00457
00458 return *this;
00459 }
00460 inline KFbxCriteria operator && (KFbxCriteria const &pCriteria) const
00461 {
00462 return KFbxCriteria(KFbxQueryOperator::Create(GetQuery(),eFbxAnd,pCriteria.GetQuery()));
00463 }
00464 inline KFbxCriteria operator || (KFbxCriteria const &pCriteria) const
00465 {
00466 return KFbxCriteria(KFbxQueryOperator::Create(GetQuery(),eFbxOr,pCriteria.GetQuery()));
00467 }
00468 inline KFbxCriteria operator !() const
00469 {
00470 return KFbxCriteria(KFbxUnaryQueryOperator::Create(GetQuery(), eFbxNot));
00471 }
00472
00473 public:
00474 inline KFbxQuery* GetQuery() const { return mQuery; }
00475 private:
00476 KFbxQuery* mQuery;
00477 };
00478
00479 #include <fbxfilesdk/fbxfilesdk_nsend.h>
00480
00481 #endif // FBXFILESDK_FBXCORE_KFBXQUERY_H
00482