ossp-pkg/uuid/uuid++.hh
1.1
/*
** OSSP uuid - Universally Unique Identifier
** Copyright (c) 2004-2005 Ralf S. Engelschall <rse@engelschall.com>
** Copyright (c) 2004-2005 The OSSP Project <http://www.ossp.org/>
**
** This file is part of OSSP uuid, a library for the generation
** of UUIDs which can found at http://www.ossp.org/pkg/lib/uuid/
**
** Permission to use, copy, modify, and distribute this software for
** any purpose with or without fee is hereby granted, provided that
** the above copyright notice and this permission notice appear in all
** copies.
**
** THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
** WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
** MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
** IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
** CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
** USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
** ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
** OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
** OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
** SUCH DAMAGE.
**
** uuid++.hh: library C++ API definition
*/
#ifndef __UUIDXX_HH__
#define __UUIDXX_HH__
/* required C API header */
#include "uuid.h"
class uuid {
private:
uuid_t *ctx;
public:
/* object constructors and destructor */
uuid(); /* standard constructor */
~uuid(); /* standard destructor */
uuid(const uuid &obj); /* construction: import of other C++ API object */
uuid(uuid_t *obj); /* construction: import of other C API object */
uuid(const unsigned char *str); /* construction: import of binary representation */
uuid(const char *str); /* construction: import of string representation */
/* import methods */
uuid &operator= (const uuid &rhs); /* assignment: import of other C++ API object */
uuid &operator= (const uuid_t *rhs); /* assignment: import of other C API object */
uuid &operator= (const unsigned char *rhs); /* assignment: import of binary representation */
uuid &operator= (const char *rhs); /* assignment: import of string representation */
/* generation methods */
void load (const char *name); /* generation: loading existing UUID by name */
void make (unsigned int mode, ...); /* generation: making new UUID one from scratch */
/* comparison methods */
int isnil (void); /* comparison: is-Nil-UUID */
int operator== (const uuid &rhs); /* comparison: equality */
int operator!= (const uuid &rhs); /* comparison: inequality */
int operator< (const uuid &rhs); /* comparison: lower-than */
int operator<= (const uuid &rhs); /* comparison: lower-than-or-equal */
int operator> (const uuid &rhs); /* comparison: greater-than */
int operator>= (const uuid &rhs); /* comparison: greater-than-or-equal */
/* export methods */
uuid_t *object (void); /* export: object representation */
unsigned char *binary (void); /* export: binary representation */
char *string (void); /* export: string representation */
};
#endif /* __UUIDXX_HH__ */