LCOV - code coverage report
Current view: top level - inc/tables/typeTable/types/userTypes - userType.h (source / functions) Coverage Total Hit
Test: coverage.info Lines: 0.0 % 20 0
Test Date: 2025-04-18 15:53:49 Functions: 0.0 % 8 0

            Line data    Source code
       1              : #ifndef USER_TYPE_H
       2              : #define USER_TYPE_H
       3              : 
       4              : #include "attrTable.h"
       5              : #include "attribute.h"
       6              : #include "constructor.h"
       7              : #include "destructor.h"
       8              : #include "genericParameter.h"
       9              : #include "method.h"
      10              : #include "methodTable.h"
      11              : #include <expected>
      12              : #include <memory>
      13              : #include <sstream>
      14              : #include <string>
      15              : #include <variant>
      16              : #include <vector>
      17              : 
      18              : namespace nicole {
      19              : 
      20              : class UserType : public Type {
      21              : private:
      22              :   std::string name_;
      23              :   std::shared_ptr<UserType> baseType_; // Solo se permite una base
      24              :   std::vector<GenericParameter> genericParams_;
      25              :   mutable AttrTable attrTable_;
      26              :   mutable MethodTable methodTable_;
      27              :   mutable std::shared_ptr<Constructor> constructor_;
      28              :   mutable std::shared_ptr<Destructor> destructor_;
      29              : 
      30              : public:
      31              :   explicit UserType(const std::string &name,
      32              :                     const std::shared_ptr<UserType> &baseType,
      33              :                     const std::vector<GenericParameter> &genericParams) noexcept
      34            0 :       : name_{name}, baseType_(baseType), genericParams_{genericParams} {}
      35              : 
      36            0 :   [[nodiscard]] const std::string &name() const noexcept { return name_; }
      37              : 
      38            0 :   [[nodiscard]] const std::shared_ptr<UserType> &baseType() const noexcept {
      39            0 :     return baseType_;
      40            0 :   }
      41              : 
      42              :   [[nodiscard]] const std::shared_ptr<Constructor> &
      43            0 :   constructor() const noexcept {
      44            0 :     return constructor_;
      45            0 :   }
      46              : 
      47            0 :   [[nodiscard]] const std::shared_ptr<Destructor> &destructor() const noexcept {
      48            0 :     return destructor_;
      49            0 :   }
      50              : 
      51              :   [[nodiscard]] const std::vector<GenericParameter> &
      52            0 :   genericParams() const noexcept {
      53            0 :     return genericParams_;
      54            0 :   }
      55              : 
      56              :   [[nodiscard]] bool hasAttribute(const std::string &id) const noexcept;
      57              : 
      58              :   [[nodiscard]] bool hasMethod(const Method &id) const noexcept;
      59              : 
      60              :   [[nodiscard]] const std::expected<Attribute, Error>
      61              :   getAttribute(const std::string &id) const noexcept;
      62              : 
      63              :   [[nodiscard]] const std::expected<std::vector<Method>, Error>
      64              :   getMethods(const std::string &id) const noexcept;
      65              : 
      66              :   void
      67            0 :   setDestructor(const std::shared_ptr<Destructor> &destructor) const noexcept {
      68            0 :     destructor_ = destructor;
      69            0 :   }
      70              : 
      71              :   void setConstructor(
      72            0 :       const std::shared_ptr<Constructor> &constructor) const noexcept {
      73            0 :     constructor_ = constructor;
      74            0 :   }
      75              : 
      76              :   [[nodiscard]] std::expected<std::monostate, Error>
      77              :   insertAttr(const Attribute &attr) const noexcept;
      78              : 
      79              :   void insertMethod(const Method &method) const noexcept;
      80              : 
      81              :   [[nodiscard]] std::expected<std::monostate, Error>
      82              :   setAttribute(const Attribute &attr) const noexcept;
      83              : 
      84              :   [[nodiscard]] bool
      85              :   isAboveInHearchy(const std::shared_ptr<UserType> &type) const noexcept;
      86              : 
      87              :   [[nodiscard]] std::string toString() const noexcept override;
      88              : };
      89              : 
      90              : } // namespace nicole
      91              : 
      92              : #endif
        

Generated by: LCOV version 2.0-1