PixelLightAPI  .
SQByClassName.h
Go to the documentation of this file.
00001 /*********************************************************\
00002  *  File: SQByClassName.h                                *
00003  *
00004  *  Copyright (C) 2002-2012 The PixelLight Team (http://www.pixellight.org/)
00005  *
00006  *  This file is part of PixelLight.
00007  *
00008  *  PixelLight is free software: you can redistribute it and/or modify
00009  *  it under the terms of the GNU Lesser General Public License as published by
00010  *  the Free Software Foundation, either version 3 of the License, or
00011  *  (at your option) any later version.
00012  *
00013  *  PixelLight is distributed in the hope that it will be useful,
00014  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00015  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
00016  *  GNU Lesser General Public License for more details.
00017  *
00018  *  You should have received a copy of the GNU Lesser General Public License
00019  *  along with PixelLight. If not, see <http://www.gnu.org/licenses/>.
00020 \*********************************************************/
00021 
00022 
00023 #ifndef __PLSCENE_SCENEQUERY_BYCLASSNAME_H__
00024 #define __PLSCENE_SCENEQUERY_BYCLASSNAME_H__
00025 #pragma once
00026 
00027 
00028 //[-------------------------------------------------------]
00029 //[ Includes                                              ]
00030 //[-------------------------------------------------------]
00031 #include <PLCore/String/RegEx.h>
00032 #include "PLScene/Scene/SceneQuery.h"
00033 
00034 
00035 //[-------------------------------------------------------]
00036 //[ Namespace                                             ]
00037 //[-------------------------------------------------------]
00038 namespace PLScene {
00039 
00040 
00041 //[-------------------------------------------------------]
00042 //[ Classes                                               ]
00043 //[-------------------------------------------------------]
00044 /**
00045 *  @brief
00046 *    Scene node enumeration by class name scene query class
00047 *
00048 *  @remarks
00049 *    This scene query will enumerate scene nodes of the scene graph
00050 *    if their class name matches a given regular expression.
00051 */
00052 class SQByClassName : public SceneQuery {
00053 
00054 
00055     //[-------------------------------------------------------]
00056     //[ RTTI interface                                        ]
00057     //[-------------------------------------------------------]
00058     pl_class(PLS_RTTI_EXPORT, SQByClassName, "PLScene", PLScene::SceneQuery, "Scene node enumeration by class name scene query class")
00059         // Constructors
00060         pl_constructor_0(DefaultConstructor,    "Default constructor",  "")
00061     pl_class_end
00062 
00063 
00064     //[-------------------------------------------------------]
00065     //[ Public definitions                                    ]
00066     //[-------------------------------------------------------]
00067     public:
00068         /**
00069         *  @brief
00070         *   Flags (SceneQuery flags extension)
00071         */
00072         enum EFlags {
00073             IgnoreBaseClasses = 1<<2    /**< Ignore base classes of scene node classes */
00074         };
00075 
00076 
00077     //[-------------------------------------------------------]
00078     //[ Public functions                                      ]
00079     //[-------------------------------------------------------]
00080     public:
00081         /**
00082         *  @brief
00083         *    Default constructor
00084         */
00085         PLS_API SQByClassName();
00086 
00087         /**
00088         *  @brief
00089         *    Destructor
00090         */
00091         PLS_API virtual ~SQByClassName();
00092 
00093         /**
00094         *  @brief
00095         *    Returns the used regular expression
00096         *
00097         *  @return
00098         *    The used regular expression
00099         */
00100         PLS_API const PLCore::RegEx &GetRegEx() const;
00101 
00102         /**
00103         *  @brief
00104         *    Sets the used regular expression
00105         *
00106         *  @param[in] cRegEx
00107         *    The regular expression to use
00108         */
00109         PLS_API void SetRegEx(const PLCore::RegEx &cRegEx);
00110 
00111 
00112     //[-------------------------------------------------------]
00113     //[ Private functions                                     ]
00114     //[-------------------------------------------------------]
00115     private:
00116         /**
00117         *  @brief
00118         *    Recursive part of PerformQuery()
00119         *
00120         *  @param[in] cContainer
00121         *    Current scene container we work on
00122         *
00123         *  @return
00124         *    'true' to continue the query, 'false' if stop it right now
00125         */
00126         bool PerformQueryRec(const SceneContainer &cContainer);
00127 
00128 
00129     //[-------------------------------------------------------]
00130     //[ Private data                                          ]
00131     //[-------------------------------------------------------]
00132     private:
00133         PLCore::RegEx m_cRegEx; /**< Regular expression used for the query */
00134 
00135 
00136     //[-------------------------------------------------------]
00137     //[ Public virtual SceneQuery functions                   ]
00138     //[-------------------------------------------------------]
00139     public:
00140         PLS_API virtual bool PerformQuery() override;
00141 
00142 
00143 };
00144 
00145 
00146 //[-------------------------------------------------------]
00147 //[ Namespace                                             ]
00148 //[-------------------------------------------------------]
00149 } // PLScene
00150 
00151 
00152 #endif // __PLSCENE_SCENEQUERY_BYCLASSNAME_H__


PixelLight PixelLight 0.9.11-R1
Copyright (C) 2002-2012 by The PixelLight Team
Last modified Thu Feb 23 2012 14:09:00
The content of this PixelLight document is published under the
Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported