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

Represents the content of a file (Binary Large Object). More...

#include <Blob.hxx>

Inheritance diagram for svcs::core::Blob:
svcs::core::VcsObject

Public Member Functions

 Blob (std::string raw_data)
 Constructor for the Blob object.
std::string getType () const override
 Returns the type of the VCS object.
std::string serialize () const override
 Serializes the object's core data for hashing and storage.
const std::string & getData () const
 Returns the raw data content stored in the Blob.
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

Represents the content of a file (Binary Large Object).

This is the lowest-level object in the VCS, storing only raw file bytes. The Blob object is immutable; its hash is solely dependent on its content.

Constructor & Destructor Documentation

◆ Blob()

svcs::core::Blob::Blob ( std::string raw_data)

Constructor for the Blob object.

Initializes the object and immediately computes its hash ID based on the raw_data.

Parameters
raw_dataThe raw file content to be stored and hashed.

Member Function Documentation

◆ getData()

const std::string & svcs::core::Blob::getData ( ) const
nodiscard

Returns the raw data content stored in the Blob.

Returns
const std::string& A constant reference to the file content.

◆ getType()

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

Returns the type of the VCS object.

Returns
std::string Always returns "blob". 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::Blob::serialize ( ) const
nodiscardoverridevirtual

Serializes the object's core data for hashing and storage.

Returns
std::string Returns the raw file content (data) itself. 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: