ossp-pkg/uuid/uuid++.hh 1.1 -> 1.2
--- uuid++.hh 2005/08/31 14:29:56 1.1
+++ uuid++.hh 2005/08/31 20:07:29 1.2
@@ -31,43 +31,66 @@
#define __UUIDXX_HH__
/* required C API header */
+#include <stdlib.h>
#include "uuid.h"
+/* UUID object class */
class uuid {
+ public:
+ /* construction & destruction */
+ uuid (); /* standard constructor */
+ uuid (const uuid &_obj); /* copy constructor */
+ uuid (const uuid_t *_obj); /* import constructor */
+ uuid (const void *_bin); /* import constructor */
+ uuid (const char *_str); /* import constructor */
+ ~uuid (); /* destructor */
+
+ /* copying & cloning */
+ uuid &operator= (const uuid &_obj); /* copy assignment operator */
+ uuid &operator= (const uuid_t *_obj); /* import assignment operator */
+ uuid &operator= (const void *_bin); /* import assignment operator */
+ uuid &operator= (const char *_str); /* import assignment operator */
+ uuid clone (void); /* regular method */
+
+ /* content generation */
+ void load (const char *_name); /* regular method */
+ void make (unsigned int _mode, ...); /* regular method */
+
+ /* content comparison */
+ int isnil (void); /* regular method */
+ int compare (const uuid &_obj); /* regular method */
+ int operator== (const uuid &_obj); /* comparison operator */
+ int operator!= (const uuid &_obj); /* comparison operator */
+ int operator< (const uuid &_obj); /* comparison operator */
+ int operator<= (const uuid &_obj); /* comparison operator */
+ int operator> (const uuid &_obj); /* comparison operator */
+ int operator>= (const uuid &_obj); /* comparison operator */
+
+ /* content importing & exporting */
+ void import (const void *_bin); /* regular method */
+ void import (const char *_str); /* regular method */
+ void *binary (void); /* regular method */
+ char *string (void); /* regular method */
+ char *summary (void); /* regular method */
+
+ unsigned long version (void); /* regular method */
+
private:
uuid_t *ctx;
+};
+
+/* UUID exception class */
+class uuid_error_t {
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 */
+ uuid_error_t () { code(UUID_RC_OK); };
+ uuid_error_t (uuid_rc_t _code) { code(_code); };
+ ~uuid_error_t () { };
+ void code (uuid_rc_t _code) { rc = _code; };
+ uuid_rc_t code (void) { return rc; };
+ char *string (void) { return uuid_error(rc); };
+
+ private:
+ uuid_rc_t rc;
};
#endif /* __UUIDXX_HH__ */
|
|