Convert from NULL macro to nullptr.
[shibboleth/cpp-xmltooling.git] / xmltooling / util / StorageService.h
index 6dd8d8e..7d5440c 100644 (file)
@@ -1,5 +1,5 @@
 /*
- *  Copyright 2001-2007 Internet2
+ *  Copyright 2001-2010 Internet2
  * 
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
 /**
  * @file xmltooling/util/StorageService.h
  * 
- * Generic data storage interface
+ * Generic data storage interface.
  */
 
 #if !defined(__xmltooling_storage_h__) && !defined(XMLTOOLING_LITE)
 #define __xmltooling_storage_h__
 
-#include <xmltooling/XMLObject.h>
+#include <xmltooling/base.h>
 
 #include <ctime>
 
@@ -43,7 +43,7 @@ namespace xmltooling {
     {
         MAKE_NONCOPYABLE(StorageService);
     public:
-        virtual ~StorageService() {}
+        virtual ~StorageService();
         
         /**
          * Creates a new "short" record in the storage service.
@@ -52,10 +52,11 @@ namespace xmltooling {
          * @param key           null-terminated unique key of up to 255 bytes
          * @param value         null-terminated value of up to 255 bytes to store
          * @param expiration    an expiration timestamp, after which the record can be purged
+         * @return  true iff record was inserted, false iff a duplicate was found
          * 
-         * @throws IOException  raised if errors occur in the insertion process 
+         * @throws IOException  raised if fatal errors occur in the insertion process 
          */
-        virtual void createString(const char* context, const char* key, const char* value, time_t expiration)=0;
+        virtual bool createString(const char* context, const char* key, const char* value, time_t expiration)=0;
         
         /**
          * Returns an existing "short" record from the storage service.
@@ -72,7 +73,7 @@ namespace xmltooling {
          * @throws IOException  raised if errors occur in the read process 
          */
         virtual int readString(
-            const char* context, const char* key, std::string* pvalue=NULL, time_t* pexpiration=NULL, int version=0
+            const char* context, const char* key, std::string* pvalue=nullptr, time_t* pexpiration=nullptr, int version=0
             )=0;
 
         /**
@@ -80,7 +81,7 @@ namespace xmltooling {
          * 
          * @param context       a storage context label
          * @param key           null-terminated unique key of up to 255 bytes
-         * @param value         null-terminated value of up to 255 bytes to store, or NULL to leave alone
+         * @param value         null-terminated value of up to 255 bytes to store, or nullptr to leave alone
          * @param expiration    a new expiration timestamp, or 0 to leave alone
          * @param version       if > 0, only update if the current version matches this value
          * @return the version of the record after update, 0 if no record exists, or -1 if the version
@@ -89,7 +90,7 @@ namespace xmltooling {
          * @throws IOException  raised if errors occur in the update process 
          */
         virtual int updateString(
-            const char* context, const char* key, const char* value=NULL, time_t expiration=0, int version=0
+            const char* context, const char* key, const char* value=nullptr, time_t expiration=0, int version=0
             )=0;
         
         /**
@@ -110,10 +111,11 @@ namespace xmltooling {
          * @param key           null-terminated unique key of up to 255 bytes
          * @param value         null-terminated value of arbitrary length
          * @param expiration    an expiration timestamp, after which the record can be purged
+         * @return  true iff record was inserted, false iff a duplicate was found
          * 
          * @throws IOException  raised if errors occur in the insertion process 
          */
-        virtual void createText(const char* context, const char* key, const char* value, time_t expiration)=0;
+        virtual bool createText(const char* context, const char* key, const char* value, time_t expiration)=0;
         
         /**
          * Returns an existing "long" record from the storage service.
@@ -130,7 +132,7 @@ namespace xmltooling {
          * @throws IOException  raised if errors occur in the read process 
          */
         virtual int readText(
-            const char* context, const char* key, std::string* pvalue=NULL, time_t* pexpiration=NULL, int version=0
+            const char* context, const char* key, std::string* pvalue=nullptr, time_t* pexpiration=nullptr, int version=0
             )=0;
 
         /**
@@ -138,7 +140,7 @@ namespace xmltooling {
          * 
          * @param context       a storage context label
          * @param key           null-terminated unique key of up to 255 bytes
-         * @param value         null-terminated value of arbitrary length to store, or NULL to leave alone
+         * @param value         null-terminated value of arbitrary length to store, or nullptr to leave alone
          * @param expiration    a new expiration timestamp, or 0 to leave alone
          * @param version       if > 0, only update if the current version matches this value
          * @return the version of the record after update, 0 if no record exists, or -1 if the version
@@ -147,7 +149,7 @@ namespace xmltooling {
          * @throws IOException  raised if errors occur in the update process 
          */
         virtual int updateText(
-            const char* context, const char* key, const char* value=NULL, time_t expiration=0, int version=0
+            const char* context, const char* key, const char* value=nullptr, time_t expiration=0, int version=0
             )=0;
         
         /**
@@ -187,7 +189,7 @@ namespace xmltooling {
         virtual void deleteContext(const char* context)=0;
 
     protected:
-        StorageService() {}
+        StorageService();
     };
 
     /**