SVCS - English Documentation
Loading...
Searching...
No Matches
svcs::core::TestableObject Class Reference

Helper class for testing the non-abstract methods of VcsObject. More...

#include <VcsObject.hxx>

Inheritance diagram for svcs::core::TestableObject:
svcs::core::VcsObject

Public Member Functions

 TestableObject (std::string type, std::string data)
 Primary constructor.
std::string serialize () const override
 Implementation of the pure virtual method. Returns the stored content.
std::string getType () const override
 Implementation of the pure virtual method. Returns the stored type name.
Public Member Functions inherited from svcs::core::VcsObject
 VcsObject ()=default
 Default constructor. Required for derived classes.
 VcsObject (const VcsObject &other)=default
 Copy constructor. Required for derived classes to correctly copy the hash_id.
virtual ~VcsObject ()=default
 Virtual destructor.
std::string getHashId () const
 Returns the unique hash identifier of the object.

Additional Inherited Members

Static Public Member Functions inherited from svcs::core::VcsObject
static std::string calculateHash (const std::string &content)
 Calculates SHA-256 hash for given canonical content.
Protected Member Functions inherited from svcs::core::VcsObject
void computeHash (const std::string &content)
 Computes the cryptographic hash ID for the object's content.
Protected Attributes inherited from svcs::core::VcsObject
std::string hash_id
 The unique cryptographic hash identifier (e.g., SHA-256) for this object.

Detailed Description

Helper class for testing the non-abstract methods of VcsObject.

This class implements all pure virtual methods of VcsObject with simple stubs, allowing its instances to be created for unit testing the hashing logic in VcsObject::computeHash.

Constructor & Destructor Documentation

◆ TestableObject()

svcs::core::TestableObject::TestableObject ( std::string type,
std::string data )

Primary constructor.

Parameters
typeThe name of the object type (e.g., "test_blob").
dataThe content that will be serialized and hashed.

Member Function Documentation

◆ getType()

std::string svcs::core::TestableObject::getType ( ) const
nodiscardoverridevirtual

Implementation of the pure virtual method. Returns the stored type name.

Pure virtual method to get the type of the VCS object.

This is crucial for object storage and reconstruction (e.g., "commit", "blob", "tree").

Returns
std::string The type identifier of the object.

Implements svcs::core::VcsObject.

◆ serialize()

std::string svcs::core::TestableObject::serialize ( ) const
nodiscardoverridevirtual

Implementation of the pure virtual method. Returns the stored content.

Pure virtual method to serialize the object's core data.

The returned string content is what will be hashed and stored in the database.

Returns
std::string The standardized, serialized data of the object.

Implements svcs::core::VcsObject.


The documentation for this class was generated from the following files: