| 22 | }; |
| 23 | |
| 24 | struct string { |
| 25 | std::vector<string_part> parts; |
| 26 | string() = default; |
| 27 | string(const std::string & v, bool user_input = false) { |
| 28 | parts.push_back({user_input, v}); |
| 29 | } |
| 30 | string(int v) { |
| 31 | parts.push_back({false, std::to_string(v)}); |
| 32 | } |
| 33 | string(double v) { |
| 34 | parts.push_back({false, std::to_string(v)}); |
| 35 | } |
| 36 | |
| 37 | // mark all parts as user input |
| 38 | void mark_input(); |
| 39 | |
| 40 | std::string str() const; |
| 41 | size_t length() const; |
| 42 | void hash_update(hasher & hash) const noexcept; |
| 43 | bool all_parts_are_input() const; |
| 44 | bool is_uppercase() const; |
| 45 | bool is_lowercase() const; |
| 46 | |
| 47 | // mark this string as input if other has ALL parts as input |
| 48 | void mark_input_based_on(const string & other); |
| 49 | |
| 50 | string append(const string & other); |
| 51 | |
| 52 | // in-place transformations |
| 53 | |
| 54 | string uppercase(); |
| 55 | string lowercase(); |
| 56 | string capitalize(); |
| 57 | string titlecase(); |
| 58 | string strip(bool left, bool right, std::optional<const std::string_view> chars = std::nullopt); |
| 59 | }; |
| 60 | |
| 61 | } // namespace jinja |
no outgoing calls