mirror of
https://github.com/geode-sdk/geode.git
synced 2024-11-22 07:27:59 -05:00
code cleanup: remove unnecessary const in function parameters
Some checks are pending
Build Binaries / Build Windows (push) Waiting to run
Build Binaries / Build macOS (push) Waiting to run
Build Binaries / Build Android (64-bit) (push) Waiting to run
Build Binaries / Build Android (32-bit) (push) Waiting to run
Build Binaries / Publish (push) Blocked by required conditions
Some checks are pending
Build Binaries / Build Windows (push) Waiting to run
Build Binaries / Build macOS (push) Waiting to run
Build Binaries / Build Android (64-bit) (push) Waiting to run
Build Binaries / Build Android (32-bit) (push) Waiting to run
Build Binaries / Publish (push) Blocked by required conditions
This commit is contained in:
parent
deab3d2517
commit
084fea220e
18 changed files with 91 additions and 91 deletions
|
@ -93,7 +93,7 @@ namespace gd {
|
||||||
bool empty() const;
|
bool empty() const;
|
||||||
|
|
||||||
bool operator==(string const& other) const;
|
bool operator==(string const& other) const;
|
||||||
bool operator==(std::string_view const other) const;
|
bool operator==(std::string_view other) const;
|
||||||
bool operator==(char const* other) const {
|
bool operator==(char const* other) const {
|
||||||
return *this == std::string_view(other);
|
return *this == std::string_view(other);
|
||||||
}
|
}
|
||||||
|
@ -101,7 +101,7 @@ namespace gd {
|
||||||
return *this == std::string_view(other);
|
return *this == std::string_view(other);
|
||||||
}
|
}
|
||||||
std::strong_ordering operator<=>(string const& other) const;
|
std::strong_ordering operator<=>(string const& other) const;
|
||||||
std::strong_ordering operator<=>(std::string_view const other) const;
|
std::strong_ordering operator<=>(std::string_view other) const;
|
||||||
std::strong_ordering operator<=>(char const* other) const {
|
std::strong_ordering operator<=>(char const* other) const {
|
||||||
return *this <=> std::string_view(other);
|
return *this <=> std::string_view(other);
|
||||||
}
|
}
|
||||||
|
|
|
@ -103,26 +103,26 @@ namespace geode {
|
||||||
* Returns whether the specified launch argument was passed in via the command line.
|
* Returns whether the specified launch argument was passed in via the command line.
|
||||||
* @param name The argument name
|
* @param name The argument name
|
||||||
*/
|
*/
|
||||||
bool hasLaunchArgument(std::string_view const name) const;
|
bool hasLaunchArgument(std::string_view name) const;
|
||||||
/**
|
/**
|
||||||
* Get a launch argument. These are passed into the game as command-line arguments
|
* Get a launch argument. These are passed into the game as command-line arguments
|
||||||
* with the format `--geode:arg-name=value`.
|
* with the format `--geode:arg-name=value`.
|
||||||
* @param name The argument name
|
* @param name The argument name
|
||||||
* @return The value, if present
|
* @return The value, if present
|
||||||
*/
|
*/
|
||||||
std::optional<std::string> getLaunchArgument(std::string_view const name) const;
|
std::optional<std::string> getLaunchArgument(std::string_view name) const;
|
||||||
/**
|
/**
|
||||||
* Get a launch argument flag. Returns whether the argument is present and its
|
* Get a launch argument flag. Returns whether the argument is present and its
|
||||||
* value is exactly `true`.
|
* value is exactly `true`.
|
||||||
* @param name The argument name
|
* @param name The argument name
|
||||||
*/
|
*/
|
||||||
bool getLaunchFlag(std::string_view const name) const;
|
bool getLaunchFlag(std::string_view name) const;
|
||||||
/**
|
/**
|
||||||
* Get and parse a launch argument value using the setting value system.
|
* Get and parse a launch argument value using the setting value system.
|
||||||
* @param name The argument name
|
* @param name The argument name
|
||||||
*/
|
*/
|
||||||
template <class T>
|
template <class T>
|
||||||
Result<T> parseLaunchArgument(std::string_view const name) const {
|
Result<T> parseLaunchArgument(std::string_view name) const {
|
||||||
auto str = this->getLaunchArgument(name);
|
auto str = this->getLaunchArgument(name);
|
||||||
if (!str.has_value()) {
|
if (!str.has_value()) {
|
||||||
return Err(fmt::format("Launch argument '{}' not found", name));
|
return Err(fmt::format("Launch argument '{}' not found", name));
|
||||||
|
|
|
@ -155,7 +155,7 @@ namespace geode {
|
||||||
* declared in `mod.json`)
|
* declared in `mod.json`)
|
||||||
*/
|
*/
|
||||||
std::vector<std::string> getSettingKeys() const;
|
std::vector<std::string> getSettingKeys() const;
|
||||||
bool hasSetting(std::string_view const key) const;
|
bool hasSetting(std::string_view key) const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the definition of a setting, or null if the setting was not found,
|
* Get the definition of a setting, or null if the setting was not found,
|
||||||
|
@ -163,7 +163,7 @@ namespace geode {
|
||||||
* `Mod::registerCustomSettingType`
|
* `Mod::registerCustomSettingType`
|
||||||
* @param key The key of the setting as defined in `mod.json`
|
* @param key The key of the setting as defined in `mod.json`
|
||||||
*/
|
*/
|
||||||
std::shared_ptr<Setting> getSetting(std::string_view const key) const;
|
std::shared_ptr<Setting> getSetting(std::string_view key) const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Register a custom setting type. See
|
* Register a custom setting type. See
|
||||||
|
@ -179,7 +179,7 @@ namespace geode {
|
||||||
* Returns a prefixed launch argument name. See `Mod::getLaunchArgument`
|
* Returns a prefixed launch argument name. See `Mod::getLaunchArgument`
|
||||||
* for details about mod-specific launch arguments.
|
* for details about mod-specific launch arguments.
|
||||||
*/
|
*/
|
||||||
std::string getLaunchArgumentName(std::string_view const name) const;
|
std::string getLaunchArgumentName(std::string_view name) const;
|
||||||
/**
|
/**
|
||||||
* Returns the names of the available mod-specific launch arguments.
|
* Returns the names of the available mod-specific launch arguments.
|
||||||
*/
|
*/
|
||||||
|
@ -189,7 +189,7 @@ namespace geode {
|
||||||
* for details about mod-specific launch arguments.
|
* for details about mod-specific launch arguments.
|
||||||
* @param name The argument name
|
* @param name The argument name
|
||||||
*/
|
*/
|
||||||
bool hasLaunchArgument(std::string_view const name) const;
|
bool hasLaunchArgument(std::string_view name) const;
|
||||||
/**
|
/**
|
||||||
* Get a mod-specific launch argument. This is equivalent to `Loader::getLaunchArgument`
|
* Get a mod-specific launch argument. This is equivalent to `Loader::getLaunchArgument`
|
||||||
* with the argument name prefixed by the mod ID. For example, a launch argument named
|
* with the argument name prefixed by the mod ID. For example, a launch argument named
|
||||||
|
@ -197,20 +197,20 @@ namespace geode {
|
||||||
* @param name The argument name
|
* @param name The argument name
|
||||||
* @return The value, if present
|
* @return The value, if present
|
||||||
*/
|
*/
|
||||||
std::optional<std::string> getLaunchArgument(std::string_view const name) const;
|
std::optional<std::string> getLaunchArgument(std::string_view name) const;
|
||||||
/**
|
/**
|
||||||
* Equivalent to a prefixed `Loader::getLaunchFlag` call. See `Mod::getLaunchArgument`
|
* Equivalent to a prefixed `Loader::getLaunchFlag` call. See `Mod::getLaunchArgument`
|
||||||
* for details about mod-specific launch arguments.
|
* for details about mod-specific launch arguments.
|
||||||
* @param name The argument name
|
* @param name The argument name
|
||||||
*/
|
*/
|
||||||
bool getLaunchFlag(std::string_view const name) const;
|
bool getLaunchFlag(std::string_view name) const;
|
||||||
/**
|
/**
|
||||||
* Equivalent to a prefixed `Loader::parseLaunchArgument` call. See `Mod::getLaunchArgument`
|
* Equivalent to a prefixed `Loader::parseLaunchArgument` call. See `Mod::getLaunchArgument`
|
||||||
* for details about mod-specific launch arguments.
|
* for details about mod-specific launch arguments.
|
||||||
* @param name The argument name
|
* @param name The argument name
|
||||||
*/
|
*/
|
||||||
template <class T>
|
template <class T>
|
||||||
std::optional<T> parseLaunchArgument(std::string_view const name) const {
|
std::optional<T> parseLaunchArgument(std::string_view name) const {
|
||||||
return Loader::get()->parseLaunchArgument<T>(this->getLaunchArgumentName(name));
|
return Loader::get()->parseLaunchArgument<T>(this->getLaunchArgumentName(name));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -224,7 +224,7 @@ namespace geode {
|
||||||
* setting type has a `getValue` function which returns the value
|
* setting type has a `getValue` function which returns the value
|
||||||
*/
|
*/
|
||||||
template <class T>
|
template <class T>
|
||||||
T getSettingValue(std::string_view const key) const {
|
T getSettingValue(std::string_view key) const {
|
||||||
using S = typename SettingTypeForValueType<T>::SettingType;
|
using S = typename SettingTypeForValueType<T>::SettingType;
|
||||||
if (auto sett = cast::typeinfo_pointer_cast<S>(this->getSetting(key))) {
|
if (auto sett = cast::typeinfo_pointer_cast<S>(this->getSetting(key))) {
|
||||||
return sett->getValue();
|
return sett->getValue();
|
||||||
|
@ -233,7 +233,7 @@ namespace geode {
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class T>
|
template <class T>
|
||||||
T setSettingValue(std::string_view const key, T const& value) {
|
T setSettingValue(std::string_view key, T const& value) {
|
||||||
using S = typename SettingTypeForValueType<T>::SettingType;
|
using S = typename SettingTypeForValueType<T>::SettingType;
|
||||||
if (auto sett = cast::typeinfo_pointer_cast<S>(this->getSetting(key))) {
|
if (auto sett = cast::typeinfo_pointer_cast<S>(this->getSetting(key))) {
|
||||||
auto old = sett->getValue();
|
auto old = sett->getValue();
|
||||||
|
@ -243,10 +243,10 @@ namespace geode {
|
||||||
return T();
|
return T();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool hasSavedValue(std::string_view const key);
|
bool hasSavedValue(std::string_view key);
|
||||||
|
|
||||||
template <class T>
|
template <class T>
|
||||||
T getSavedValue(std::string_view const key) {
|
T getSavedValue(std::string_view key) {
|
||||||
auto& saved = this->getSaveContainer();
|
auto& saved = this->getSaveContainer();
|
||||||
if (auto res = saved.get(key).andThen([](auto&& v) {
|
if (auto res = saved.get(key).andThen([](auto&& v) {
|
||||||
return v.template as<T>();
|
return v.template as<T>();
|
||||||
|
@ -257,7 +257,7 @@ namespace geode {
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class T>
|
template <class T>
|
||||||
T getSavedValue(std::string_view const key, T const& defaultValue) {
|
T getSavedValue(std::string_view key, T const& defaultValue) {
|
||||||
auto& saved = this->getSaveContainer();
|
auto& saved = this->getSaveContainer();
|
||||||
if (auto res = saved.get(key).andThen([](auto&& v) {
|
if (auto res = saved.get(key).andThen([](auto&& v) {
|
||||||
return v.template as<T>();
|
return v.template as<T>();
|
||||||
|
@ -276,7 +276,7 @@ namespace geode {
|
||||||
* @returns The old value
|
* @returns The old value
|
||||||
*/
|
*/
|
||||||
template <class T>
|
template <class T>
|
||||||
T setSavedValue(std::string_view const key, T const& value) {
|
T setSavedValue(std::string_view key, T const& value) {
|
||||||
auto& saved = this->getSaveContainer();
|
auto& saved = this->getSaveContainer();
|
||||||
auto old = this->getSavedValue<T>(key);
|
auto old = this->getSavedValue<T>(key);
|
||||||
saved[key] = value;
|
saved[key] = value;
|
||||||
|
@ -417,7 +417,7 @@ namespace geode {
|
||||||
* Check whether or not this Mod
|
* Check whether or not this Mod
|
||||||
* depends on another mod
|
* depends on another mod
|
||||||
*/
|
*/
|
||||||
bool depends(std::string_view const id) const;
|
bool depends(std::string_view id) const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check whether all the required
|
* Check whether all the required
|
||||||
|
|
|
@ -24,34 +24,34 @@ namespace geode {
|
||||||
*/
|
*/
|
||||||
class GEODE_DLL SimpleTextArea : public cocos2d::CCNode {
|
class GEODE_DLL SimpleTextArea : public cocos2d::CCNode {
|
||||||
public:
|
public:
|
||||||
static SimpleTextArea* create(const std::string& text, const std::string& font = "chatFont.fnt", const float scale = 1);
|
static SimpleTextArea* create(const std::string& text, const std::string& font = "chatFont.fnt", float scale = 1.0f);
|
||||||
static SimpleTextArea* create(const std::string& text, const std::string& font, const float scale, const float width);
|
static SimpleTextArea* create(const std::string& text, const std::string& font, float scale, float width);
|
||||||
|
|
||||||
void setFont(const std::string& font);
|
void setFont(const std::string& font);
|
||||||
std::string getFont();
|
std::string getFont();
|
||||||
void setColor(const cocos2d::ccColor4B& color);
|
void setColor(const cocos2d::ccColor4B& color);
|
||||||
cocos2d::ccColor4B getColor();
|
cocos2d::ccColor4B getColor();
|
||||||
void setAlignment(const cocos2d::CCTextAlignment alignment);
|
void setAlignment(cocos2d::CCTextAlignment alignment);
|
||||||
cocos2d::CCTextAlignment getAlignment();
|
cocos2d::CCTextAlignment getAlignment();
|
||||||
void setWrappingMode(const WrappingMode mode);
|
void setWrappingMode(WrappingMode mode);
|
||||||
WrappingMode getWrappingMode();
|
WrappingMode getWrappingMode();
|
||||||
void setText(const std::string& text);
|
void setText(const std::string& text);
|
||||||
std::string getText();
|
std::string getText();
|
||||||
void setMaxLines(const size_t maxLines);
|
void setMaxLines(size_t maxLines);
|
||||||
size_t getMaxLines();
|
size_t getMaxLines();
|
||||||
void setWidth(const float width);
|
void setWidth(float width);
|
||||||
float getWidth();
|
float getWidth();
|
||||||
void setScale(const float scale) override;
|
void setScale(float scale) override;
|
||||||
float getScale() override;
|
float getScale() override;
|
||||||
void setLinePadding(const float padding);
|
void setLinePadding(float padding);
|
||||||
float getLinePadding();
|
float getLinePadding();
|
||||||
std::vector<cocos2d::CCLabelBMFont*> getLines();
|
std::vector<cocos2d::CCLabelBMFont*> getLines();
|
||||||
float getHeight();
|
float getHeight();
|
||||||
float getLineHeight();
|
float getLineHeight();
|
||||||
private:
|
private:
|
||||||
static SimpleTextArea* create(const std::string& font, const std::string& text, const float scale, const float width, const bool artificialWidth);
|
static SimpleTextArea* create(const std::string& font, const std::string& text, float scale, float width, const bool artificialWidth);
|
||||||
|
|
||||||
bool init(const std::string& font, const std::string& text, const float scale, const float width, const bool artificialWidth);
|
bool init(const std::string& font, const std::string& text, float scale, float width, const bool artificialWidth);
|
||||||
|
|
||||||
bool m_shouldUpdate = false;
|
bool m_shouldUpdate = false;
|
||||||
bool m_artificialWidth = false;
|
bool m_artificialWidth = false;
|
||||||
|
@ -67,9 +67,9 @@ namespace geode {
|
||||||
float m_lineHeight = 0.f;
|
float m_lineHeight = 0.f;
|
||||||
float m_linePadding = 0.f;
|
float m_linePadding = 0.f;
|
||||||
|
|
||||||
cocos2d::CCLabelBMFont* createLabel(const std::string& text, const float top);
|
cocos2d::CCLabelBMFont* createLabel(const std::string& text, float top);
|
||||||
float calculateOffset(cocos2d::CCLabelBMFont* label);
|
float calculateOffset(cocos2d::CCLabelBMFont* label);
|
||||||
void charIteration(const std::function<cocos2d::CCLabelBMFont*(cocos2d::CCLabelBMFont* line, const char c, const float top)>& overflowHandling);
|
void charIteration(const std::function<cocos2d::CCLabelBMFont*(cocos2d::CCLabelBMFont* line, char c, float top)>& overflowHandling);
|
||||||
void updateLinesNoWrap();
|
void updateLinesNoWrap();
|
||||||
void updateLinesWordWrap(bool spaceWrap);
|
void updateLinesWordWrap(bool spaceWrap);
|
||||||
void updateLinesCutoffWrap();
|
void updateLinesCutoffWrap();
|
||||||
|
|
|
@ -140,7 +140,7 @@ namespace geode {
|
||||||
|
|
||||||
class PrivateMarker final {};
|
class PrivateMarker final {};
|
||||||
|
|
||||||
static std::shared_ptr<Handle> create(std::string_view const name) {
|
static std::shared_ptr<Handle> create(std::string_view name) {
|
||||||
return std::make_shared<Handle>(PrivateMarker(), name);
|
return std::make_shared<Handle>(PrivateMarker(), name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -153,7 +153,7 @@ namespace geode {
|
||||||
friend class Task;
|
friend class Task;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Handle(PrivateMarker, std::string_view const name) : m_name(name) {}
|
Handle(PrivateMarker, std::string_view name) : m_name(name) {}
|
||||||
~Handle() {
|
~Handle() {
|
||||||
// If this Task was still pending when the Handle was destroyed,
|
// If this Task was still pending when the Handle was destroyed,
|
||||||
// it can no longer be listened to so just cancel and cleanup
|
// it can no longer be listened to so just cancel and cleanup
|
||||||
|
@ -393,7 +393,7 @@ namespace geode {
|
||||||
* Create a new Task that is immediately cancelled
|
* Create a new Task that is immediately cancelled
|
||||||
* @param name The name of the Task; used for debugging
|
* @param name The name of the Task; used for debugging
|
||||||
*/
|
*/
|
||||||
static Task cancelled(std::string_view const name = "<Cancelled Task>") {
|
static Task cancelled(std::string_view name = "<Cancelled Task>") {
|
||||||
auto task = Task(Handle::create(name));
|
auto task = Task(Handle::create(name));
|
||||||
Task::cancel(task.m_handle);
|
Task::cancel(task.m_handle);
|
||||||
return task;
|
return task;
|
||||||
|
@ -404,7 +404,7 @@ namespace geode {
|
||||||
* @param value The value the Task shall be finished with
|
* @param value The value the Task shall be finished with
|
||||||
* @param name The name of the Task; used for debugging
|
* @param name The name of the Task; used for debugging
|
||||||
*/
|
*/
|
||||||
static Task immediate(T value, std::string_view const name = "<Immediate Task>") {
|
static Task immediate(T value, std::string_view name = "<Immediate Task>") {
|
||||||
auto task = Task(Handle::create(name));
|
auto task = Task(Handle::create(name));
|
||||||
Task::finish(task.m_handle, std::move(value));
|
Task::finish(task.m_handle, std::move(value));
|
||||||
return task;
|
return task;
|
||||||
|
@ -416,7 +416,7 @@ namespace geode {
|
||||||
* function MUST be synchronous - Task creates the thread for you!
|
* function MUST be synchronous - Task creates the thread for you!
|
||||||
* @param name The name of the Task; used for debugging
|
* @param name The name of the Task; used for debugging
|
||||||
*/
|
*/
|
||||||
static Task run(Run&& body, std::string_view const name = "<Task>") {
|
static Task run(Run&& body, std::string_view name = "<Task>") {
|
||||||
auto task = Task(Handle::create(name));
|
auto task = Task(Handle::create(name));
|
||||||
std::thread([handle = std::weak_ptr(task.m_handle), name = std::string(name), body = std::move(body)] {
|
std::thread([handle = std::weak_ptr(task.m_handle), name = std::string(name), body = std::move(body)] {
|
||||||
utils::thread::setName(fmt::format("Task '{}'", name));
|
utils::thread::setName(fmt::format("Task '{}'", name));
|
||||||
|
@ -449,7 +449,7 @@ namespace geode {
|
||||||
* calls will always be ignored
|
* calls will always be ignored
|
||||||
* @param name The name of the Task; used for debugging
|
* @param name The name of the Task; used for debugging
|
||||||
*/
|
*/
|
||||||
static Task runWithCallback(RunWithCallback&& body, std::string_view const name = "<Callback Task>") {
|
static Task runWithCallback(RunWithCallback&& body, std::string_view name = "<Callback Task>") {
|
||||||
auto task = Task(Handle::create(name));
|
auto task = Task(Handle::create(name));
|
||||||
std::thread([handle = std::weak_ptr(task.m_handle), name = std::string(name), body = std::move(body)] {
|
std::thread([handle = std::weak_ptr(task.m_handle), name = std::string(name), body = std::move(body)] {
|
||||||
utils::thread::setName(fmt::format("Task '{}'", name));
|
utils::thread::setName(fmt::format("Task '{}'", name));
|
||||||
|
@ -484,7 +484,7 @@ namespace geode {
|
||||||
* were cancelled!
|
* were cancelled!
|
||||||
*/
|
*/
|
||||||
template <std::move_constructible NP>
|
template <std::move_constructible NP>
|
||||||
static Task<std::vector<T*>, std::monostate> all(std::vector<Task<T, NP>>&& tasks, std::string_view const name = "<Multiple Tasks>") {
|
static Task<std::vector<T*>, std::monostate> all(std::vector<Task<T, NP>>&& tasks, std::string_view name = "<Multiple Tasks>") {
|
||||||
using AllTask = Task<std::vector<T*>, std::monostate>;
|
using AllTask = Task<std::vector<T*>, std::monostate>;
|
||||||
|
|
||||||
// If there are no tasks, return an immediate task that does nothing
|
// If there are no tasks, return an immediate task that does nothing
|
||||||
|
@ -581,7 +581,7 @@ namespace geode {
|
||||||
* the mapped task is appended to the end
|
* the mapped task is appended to the end
|
||||||
*/
|
*/
|
||||||
template <class ResultMapper, class ProgressMapper, class OnCancelled>
|
template <class ResultMapper, class ProgressMapper, class OnCancelled>
|
||||||
auto map(ResultMapper&& resultMapper, ProgressMapper&& progressMapper, OnCancelled&& onCancelled, std::string_view const name = "<Mapping Task>") const {
|
auto map(ResultMapper&& resultMapper, ProgressMapper&& progressMapper, OnCancelled&& onCancelled, std::string_view name = "<Mapping Task>") const {
|
||||||
using T2 = decltype(resultMapper(std::declval<T*>()));
|
using T2 = decltype(resultMapper(std::declval<T*>()));
|
||||||
using P2 = decltype(progressMapper(std::declval<P*>()));
|
using P2 = decltype(progressMapper(std::declval<P*>()));
|
||||||
|
|
||||||
|
@ -651,7 +651,7 @@ namespace geode {
|
||||||
* @param name The name of the Task; used for debugging. The name of
|
* @param name The name of the Task; used for debugging. The name of
|
||||||
* the mapped task is appended to the end
|
* the mapped task is appended to the end
|
||||||
*/ template <class ResultMapper, class ProgressMapper>
|
*/ template <class ResultMapper, class ProgressMapper>
|
||||||
auto map(ResultMapper&& resultMapper, ProgressMapper&& progressMapper, std::string_view const name = "<Mapping Task>") const {
|
auto map(ResultMapper&& resultMapper, ProgressMapper&& progressMapper, std::string_view name = "<Mapping Task>") const {
|
||||||
return this->map(std::move(resultMapper), std::move(progressMapper), +[]() {}, name);
|
return this->map(std::move(resultMapper), std::move(progressMapper), +[]() {}, name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -669,7 +669,7 @@ namespace geode {
|
||||||
* the mapped task is appended to the end
|
* the mapped task is appended to the end
|
||||||
*/ template <class ResultMapper>
|
*/ template <class ResultMapper>
|
||||||
requires std::copy_constructible<P>
|
requires std::copy_constructible<P>
|
||||||
auto map(ResultMapper&& resultMapper, std::string_view const name = "<Mapping Task>") const {
|
auto map(ResultMapper&& resultMapper, std::string_view name = "<Mapping Task>") const {
|
||||||
return this->map(std::move(resultMapper), +[](P* p) -> P { return *p; }, name);
|
return this->map(std::move(resultMapper), +[](P* p) -> P { return *p; }, name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -117,7 +117,7 @@ namespace geode {
|
||||||
* @returns String as number, or Err if the string couldn't be converted
|
* @returns String as number, or Err if the string couldn't be converted
|
||||||
*/
|
*/
|
||||||
template <class Num>
|
template <class Num>
|
||||||
Result<Num> numFromString(std::string_view const str, int base = 10) {
|
Result<Num> numFromString(std::string_view str, int base = 10) {
|
||||||
if constexpr (std::is_floating_point_v<Num>
|
if constexpr (std::is_floating_point_v<Num>
|
||||||
#if defined(__cpp_lib_to_chars)
|
#if defined(__cpp_lib_to_chars)
|
||||||
&& false
|
&& false
|
||||||
|
|
|
@ -13,7 +13,7 @@ namespace geode::stl {
|
||||||
void free();
|
void free();
|
||||||
|
|
||||||
char* getStorage();
|
char* getStorage();
|
||||||
void setStorage(const std::string_view);
|
void setStorage(std::string_view);
|
||||||
|
|
||||||
size_t getSize();
|
size_t getSize();
|
||||||
void setSize(size_t);
|
void setSize(size_t);
|
||||||
|
|
|
@ -100,11 +100,11 @@ namespace gd {
|
||||||
bool string::operator==(string const& other) const {
|
bool string::operator==(string const& other) const {
|
||||||
return std::string_view(*this) == std::string_view(other);
|
return std::string_view(*this) == std::string_view(other);
|
||||||
}
|
}
|
||||||
bool string::operator==(std::string_view const other) const {
|
bool string::operator==(std::string_view other) const {
|
||||||
return std::string_view(*this) == other;
|
return std::string_view(*this) == other;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::strong_ordering string::operator<=>(std::string_view const other) const {
|
std::strong_ordering string::operator<=>(std::string_view other) const {
|
||||||
return static_cast<std::strong_ordering>(std::string_view(*this).compare(other) <=> 0);
|
return static_cast<std::strong_ordering>(std::string_view(*this).compare(other) <=> 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -119,14 +119,14 @@ std::vector<std::string> Loader::getLaunchArgumentNames() const {
|
||||||
return m_impl->getLaunchArgumentNames();
|
return m_impl->getLaunchArgumentNames();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Loader::hasLaunchArgument(std::string_view const name) const {
|
bool Loader::hasLaunchArgument(std::string_view name) const {
|
||||||
return m_impl->hasLaunchArgument(name);
|
return m_impl->hasLaunchArgument(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::optional<std::string> Loader::getLaunchArgument(std::string_view const name) const {
|
std::optional<std::string> Loader::getLaunchArgument(std::string_view name) const {
|
||||||
return m_impl->getLaunchArgument(name);
|
return m_impl->getLaunchArgument(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Loader::getLaunchFlag(std::string_view const name) const {
|
bool Loader::getLaunchFlag(std::string_view name) const {
|
||||||
return m_impl->getLaunchFlag(name);
|
return m_impl->getLaunchFlag(name);
|
||||||
}
|
}
|
||||||
|
|
|
@ -927,11 +927,11 @@ std::vector<std::string> Loader::Impl::getLaunchArgumentNames() const {
|
||||||
return map::keys(m_launchArgs);
|
return map::keys(m_launchArgs);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Loader::Impl::hasLaunchArgument(std::string_view const name) const {
|
bool Loader::Impl::hasLaunchArgument(std::string_view name) const {
|
||||||
return m_launchArgs.find(std::string(name)) != m_launchArgs.end();
|
return m_launchArgs.find(std::string(name)) != m_launchArgs.end();
|
||||||
}
|
}
|
||||||
|
|
||||||
std::optional<std::string> Loader::Impl::getLaunchArgument(std::string_view const name) const {
|
std::optional<std::string> Loader::Impl::getLaunchArgument(std::string_view name) const {
|
||||||
auto value = m_launchArgs.find(std::string(name));
|
auto value = m_launchArgs.find(std::string(name));
|
||||||
if (value == m_launchArgs.end()) {
|
if (value == m_launchArgs.end()) {
|
||||||
return std::nullopt;
|
return std::nullopt;
|
||||||
|
@ -939,7 +939,7 @@ std::optional<std::string> Loader::Impl::getLaunchArgument(std::string_view cons
|
||||||
return std::optional(value->second);
|
return std::optional(value->second);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Loader::Impl::getLaunchFlag(std::string_view const name) const {
|
bool Loader::Impl::getLaunchFlag(std::string_view name) const {
|
||||||
auto arg = this->getLaunchArgument(name);
|
auto arg = this->getLaunchArgument(name);
|
||||||
return arg.has_value() && arg.value() == "true";
|
return arg.has_value() && arg.value() == "true";
|
||||||
}
|
}
|
||||||
|
|
|
@ -115,9 +115,9 @@ namespace geode {
|
||||||
std::string getLaunchCommand() const;
|
std::string getLaunchCommand() const;
|
||||||
void initLaunchArguments();
|
void initLaunchArguments();
|
||||||
std::vector<std::string> getLaunchArgumentNames() const;
|
std::vector<std::string> getLaunchArgumentNames() const;
|
||||||
bool hasLaunchArgument(std::string_view const name) const;
|
bool hasLaunchArgument(std::string_view name) const;
|
||||||
std::optional<std::string> getLaunchArgument(std::string_view const name) const;
|
std::optional<std::string> getLaunchArgument(std::string_view name) const;
|
||||||
bool getLaunchFlag(std::string_view const name) const;
|
bool getLaunchFlag(std::string_view name) const;
|
||||||
|
|
||||||
void updateResources(bool forceReload);
|
void updateResources(bool forceReload);
|
||||||
|
|
||||||
|
|
|
@ -148,11 +148,11 @@ std::vector<std::string> Mod::getSettingKeys() const {
|
||||||
return m_impl->getSettingKeys();
|
return m_impl->getSettingKeys();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Mod::hasSetting(std::string_view const key) const {
|
bool Mod::hasSetting(std::string_view key) const {
|
||||||
return m_impl->hasSetting(key);
|
return m_impl->hasSetting(key);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::shared_ptr<Setting> Mod::getSetting(std::string_view const key) const {
|
std::shared_ptr<Setting> Mod::getSetting(std::string_view key) const {
|
||||||
return m_impl->m_settings->get(std::string(key));
|
return m_impl->m_settings->get(std::string(key));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -164,15 +164,15 @@ std::vector<std::string> Mod::getLaunchArgumentNames() const {
|
||||||
return m_impl->getLaunchArgumentNames();
|
return m_impl->getLaunchArgumentNames();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Mod::hasLaunchArgument(std::string_view const name) const {
|
bool Mod::hasLaunchArgument(std::string_view name) const {
|
||||||
return m_impl->hasLaunchArgument(name);
|
return m_impl->hasLaunchArgument(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::optional<std::string> Mod::getLaunchArgument(std::string_view const name) const {
|
std::optional<std::string> Mod::getLaunchArgument(std::string_view name) const {
|
||||||
return m_impl->getLaunchArgument(name);
|
return m_impl->getLaunchArgument(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Mod::getLaunchFlag(std::string_view const name) const {
|
bool Mod::getLaunchFlag(std::string_view name) const {
|
||||||
return m_impl->getLaunchFlag(name);
|
return m_impl->getLaunchFlag(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -220,7 +220,7 @@ ModRequestedAction Mod::getRequestedAction() const {
|
||||||
return m_impl->getRequestedAction();
|
return m_impl->getRequestedAction();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Mod::depends(std::string_view const id) const {
|
bool Mod::depends(std::string_view id) const {
|
||||||
return m_impl->depends(id);
|
return m_impl->depends(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -248,7 +248,7 @@ void Mod::setLoggingEnabled(bool enabled) {
|
||||||
m_impl->setLoggingEnabled(enabled);
|
m_impl->setLoggingEnabled(enabled);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Mod::hasSavedValue(std::string_view const key) {
|
bool Mod::hasSavedValue(std::string_view key) {
|
||||||
return this->getSaveContainer().contains(key);
|
return this->getSaveContainer().contains(key);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -243,7 +243,7 @@ std::vector<std::string> Mod::Impl::getSettingKeys() const {
|
||||||
return keys;
|
return keys;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Mod::Impl::hasSetting(std::string_view const key) const {
|
bool Mod::Impl::hasSetting(std::string_view key) const {
|
||||||
for (auto& setting : m_metadata.getSettings()) {
|
for (auto& setting : m_metadata.getSettings()) {
|
||||||
if (setting.first == key) {
|
if (setting.first == key) {
|
||||||
return true;
|
return true;
|
||||||
|
@ -252,7 +252,7 @@ bool Mod::Impl::hasSetting(std::string_view const key) const {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string Mod::Impl::getLaunchArgumentName(std::string_view const name) const {
|
std::string Mod::Impl::getLaunchArgumentName(std::string_view name) const {
|
||||||
return this->getID() + "." + std::string(name);
|
return this->getID() + "." + std::string(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -267,15 +267,15 @@ std::vector<std::string> Mod::Impl::getLaunchArgumentNames() const {
|
||||||
return names;
|
return names;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Mod::Impl::hasLaunchArgument(std::string_view const name) const {
|
bool Mod::Impl::hasLaunchArgument(std::string_view name) const {
|
||||||
return Loader::get()->hasLaunchArgument(this->getLaunchArgumentName(name));
|
return Loader::get()->hasLaunchArgument(this->getLaunchArgumentName(name));
|
||||||
}
|
}
|
||||||
|
|
||||||
std::optional<std::string> Mod::Impl::getLaunchArgument(std::string_view const name) const {
|
std::optional<std::string> Mod::Impl::getLaunchArgument(std::string_view name) const {
|
||||||
return Loader::get()->getLaunchArgument(this->getLaunchArgumentName(name));
|
return Loader::get()->getLaunchArgument(this->getLaunchArgumentName(name));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Mod::Impl::getLaunchFlag(std::string_view const name) const {
|
bool Mod::Impl::getLaunchFlag(std::string_view name) const {
|
||||||
return Loader::get()->getLaunchFlag(this->getLaunchArgumentName(name));
|
return Loader::get()->getLaunchFlag(this->getLaunchArgumentName(name));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -442,7 +442,7 @@ bool Mod::Impl::hasUnresolvedIncompatibilities() const {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Mod::Impl::depends(std::string_view const id) const {
|
bool Mod::Impl::depends(std::string_view id) const {
|
||||||
return utils::ranges::contains(m_metadata.getDependencies(), [id](ModMetadata::Dependency const& t) {
|
return utils::ranges::contains(m_metadata.getDependencies(), [id](ModMetadata::Dependency const& t) {
|
||||||
return t.id == id;
|
return t.id == id;
|
||||||
});
|
});
|
||||||
|
|
|
@ -112,13 +112,13 @@ namespace geode {
|
||||||
|
|
||||||
bool hasSettings() const;
|
bool hasSettings() const;
|
||||||
std::vector<std::string> getSettingKeys() const;
|
std::vector<std::string> getSettingKeys() const;
|
||||||
bool hasSetting(std::string_view const key) const;
|
bool hasSetting(std::string_view key) const;
|
||||||
|
|
||||||
std::string getLaunchArgumentName(std::string_view const name) const;
|
std::string getLaunchArgumentName(std::string_view name) const;
|
||||||
std::vector<std::string> getLaunchArgumentNames() const;
|
std::vector<std::string> getLaunchArgumentNames() const;
|
||||||
bool hasLaunchArgument(std::string_view const name) const;
|
bool hasLaunchArgument(std::string_view name) const;
|
||||||
std::optional<std::string> getLaunchArgument(std::string_view const name) const;
|
std::optional<std::string> getLaunchArgument(std::string_view name) const;
|
||||||
bool getLaunchFlag(std::string_view const name) const;
|
bool getLaunchFlag(std::string_view name) const;
|
||||||
|
|
||||||
Result<Hook*> claimHook(std::shared_ptr<Hook> hook);
|
Result<Hook*> claimHook(std::shared_ptr<Hook> hook);
|
||||||
Result<> disownHook(Hook* hook);
|
Result<> disownHook(Hook* hook);
|
||||||
|
@ -136,7 +136,7 @@ namespace geode {
|
||||||
// 1.3.0 additions
|
// 1.3.0 additions
|
||||||
ModRequestedAction getRequestedAction() const;
|
ModRequestedAction getRequestedAction() const;
|
||||||
|
|
||||||
bool depends(std::string_view const id) const;
|
bool depends(std::string_view id) const;
|
||||||
Result<> updateDependencies();
|
Result<> updateDependencies();
|
||||||
bool hasUnresolvedDependencies() const;
|
bool hasUnresolvedDependencies() const;
|
||||||
bool hasUnresolvedIncompatibilities() const;
|
bool hasUnresolvedIncompatibilities() const;
|
||||||
|
|
|
@ -101,7 +101,7 @@ namespace geode::stl {
|
||||||
}
|
}
|
||||||
// TODO: add a copyFrom(string const&) to take advantage
|
// TODO: add a copyFrom(string const&) to take advantage
|
||||||
// of gnustl refcounted strings
|
// of gnustl refcounted strings
|
||||||
void StringImpl::setStorage(const std::string_view str) {
|
void StringImpl::setStorage(std::string_view str) {
|
||||||
this->free();
|
this->free();
|
||||||
|
|
||||||
if (str.size() == 0) {
|
if (str.size() == 0) {
|
||||||
|
|
|
@ -49,7 +49,7 @@ static std::string timestampToVersion(uint32_t timestamp) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static uint32_t versionToTimestamp(std::string_view const targetVersion) {
|
static uint32_t versionToTimestamp(std::string_view targetVersion) {
|
||||||
for (const auto& [stamp, ver] : getGDVersionTimestampMap()) {
|
for (const auto& [stamp, ver] : getGDVersionTimestampMap()) {
|
||||||
if (ver == targetVersion) {
|
if (ver == targetVersion) {
|
||||||
return stamp;
|
return stamp;
|
||||||
|
|
|
@ -2,15 +2,15 @@
|
||||||
|
|
||||||
using namespace geode::prelude;
|
using namespace geode::prelude;
|
||||||
|
|
||||||
SimpleTextArea* SimpleTextArea::create(const std::string& text, const std::string& font, const float scale) {
|
SimpleTextArea* SimpleTextArea::create(const std::string& text, const std::string& font, float scale) {
|
||||||
return SimpleTextArea::create(font, text, scale, CCDirector::sharedDirector()->getWinSize().width / 2, false);
|
return SimpleTextArea::create(font, text, scale, CCDirector::sharedDirector()->getWinSize().width / 2, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
SimpleTextArea* SimpleTextArea::create(const std::string& text, const std::string& font, const float scale, const float width) {
|
SimpleTextArea* SimpleTextArea::create(const std::string& text, const std::string& font, float scale, float width) {
|
||||||
return SimpleTextArea::create(font, text, scale, width, true);
|
return SimpleTextArea::create(font, text, scale, width, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
SimpleTextArea* SimpleTextArea::create(const std::string& font, const std::string& text, const float scale, const float width, const bool artificialWidth) {
|
SimpleTextArea* SimpleTextArea::create(const std::string& font, const std::string& text, float scale, float width, bool artificialWidth) {
|
||||||
SimpleTextArea* instance = new SimpleTextArea();
|
SimpleTextArea* instance = new SimpleTextArea();
|
||||||
|
|
||||||
if (instance->init(font, text, scale, width, artificialWidth)) {
|
if (instance->init(font, text, scale, width, artificialWidth)) {
|
||||||
|
@ -22,7 +22,7 @@ SimpleTextArea* SimpleTextArea::create(const std::string& font, const std::strin
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SimpleTextArea::init(const std::string& font, const std::string& text, const float scale, const float width, const bool artificialWidth) {
|
bool SimpleTextArea::init(const std::string& font, const std::string& text, float scale, float width, bool artificialWidth) {
|
||||||
m_font = font;
|
m_font = font;
|
||||||
m_text = text;
|
m_text = text;
|
||||||
m_scale = scale;
|
m_scale = scale;
|
||||||
|
@ -57,7 +57,7 @@ ccColor4B SimpleTextArea::getColor() {
|
||||||
return m_color;
|
return m_color;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SimpleTextArea::setAlignment(const CCTextAlignment alignment) {
|
void SimpleTextArea::setAlignment(CCTextAlignment alignment) {
|
||||||
m_alignment = alignment;
|
m_alignment = alignment;
|
||||||
this->updateContainer();
|
this->updateContainer();
|
||||||
}
|
}
|
||||||
|
@ -66,7 +66,7 @@ CCTextAlignment SimpleTextArea::getAlignment() {
|
||||||
return m_alignment;
|
return m_alignment;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SimpleTextArea::setWrappingMode(const WrappingMode mode) {
|
void SimpleTextArea::setWrappingMode(WrappingMode mode) {
|
||||||
m_wrappingMode = mode;
|
m_wrappingMode = mode;
|
||||||
this->updateContainer();
|
this->updateContainer();
|
||||||
}
|
}
|
||||||
|
@ -84,7 +84,7 @@ std::string SimpleTextArea::getText() {
|
||||||
return m_text;
|
return m_text;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SimpleTextArea::setMaxLines(const size_t maxLines) {
|
void SimpleTextArea::setMaxLines(size_t maxLines) {
|
||||||
m_maxLines = maxLines;
|
m_maxLines = maxLines;
|
||||||
this->updateContainer();
|
this->updateContainer();
|
||||||
}
|
}
|
||||||
|
@ -93,7 +93,7 @@ size_t SimpleTextArea::getMaxLines() {
|
||||||
return m_maxLines;
|
return m_maxLines;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SimpleTextArea::setWidth(const float width) {
|
void SimpleTextArea::setWidth(float width) {
|
||||||
m_artificialWidth = true;
|
m_artificialWidth = true;
|
||||||
this->updateContainer();
|
this->updateContainer();
|
||||||
|
|
||||||
|
@ -105,7 +105,7 @@ float SimpleTextArea::getWidth() {
|
||||||
return m_container->getContentSize().width;
|
return m_container->getContentSize().width;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SimpleTextArea::setScale(const float scale) {
|
void SimpleTextArea::setScale(float scale) {
|
||||||
m_scale = scale;
|
m_scale = scale;
|
||||||
this->updateContainer();
|
this->updateContainer();
|
||||||
}
|
}
|
||||||
|
@ -114,7 +114,7 @@ float SimpleTextArea::getScale() {
|
||||||
return m_scale;
|
return m_scale;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SimpleTextArea::setLinePadding(const float padding) {
|
void SimpleTextArea::setLinePadding(float padding) {
|
||||||
m_linePadding = padding;
|
m_linePadding = padding;
|
||||||
this->updateContainer();
|
this->updateContainer();
|
||||||
}
|
}
|
||||||
|
@ -135,7 +135,7 @@ float SimpleTextArea::getLineHeight() {
|
||||||
return m_lineHeight;
|
return m_lineHeight;
|
||||||
}
|
}
|
||||||
|
|
||||||
CCLabelBMFont* SimpleTextArea::createLabel(const std::string& text, const float top) {
|
CCLabelBMFont* SimpleTextArea::createLabel(const std::string& text, float top) {
|
||||||
if (m_maxLines && m_lines.size() >= m_maxLines) {
|
if (m_maxLines && m_lines.size() >= m_maxLines) {
|
||||||
CCLabelBMFont* last = m_lines.at(m_maxLines - 1);
|
CCLabelBMFont* last = m_lines.at(m_maxLines - 1);
|
||||||
const std::string& text = last->getString();
|
const std::string& text = last->getString();
|
||||||
|
@ -159,7 +159,7 @@ float SimpleTextArea::calculateOffset(CCLabelBMFont* label) {
|
||||||
return m_linePadding + label->getContentSize().height * m_scale;
|
return m_linePadding + label->getContentSize().height * m_scale;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SimpleTextArea::charIteration(const std::function<CCLabelBMFont*(CCLabelBMFont* line, const char c, const float top)>& overflowHandling) {
|
void SimpleTextArea::charIteration(const std::function<CCLabelBMFont*(CCLabelBMFont* line, char c, float top)>& overflowHandling) {
|
||||||
float top = 0;
|
float top = 0;
|
||||||
m_lines.clear();
|
m_lines.clear();
|
||||||
CCLabelBMFont* line = this->createLabel("", top);
|
CCLabelBMFont* line = this->createLabel("", top);
|
||||||
|
@ -208,7 +208,7 @@ void SimpleTextArea::updateLinesNoWrap() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void SimpleTextArea::updateLinesWordWrap(bool spaceWrap) {
|
void SimpleTextArea::updateLinesWordWrap(bool spaceWrap) {
|
||||||
this->charIteration([this, spaceWrap](CCLabelBMFont* line, const char c, const float top) {
|
this->charIteration([this, spaceWrap](CCLabelBMFont* line, char c, float top) {
|
||||||
const std::string_view delimiters(spaceWrap ? " " : " `~!@#$%^&*()-_=+[{}];:'\",<.>/?\\|");
|
const std::string_view delimiters(spaceWrap ? " " : " `~!@#$%^&*()-_=+[{}];:'\",<.>/?\\|");
|
||||||
|
|
||||||
if (delimiters.find(c) == std::string_view::npos) {
|
if (delimiters.find(c) == std::string_view::npos) {
|
||||||
|
@ -228,7 +228,7 @@ void SimpleTextArea::updateLinesWordWrap(bool spaceWrap) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void SimpleTextArea::updateLinesCutoffWrap() {
|
void SimpleTextArea::updateLinesCutoffWrap() {
|
||||||
this->charIteration([this](CCLabelBMFont* line, const char c, const float top) {
|
this->charIteration([this](CCLabelBMFont* line, char c, float top) {
|
||||||
const std::string& text = line->getString();
|
const std::string& text = line->getString();
|
||||||
const char back = text.back();
|
const char back = text.back();
|
||||||
const bool lastIsSpace = back == ' ';
|
const bool lastIsSpace = back == ' ';
|
||||||
|
|
|
@ -221,7 +221,7 @@ WebRequest::WebRequest() : m_impl(std::make_shared<Impl>()) {}
|
||||||
WebRequest::~WebRequest() {}
|
WebRequest::~WebRequest() {}
|
||||||
|
|
||||||
// Encodes a url param
|
// Encodes a url param
|
||||||
std::string urlParamEncode(std::string_view const input) {
|
static std::string urlParamEncode(std::string_view input) {
|
||||||
std::ostringstream ss;
|
std::ostringstream ss;
|
||||||
ss << std::hex << std::uppercase;
|
ss << std::hex << std::uppercase;
|
||||||
for (char c : input) {
|
for (char c : input) {
|
||||||
|
|
Loading…
Reference in a new issue