ucommon
7.0.0
About: GNU uCommon C++ is a portable and optimized class framework for writing C++ applications that need to use threads and support concurrent synchronization, and that use sockets, XML parsing, object serialization, thread-optimized string and data structure classes, etc.. Fossies Dox: ucommon-7.0.0.tar.gz ("inofficial" and yet experimental doxygen-generated source code documentation) 
|
Go to the documentation of this file. 28 #ifndef _UCOMMON_TYPEREF_H_ 29 #define _UCOMMON_TYPEREF_H_ 31 #ifndef _UCOMMON_CPR_H_ 35 #ifndef _UCOMMON_ATOMIC_H_ 39 #ifndef _UCOMMON_PROTOCOLS_H_ 43 #ifndef _UCOMMON_GENERICS_H_ 47 #ifndef _UCOMMON_OBJECT_H_ 51 #ifndef _UCOMMON_THREAD_H_ 119 virtual void dealloc(
void);
126 inline bool is()
const {
127 return (count.
get() > 0);
135 return ((
unsigned)count.
get());
148 void operator delete(
void *address);
226 size_t size(
void)
const;
232 unsigned copies()
const;
238 inline operator bool()
const {
263 bool is_released(
void);
277 virtual unsigned purge();
279 virtual caddr_t allocate(
size_t size);
325 template<
typename T, TypeRelease& R = auto_release>
362 value *v = polystatic_cast<value *>(
ref);
367 value *v = polystatic_cast<value*>(
ref);
369 return *(&(v->
data));
373 value *v = polystatic_cast<value*>(
ref);
380 inline operator const T&()
const {
381 value *v = polystatic_cast<value*>(
ref);
383 return *(&(v->
data));
397 value *v1 = polystatic_cast<value*>(
ref);
398 value *v2 = polystatic_cast<value*>(ptr.
ref);
405 value *v = polystatic_cast<value *>(
ref);
408 return v->
data == obj;
412 return !(*
this == ptr);
416 return !(*
this == obj);
467 inline operator char *() {
488 const char *operator*()
const;
490 inline operator const char *()
const {
496 bool operator==(
const typeref& ptr)
const;
498 bool operator==(
const char *obj)
const;
500 bool operator==(value *chars)
const;
503 return !(*
this == ptr);
507 return !(*
this == chars);
511 return !(*
this == obj);
514 bool operator<(
const typeref& ptr)
const;
517 return (ptr < *
this);
521 return !(*
this > ptr);
525 return !(*
this < ptr);
532 typeref& operator=(value *chars);
538 const char *operator()(ssize_t offset)
const;
546 void assign(value *chars);
548 static void expand(value **handle,
size_t size);
552 static void destroy(value *bytes);
559 class value :
public Counted
582 inline operator uint8_t*() {
603 const uint8_t *operator*()
const;
605 inline operator const uint8_t *()
const {
611 typeref& operator=(value *bytes);
613 bool operator==(
const typeref& ptr)
const;
615 bool operator==(value *bytes)
const;
618 return !(*
this == ptr);
622 return !(*
this == bytes);
629 size_t set(
bool bit,
size_t offset,
size_t bits = 1);
637 bool get(
size_t offset);
639 size_t count(
size_t offset,
size_t bits = 1);
641 void assign(value *bytes);
649 static void destroy(value *bytes);
655 template<TypeRelease& R>
683 template<TypeRelease& R>
693 inline byteref(
bool mode,
size_t bits) :
typeref<const uint8_t *>(mode, bits, &R) {}
701 inline size_t hex(
const char *
str,
bool ws =
false) {
705 inline size_t b64(
const char *
str,
bool ws =
false) {
typeref(const typeref_guard &global)
typeref & operator=(const typeref_guard &ptr)
bool operator!=(const typeref &ptr) const
typeref(const typeref_guard &global)
bool operator!=(const char *obj) const
__EXPORT TypeRelease secure_release
void assign(const typeref_guard &ref)
std::string & operator+(std::string &target, String &source)
typeref< Type::Chars > stringref_t
bool operator==(const typeref &ptr) const
size_t hex(const char *str, bool ws=false)
stringref(const stringref ©)
const typedef char * Chars
void set(Counted *object)
bool operator!=(const typeref &ptr) const
static void result(const char *path, int code)
bool operator<=(const typeref &ptr) const
void set(const char *str)
typeref_guard(const TypeRef &pointer)
typeref & operator=(T &object)
typeref(const typeref_guard &global)
const typedef uint8_t * Bytes
bool operator>=(const typeref &ptr) const
static void put(TypeRef &target, Counted *object)
TypeRelease * getRelease() const
static byteref promote(typeref< const uint8_t * > &str)
static caddr_t mem(caddr_t address)
typeref< Type::Bools > boolref_t
typeref< Type::Bytes > byteref_t
const T * operator->() const
const T & operator*() const
bool operator!=(const typeref &ptr) const
typeref(const typeref ©)
typeref_guard & operator=(const TypeRef &pointer)
typeref< Type::Chars >::value * charvalues_t
typeref< Type::Bytes >::value * bytevalues_t
bool operator!=(value *bytes) const
static stringref promote(typeref< const char * > &str)
stringref(Counted *object)
bool operator>(const typeref &ptr) const
const typedef uint8_t * Bools
size_t size(TypeRef::Counted *obj)
static value * create(size_t size)
void set(T &object, TypeRelease *pool=&R)
String str(Socket &so, size_t size)
byteref(bool mode, size_t bits)
bool operator!=(value *chars) const
byteref(uint8_t *str, size_t size)
static value * create(size_t size)
stringref(const char *str)
typeref(const T &object, TypeRelease *ar=&R)
typeref< T > typeref_cast(T x)
const T * operator()() const
bool operator!=(const T &obj) const
size_t b64(const char *str, bool ws=false)
value(caddr_t mem, const T &object, TypeRelease *ar=&R)
bool operator==(const T &obj) const
typeref_guard(const typeref_guard ©)
void set(const uint8_t *str, size_t size)
typeref & operator=(const typeref &ptr)
TypeRelease(TypeRelease *target)
TypeRelease * autorelease
__EXPORT TypeRelease release_later
const struct sockaddr * addr(Socket::address &address)