32 #ifndef SECU_STRING_HPP
33 #define SECU_STRING_HPP
35 #include "../my_config.h"
86 bool operator != (
const std::string & ref)
const {
return ! (*
this == ref); };
87 bool operator != (
const secu_string & ref)
const {
return ! (*
this == ref); };
88 bool operator == (
const std::string &ref)
const {
return compare_with(ref.c_str(),(U_I)(ref.size())); };
89 bool operator == (
const secu_string &ref)
const {
return compare_with(ref.mem, *ref.string_size); };
120 void clear() { clean_and_destroy(); init(0); };
127 void clear_and_not_resize() { string_size = 0; };
134 const char*
c_str()
const {
return mem == NULL ?
throw SRC_BUG : mem; };
140 U_I
size()
const {
return *string_size; };
142 #ifdef LIBDAR_SPECIAL_ALLOC
152 bool compare_with(
const char *ptr, U_I
size)
const;
153 void clean_and_destroy();
secu_string(const char *ptr, U_I size)
constructor
void clear_and_resize(U_I size)
clear and resize the string to the defined allocated size
are defined here basic integer types that tend to be portable
void append(const char *ptr, U_I size)
append some data to the string
secu_string(const secu_string &ref)
the copy constructor
static bool is_string_secured()
to know if secure memory is available
secu_string & operator=(const secu_string &ref)
the assignment operator
~secu_string()
the destructor (set memory to zero before releasing it)
re-definition of new and delete class operatorthis is a set of macro that makes the new and delete op...
void reduce_string_size_to(U_I pos)
void clear()
clear the string (ans set its allocated string to zero)
U_I size() const
get the size of the string
void read(int fd, U_I size)
fill the object with data
secu_string(U_I size=0)
constructor
const char * c_str() const
get access to the secure string
libdar namespace encapsulate all libdar symbols