Haio 0.2.X
Homebrew Asset IO/CDN
Loading...
Searching...
No Matches
haio_string.hpp
Go to the documentation of this file.
1#pragma once
2
3#include "haio_object.hpp"
4
5#include <string_view>
6
7namespace Haio::String {
8
9int getInt(std::string_view value);
10Size getSize(std::string_view value);
11
12/**
13 * a size written as a share of what came in: "30%", or "30pct" where a percent sign
14 * cannot go.
15 *
16 * the url form exists because "%" opens an escape sequence: "?resize=30%" is not a
17 * request for thirty percent, it is a request the server has to reject as a broken
18 * escape. "pct" says the same thing and survives being a url.
19 *
20 * it answers zero when the text is not a share at all, since zero percent of a
21 * picture is nothing and could never have been meant.
22 */
23int getPercent(std::string_view value);
24Rect getRect(std::string_view value);
25bool tryGetSize(std::string_view value, Size& out);
26bool tryGetRect(std::string_view value, Rect& out);
27bool tryGetCropGeometry(std::string_view value, Rect& out);
28
29}
bool tryGetRect(std::string_view value, Rect &out)
Definition string.cpp:73
Size getSize(std::string_view value)
Definition string.cpp:67
bool tryGetSize(std::string_view value, Size &out)
Definition string.cpp:40
int getPercent(std::string_view value)
Definition string.cpp:52
int getInt(std::string_view value)
Definition string.cpp:34
Rect getRect(std::string_view value)
Definition string.cpp:88
bool tryGetCropGeometry(std::string_view value, Rect &out)
Definition string.cpp:94