LCOV - code coverage report
Current view: top level - core/db - SPDbObject.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) 2016-2022 Roman Katuntsev <sbkarr@stappler.org>
       3             : Copyright (c) 2023-2024 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 STAPPLER_DB_SPDBOBJECT_H_
      25             : #define STAPPLER_DB_SPDBOBJECT_H_
      26             : 
      27             : #include "SPDataWrapper.h"
      28             : #include "SPDb.h"
      29             : 
      30             : namespace STAPPLER_VERSIONIZED stappler::db {
      31             : 
      32             : class Object : public stappler::data::WrapperTemplate<Interface> {
      33             : public:
      34             :         Object(Value &&, const Scheme &);
      35             : 
      36             :         const Scheme &getScheme() const;
      37             :         uint64_t getObjectId() const;
      38             : 
      39             :         void lockProperty(const StringView &prop);
      40             :         void unlockProperty(const StringView &prop);
      41             :         bool isPropertyLocked(const StringView &prop) const;
      42             : 
      43             :         bool isFieldProtected(const StringView &) const;
      44             : 
      45          75 :         auto begin() { return WrapperTemplate::begin<Object>(this); }
      46          75 :         auto end() { return WrapperTemplate::end<Object>(this); }
      47             : 
      48             :         auto begin() const { return WrapperTemplate::begin<Object>(this); }
      49             :         auto end() const { return WrapperTemplate::end<Object>(this); }
      50             : 
      51             :         bool save(const Adapter &, bool force = false);
      52             : 
      53             : protected:
      54             :         friend class Scheme;
      55             : 
      56             :         uint64_t _oid;
      57             :         Set<String> _locked;
      58             :         const Scheme &_scheme;
      59             : };
      60             : 
      61             : }
      62             : 
      63             : #endif /* STAPPLER_DB_SPDBOBJECT_H_ */

Generated by: LCOV version 1.14