Logo

Cake Planner

Backend

env_loader.cpp

File Header Information

FieldValue
SPDX CommentEnvironment Loader Implementation
SPDX TypeSOURCE
ContributorZHENG Robert
License IDMIT
Fileenv_loader.cpp
DescriptionEnvironment Loader Implementation
Version0.15.0
Date2026-01-24
AuthorZHENG Robert (robert@hase-zheng.net)
CopyrightCopyright (c) 2026 ZHENG Robert
LicenseMIT

Table of Contents

API Documentation

namespace rz

rz namespace.


namespace utils

utils namespace.


void EnvLoader::load(const std::string &filenameStd)

Loads environment variables from a file.

ParameterDescription
filenameStdThe name of the file to load (default: .env).

QFile file(foundPath)

Function implementation.


QTextStream in(&file)

Function implementation.


QString EnvLoader::get(const std::string &keyStd, const std::string &defaultValueStd)

Retrieves an environment variable as a QString.

ParameterDescription
keyStdThe key of the environment variable.
defaultValueStdThe default value if the key is not found.

Returns: The value of the environment variable or the default value.


std::string EnvLoader::getString(const std::string &keyStd, const std::string &defaultValueStd)

Retrieves an environment variable as a std::string.

ParameterDescription
keyStdThe key of the environment variable.
defaultValueStdThe default value if the key is not found.

Returns: The value of the environment variable or the default value.


int EnvLoader::getInt(const std::string &keyStd, int defaultValue)

Retrieves an environment variable as an integer.

ParameterDescription
keyStdThe key of the environment variable.
defaultValueThe default value if the key is not found or not a valid number.

Returns: The integer value of the environment variable or the default value.