|
|
| version 1.136, 2002/04/19 08:28:35 | version 1.142, 2002/08/08 08:43:38 |
|---|---|
| Line 3 | Line 3 |
| Copyright (c) 2001, 2002 ArtLebedev Group (http://www.artlebedev.com) | Copyright (c) 2001, 2002 ArtLebedev Group (http://www.artlebedev.com) |
| Author: Alexandr Petrosian <paf@design.ru> (http://paf.design.ru) | Author: Alexandr Petrosian <paf@design.ru> (http://paf.design.ru) |
| $Id$ | |
| */ | */ |
| #ifndef PA_STRING_H | #ifndef PA_STRING_H |
| #define PA_STRING_H | #define PA_STRING_H |
| static const char* IDENT_STRING_H="$Date$"; | |
| #include "pa_pool.h" | #include "pa_pool.h" |
| #include "pa_types.h" | #include "pa_types.h" |
| Line 106 public: | Line 106 public: |
| public: | public: |
| static String& OnPool(Pool& apool, const char *local_src=0, size_t src_size=0, bool tainted=false); | |
| String(Pool& apool, const char *src=0, size_t src_size=0, bool tainted=false); | String(Pool& apool, const char *src=0, size_t src_size=0, bool tainted=false); |
| String(const String& src); | String(const String& src); |
| bool is_empty() const { return append_here==head.chunk.rows; } | bool is_empty() const { return append_here==head.chunk.rows; } |
| Line 153 public: | Line 154 public: |
| */ | */ |
| int cmp(int& partial, const char* src_ptr, size_t src_size=0, | int cmp(int& partial, const char* src_ptr, size_t src_size=0, |
| size_t this_offset=0, Untaint_lang lang=UL_UNSPECIFIED) const; | size_t this_offset=0, Untaint_lang lang=UL_UNSPECIFIED) const; |
| /// this starts with src | |
| bool starts_with(const char* src_ptr, size_t src_size=0) const { | |
| int p; cmp(p, src_ptr, src_size); | |
| return p==0 || p==2; | |
| } | |
| bool operator == (const char* src_ptr) const { | bool operator == (const char* src_ptr) const { |
| size_t src_size=src_ptr?strlen(src_ptr):0; | size_t src_size=src_ptr?strlen(src_ptr):0; |
| if(size() != src_size) | if(size() != src_size) |
| Line 172 public: | Line 178 public: |
| /// simple hash code of string. used by Hash | /// simple hash code of string. used by Hash |
| uint hash_code() const; | uint hash_code() const; |
| /// extracts first char of a string | /// extracts first char of a string, if any |
| char first_char() const; | char first_char() const { |
| return is_empty()?*head.chunk.rows[0].item.ptr:0; | |
| } | |
| /// extracts [start, finish) piece of string | /// extracts [start, finish) piece of string |
| String& mid(size_t start, size_t finish) const; | String& mid(size_t start, size_t finish) const; |
| Line 222 public: | Line 230 public: |
| double as_double() const; | double as_double() const; |
| int as_int() const; | int as_int() const; |
| String& join_chains(Pool& pool, char** cstr) const; | |
| #ifndef NO_STRING_ORIGIN | #ifndef NO_STRING_ORIGIN |
| /// origin of string. calculated by first row | /// origin of string. calculated by first row |
| const Origin& origin() const; | const Origin& origin() const; |