|
|
| version 1.231, 2024/03/11 21:15:32 | version 1.237, 2025/05/26 00:52:15 |
|---|---|
| Line 1 | Line 1 |
| /** @file | /** @file |
| Parser: string class decl. | Parser: string class decl. |
| Copyright (c) 2001-2023 Art. Lebedev Studio (http://www.artlebedev.com) | Copyright (c) 2001-2024 Art. Lebedev Studio (http://www.artlebedev.com) |
| Authors: Konstantin Morshnev <moko@design.ru>, Alexandr Petrosian <paf@design.ru> | Authors: Konstantin Morshnev <moko@design.ru>, Alexandr Petrosian <paf@design.ru> |
| */ | */ |
| Line 56 class ArrayString : public Array<const S | Line 56 class ArrayString : public Array<const S |
| public: | public: |
| inline ArrayString(size_t initial=0) : Array(initial){ | inline ArrayString(size_t initial=0) : Array(initial){ |
| } | } |
| inline Array& operator+=(const String *src) { | inline Array& operator+=(element_type src) { |
| assert(src != NULL); | assert(src != NULL); |
| return Array::operator+=(src); | return Array::operator+=(src); |
| } | } |
| inline element_type get(size_t index) const { | |
| element_type result=Array::get(index); | |
| assert(result != NULL); | |
| return result; | |
| } | |
| }; | }; |
| #endif | #endif |
| Line 372 public: | Line 378 public: |
| void dump() const; | void dump() const; |
| Body(): body(CORD_EMPTY) INIT_HASH_CODE(0) INIT_LENGTH(0) {} | Body(): body(CORD_EMPTY) INIT_HASH_CODE(0) INIT_LENGTH(0) {} |
| Body(const char *abody): body(AS_CORD(abody)) INIT_HASH_CODE(0) INIT_LENGTH(0) {} | explicit Body(const char *abody): body(AS_CORD(abody)) INIT_HASH_CODE(0) INIT_LENGTH(0) {} |
| Body(CORD abody, uint ahash_code): body(abody) INIT_HASH_CODE(ahash_code) INIT_LENGTH(0) {} | explicit Body(CORD abody, uint ahash_code): body(abody) INIT_HASH_CODE(ahash_code) INIT_LENGTH(0) {} |
| explicit Body(C ac): body(AS_CORD(ac.str)) INIT_HASH_CODE(0) INIT_LENGTH(ac.length) {} | explicit Body(C ac): body(AS_CORD(ac.str)) INIT_HASH_CODE(0) INIT_LENGTH(ac.length) {} |
| explicit Body(CORD abody): body(abody) INIT_HASH_CODE(0) INIT_LENGTH(0) { | explicit Body(CORD abody): body(abody) INIT_HASH_CODE(0) INIT_LENGTH(0) { |
| #ifdef CORD_CAT_OPTIMIZATION | #ifdef CORD_CAT_OPTIMIZATION |
| Line 394 public: | Line 400 public: |
| #endif | #endif |
| } | } |
| static Body uitoa(size_t aindex); | |
| static Body Format(int value); | |
| void clear() { ZERO_LENGTH ZERO_HASH_CODE body=CORD_EMPTY; } | void clear() { ZERO_LENGTH ZERO_HASH_CODE body=CORD_EMPTY; } |
| Line 646 public: | Line 651 public: |
| String& mid(size_t substr_begin, size_t substr_end) const; | String& mid(size_t substr_begin, size_t substr_end) const; |
| String& mid(Charset& charset, size_t from, size_t to, size_t helper_length=0) const; | String& mid(Charset& charset, size_t from, size_t to, size_t helper_length=0) const; |
| /** | /// return position of substr in string, -1 means "not found" [const char* version] |
| ignore lang if it's L_UNSPECIFIED | size_t pos(const char* substr, size_t this_offset=0) const { return body.pos(substr, this_offset); } |
| but when specified: look for substring that lies in ONE fragment in THAT lang | size_t pos(const Body substr, size_t this_offset=0) const { return body.pos(substr, this_offset); } |
| @return position of substr in string, -1 means "not found" [const char* version] | size_t pos(const String& substr, size_t this_offset=0) const { return body.pos(substr.body, this_offset); } |
| */ | size_t pos(char c, size_t this_offset=0) const { return body.pos(c, this_offset); } |
| size_t pos(const Body substr, size_t this_offset=0, Language lang=L_UNSPECIFIED) const; | /// ignore lang if it's L_UNSPECIFIED, otherwise look for substring that lies in ONE fragment in THAT lang |
| /// String version of @see pos(const char*, int, Language) | size_t pos(const Body substr, size_t this_offset, Language lang) const; |
| size_t pos(const String& substr, size_t this_offset=0, Language lang=L_UNSPECIFIED) const; | size_t pos(const String& substr, size_t this_offset, Language lang) const; |
| size_t pos(char c, size_t this_offset=0) const { | |
| return body.pos(c, this_offset); | |
| } | |
| size_t pos(Charset& charset, const String& substr, size_t this_offset=0, Language lang=L_UNSPECIFIED) const; | size_t pos(Charset& charset, const String& substr, size_t this_offset=0, Language lang=L_UNSPECIFIED) const; |
| size_t strrpbrk(const char* chars, size_t left=0) const { | size_t strrpbrk(const char* chars, size_t left=0) const { |