1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77
|
/****************************************************************************
#
# VSTRING Library
#
# Copyright (c) 1996-2023 Vladi Belperchinov-Shabanski "Cade"
# http://cade.noxrun.com/ <cade@noxrun.com> <cade@bis.bg> <cade@cpan.org>
#
# Distributed under the GPL license, you should receive copy of GPLv2!
#
# SEE 'README', 'LICENSE' OR 'COPYING' FILE FOR LICENSE AND OTHER DETAILS!
#
# VSTRING library provides wide set of string manipulation features
# including dynamic string object that can be freely exchanged with
# standard char* (or wchar_t*) type, so there is no need to change
# function calls nor the implementation when you change from
# char* to VString (and from wchar_t* to WString).
#
***************************************************************************/
#ifndef _VREF_H_
#define _VREF_H_
#include <stdio.h>
#include <stddef.h>
#include <stdlib.h>
#include <stdarg.h>
#include <string.h>
#include <time.h>
#include <ctype.h>
#include <assert.h>
#ifndef ASSERT
#define ASSERT assert
#endif
/***************************************************************************
**
** VREF
**
****************************************************************************/
class VRef
{
int _ref;
public:
VRef() { _ref = 1; } // creator get first reference
virtual ~VRef() { ASSERT( _ref == 0 ); }
void ref() { _ref++; }
void unref() { ASSERT( _ref > 0 ); _ref--; if ( _ref < 1 ) delete this; }
int refs() { return _ref; }
};
/****************************************************************************
**
** aux functions
**
****************************************************************************/
void *vs_memcpy( char *dest, const char *src, size_t n );
void *vs_memmove( char *dest, const char *src, size_t n );
void *vs_memcpy( wchar_t *dest, const wchar_t *src, size_t n );
void *vs_memmove( wchar_t *dest, const wchar_t *src, size_t n );
#endif /* TOP */
/***************************************************************************
**
** EOF
**
****************************************************************************/
|