LCOV - code coverage report
Current view: top level - xenolith/scene/nodes - XLComponent.h (source / functions) Hit Total Coverage
Test: coverage.info Lines: 2 2 100.0 %
Date: 2024-05-12 00:16:13 Functions: 2 2 100.0 %

          Line data    Source code
       1             : /**
       2             :  Copyright (c) 2021 Roman Katuntsev <sbkarr@stappler.org>
       3             :  Copyright (c) 2023 Stappler LLC <admin@stappler.dev>
       4             : 
       5             : Permission is hereby granted, free of charge, to any person obtaining a copy
       6             : of this software and associated documentation files (the "Software"), to deal
       7             : in the Software without restriction, including without limitation the rights
       8             : to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
       9             : copies of the Software, and to permit persons to whom the Software is
      10             : furnished to do so, subject to the following conditions:
      11             : 
      12             : The above copyright notice and this permission notice shall be included in
      13             : all copies or substantial portions of the Software.
      14             : 
      15             : THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
      16             : IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
      17             : FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
      18             : AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
      19             : LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
      20             : OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
      21             : THE SOFTWARE.
      22             : **/
      23             : 
      24             : #ifndef XENOLITH_SCENE_NODES_XLCOMPONENT_H_
      25             : #define XENOLITH_SCENE_NODES_XLCOMPONENT_H_
      26             : 
      27             : #include "XLNodeInfo.h"
      28             : 
      29             : namespace STAPPLER_VERSIONIZED stappler::xenolith {
      30             : 
      31             : struct FrameInfo;
      32             : class Node;
      33             : class Scene;
      34             : 
      35             : class Component : public Ref {
      36             : public:
      37             :         static uint64_t GetNextComponentId();
      38             : 
      39             :         Component();
      40             :         virtual ~Component();
      41             :         virtual bool init();
      42             : 
      43             :         virtual void onAdded(Node *owner);
      44             :         virtual void onRemoved();
      45             : 
      46             :         virtual void onEnter(Scene *);
      47             :         virtual void onExit();
      48             : 
      49             :         virtual void visit(FrameInfo &, NodeFlags parentFlags);
      50             : 
      51             :         virtual void update(const UpdateTime &time);
      52             : 
      53             :         virtual void onContentSizeDirty();
      54             :         virtual void onTransformDirty(const Mat4 &);
      55             :         virtual void onReorderChildDirty();
      56             : 
      57             :         virtual bool isRunning() const;
      58             : 
      59             :         virtual bool isEnabled() const;
      60             :         virtual void setEnabled(bool b);
      61             : 
      62             :         bool isScheduled() const;
      63             :         void scheduleUpdate();
      64             :         void unscheduleUpdate();
      65             : 
      66       11480 :         Node* getOwner() const { return _owner; }
      67             : 
      68             :         void setFrameTag(uint64_t);
      69      502332 :         uint64_t getFrameTag() const { return _frameTag; }
      70             : 
      71             : protected:
      72             :         Node *_owner = nullptr;
      73             :         bool _enabled = true;
      74             :         bool _running = false;
      75             :         bool _scheduled = false;
      76             :         uint64_t _frameTag = InvalidTag;
      77             : };
      78             : 
      79             : }
      80             : 
      81             : #endif /* XENOLITH_SCENE_NODES_XLCOMPONENT_H_ */

Generated by: LCOV version 1.14