00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00018 #ifndef LIBCWD_CLASS_DEBUG_STRING_H
00019 #define LIBCWD_CLASS_DEBUG_STRING_H
00020
00021 #ifndef LIBCWD_CONFIG_H
00022 #include <libcwd/config.h>
00023 #endif
00024 #ifndef LIBCW_CSTDDEF
00025 #define LIBCW_CSTDDEF
00026 #include <cstddef>
00027 #endif
00028 #ifndef LIBCW_STRING
00029 #define LIBCW_STRING
00030 #include <string>
00031 #endif
00032
00033 namespace libcwd {
00034
00035
00036
00037
00038 struct debug_string_stack_element_ct;
00039 struct debug_tsd_st;
00040 class debug_ct;
00041
00048 class debug_string_ct {
00049 friend class debug_ct;
00050 friend struct debug_tsd_st;
00051 private:
00052 char* M_str;
00053 size_t M_size;
00054 size_t M_capacity;
00055 size_t M_default_capacity;
00056 static size_t const min_capacity_c = 64;
00057
00058 size_t calculate_capacity(size_t);
00059 void internal_assign(char const* s, size_t l);
00060 void internal_append(char const* s, size_t l);
00061 void internal_prepend(char const* s, size_t l);
00062 void internal_swallow(debug_string_ct const&);
00063
00064 private:
00065 void NS_internal_init(char const* s, size_t l);
00066 void deinitialize(void);
00067 debug_string_ct(void) { }
00068 ~debug_string_ct(void);
00069
00070 private:
00071 friend struct debug_string_stack_element_ct;
00072 debug_string_ct(debug_string_ct const& ds);
00073
00074 public:
00075 size_t size(void) const;
00076 size_t capacity(void) const;
00077 void reserve(size_t);
00078 char const* c_str(void) const;
00079 void assign(char const* str, size_t len);
00080 void append(char const* str, size_t len);
00081 void prepend(char const* str, size_t len);
00082 void assign(std::string const& str);
00083 void append(std::string const& str);
00084 void prepend(std::string const& str);
00085 };
00086
00087
00088 struct debug_string_stack_element_ct {
00089 public:
00090 debug_string_stack_element_ct* next;
00091 debug_string_ct debug_string;
00092 debug_string_stack_element_ct(debug_string_ct const& ds);
00093 };
00094
00095 }
00096
00097 #endif // LIBCWD_CLASS_DEBUG_STRING_H