25 lines
488 B
C++
25 lines
488 B
C++
#pragma once
|
|
#include <string>
|
|
|
|
namespace bts::core {
|
|
|
|
class StringFiller {
|
|
public:
|
|
static bool fill_if_empty(std::string &target, const std::string &fill);
|
|
};
|
|
|
|
//////////////////////////////////////////////////
|
|
// Definition
|
|
//////////////////////////////////////////////////
|
|
|
|
inline bool StringFiller::fill_if_empty(
|
|
std::string &target, const std::string &fill) {
|
|
if (!target.empty()) {
|
|
return false;
|
|
}
|
|
target = fill;
|
|
return true;
|
|
}
|
|
|
|
} // namespace bts::core
|