From 1b1904f3e1578ffd60e09edfded113d4c8f50c41 Mon Sep 17 00:00:00 2001 From: Jedidiah Barber Date: Thu, 24 Oct 2024 21:50:46 +1300 Subject: Completed Fl_Preferences API binding --- doc/fl_preferences.html | 290 ++++++++++++++++++++++++++++++++++++------------ 1 file changed, 217 insertions(+), 73 deletions(-) (limited to 'doc/fl_preferences.html') diff --git a/doc/fl_preferences.html b/doc/fl_preferences.html index 136ebca..37f99be 100644 --- a/doc/fl_preferences.html +++ b/doc/fl_preferences.html @@ -34,12 +34,22 @@ Fl_Preferences - Preferences + Database   - Preferences_Reference + Database_Reference + + + +   + Pref_Group + + + +   + Pref_Group_Reference @@ -47,6 +57,11 @@   + + Name +   + + Root Scope @@ -61,6 +76,42 @@ + + + + + + + + +
Errors
 Preference_Error
+ + + + + + + + + + + + + + + + +
Static Functions and Procedures
+static const char * newUUID();
+
+function New_UUID
+    return String;
+
+static char remove(ID id_);
+
 
+ + + @@ -68,17 +119,23 @@ - + @@ -87,7 +144,16 @@ function From_Filesystem Fl_Preferences(Fl_Preferences &parent, const char *group); Fl_Preferences(Fl_Preferences *parent, const char *group); - + @@ -95,14 +161,23 @@ Fl_Preferences(Fl_Preferences *parent, const char *group); Fl_Preferences(Fl_Preferences &parent, int groupIndex); Fl_Preferences(Fl_Preferences *parent, int groupIndex); - + - + @@ -111,7 +186,9 @@ char clear(); @@ -121,7 +198,8 @@ char deleteAllEntries(); @@ -129,7 +207,11 @@ procedure Delete_All_Entries - + @@ -138,8 +220,9 @@ char deleteEntry(const char *entry); @@ -147,7 +230,12 @@ procedure Delete_Entry - + @@ -156,7 +244,7 @@ int entries(); @@ -166,10 +254,11 @@ function Number_Of_Entries const char * entry(int index); @@ -178,8 +267,8 @@ function Get_Key char entryExists(const char *key); @@ -191,7 +280,7 @@ void flush(); @@ -201,12 +290,12 @@ char get(const char *entry, int &value, int defaultValue); + - + - + - - + - + - + - + - + - + - + @@ -343,9 +489,10 @@ char set(const char *entry, int value); @@ -355,9 +502,10 @@ char set(const char *entry, float value); @@ -367,10 +515,11 @@ char set(const char *entry, float value, int precision); @@ -380,9 +529,10 @@ char set(const char *entry, double value); @@ -392,10 +542,11 @@ char set(const char *entry, double value, int precision); @@ -405,9 +556,10 @@ char set(const char *entry, const char *value); @@ -415,7 +567,13 @@ procedure Set - + @@ -423,27 +581,13 @@ char set(const char *entry, const void *value, int size); int size(const char *entry); - - - - - - - - - -
Functions and Procedures
 Fl_Preferences(Root root, const char *vendor, const char *application);
 
TBA
+function From_Scope
+       (Extent              : in Scope;
+        Vendor, Application : in String)
+    return Database;
+
-Fl_Preferences(const char *path, const char *vendor, const char *application);
+Fl_Preferences(const char *path, const char *vendor,
+    const char *application);
 
 function From_Filesystem
-       (Path, Vendor, Application : in String)
-    return Preferences;
+       (Directory, Vendor, Application : in String)
+    return Database;
 
TBA
+function By_Name
+       (From : in Pref_Group;
+        Name : in String)
+    return Pref_Group'Class;
+
+function In_Memory
+       (Name : in String)
+    return Pref_Group;
+
TBA
+function By_Index
+       (From  : in Pref_Group;
+        Index : in Positive)
+    return Pref_Group'Class;
+
 Fl_Preferences(const Fl_Preferences &);
 
TBA
+function Root
+       (From : in Database)
+    return Pref_Group'Class;
+
 procedure Clear
-       (This : in out Preferences);
+       (This : in out Pref_Group)
+with Post => This.Number_Of_Entries = 0 and
+        This.Number_Of_Groups = 0;
 
 procedure Delete_All_Entries
-       (This : in out Preferences);
+       (This : in out Pref_Group)
+with Post => This.Number_Of_Entries = 0;
 
 char deleteAllGroups();
 
TBA
+procedure Delete_All_Groups
+       (This : in out Pref_Group)
+with Post => This.Number_Of_Groups = 0;
+
 procedure Delete_Entry
-       (This : in out Preferences;
-        Key  : in     String);
+       (This : in out Pref_Group;
+        Key  : in     String)
+with Post => This.Key_Exists (Key) = False;
 
 char deleteGroup(const char *group);
 
TBA
+procedure Delete_Group
+       (This : in out Pref_Group;
+        Name : in     String)
+with Post => This.Group_Exists (Name) = False;
+
 function Number_Of_Entries
-       (This : in Preferences)
+       (This : in Pref_Group)
     return Natural;
 
-function Get_Key
-       (This  : in Preferences;
-        Index : in Natural)
-    return String;
+function Entry_Key
+       (This  : in Pref_Group;
+        Index : in Positive)
+    return String
+with Pre => Index in 1 .. This.Number_Of_Entries;
 
-function Entry_Exists
-       (This : in Preferences;
+function Key_Exists
+       (This : in Pref_Group;
         Key  : in String)
     return Boolean;
 
 procedure Flush
-       (This : in Preferences);
+       (This : in Database);
 
 function Get
-       (This : in Preferences;
+       (This : in Pref_Group;
         Key  : in String)
     return Integer;
 
 function Get
-       (This    : in Preferences;
+       (This    : in Pref_Group;
         Key     : in String;
         Default : in Integer)
     return Integer;
@@ -219,12 +308,12 @@ char get(const char *entry, float &value, float defaultValue);
 
 function Get
-       (This : in Preferences;
+       (This : in Pref_Group;
         Key  : in String)
     return Float;
 
 function Get
-       (This    : in Preferences;
+       (This    : in Pref_Group;
         Key     : in String;
         Default : in Float)
     return Float;
@@ -237,12 +326,12 @@ char get(const char *entry, double &value, double defaultValue);
 
 function Get
-       (This : in Preferences;
+       (This : in Pref_Group;
         Key  : in String)
     return Long_Float;
 
 function Get
-       (This    : in Preferences;
+       (This    : in Pref_Group;
         Key     : in String;
         Default : in Long_Float)
     return Long_Float;
@@ -255,12 +344,12 @@ char get(const char *entry, char *&value, const char *defaultValue);
 
 function Get
-       (This : in Preferences;
+       (This : in Pref_Group;
         Key  : in String)
     return String;
 
 function Get
-       (This    : in Preferences;
+       (This    : in Pref_Group;
         Key     : in String;
         Default : in String)
     return String;
@@ -269,72 +358,129 @@ function Get
 
   
-char get(const char *entry, char *value, const char *defaultValue, int maxSize);
+char get(const char *entry, char *value, const char *defaultValue,
+    int maxSize);
+
+function Get
+       (This       : in Pref_Group;
+        Key        : in String;
+        Default    : in String;
+        Max_Length : in Natural)
+    return String
+with Post => Get'Result'Length <= Max_Length;
 
TBA
-char get(const char *entry, void *&value, const void *defaultValue, int defaultSize);
+char get(const char *entry, void *&value, const void *defaultValue,
+    int defaultSize);
+
+function Get
+       (This : in Pref_Group;
+        Key  : in String)
+    return Binary_Data;
+
+function Get
+       (This    : in Pref_Group;
+        Key     : in String;
+        Default : in Binary_Data)
+    return Binary_Data;
 
TBA
-char get(const char *entry, void *value, const void *defaultValue, int defaultSize, int maxSize);
+char get(const char *entry, void *value, const void *defaultValue,
+    int defaultSize, int maxSize);
+
+function Get
+       (This       : in Pref_Group;
+        Key        : in String;
+        Default    : in Binary_Data;
+        Max_Length : in Natural)
+    return Binary_Data
+with Post => Get'Result'Length <= Max_Length;
 
TBA
 char getUserdataPath(char *path, int pathlen);
 
TBA
+function Userdata_Path
+       (This : in Database)
+    return String;
+
 const char * group(int num_group);
 
TBA
+function Group_Name
+       (This  : in Pref_Group;
+        Index : in Positive)
+    return String
+with Pre => Index in 1 .. This.Number_Of_Groups;
+
 char groupExists(const char *key);
 
TBA
+function Group_Exists
+       (This : in Pref_Group;
+        Name : in String)
+    return Boolean;
+
 int groups();
 
TBA
+function Number_Of_Groups
+       (This : in Pref_Group)
+    return Natural;
+
 ID id();
 
TBA 
 const char * name();
 
TBA
+function At_Name
+       (This : in Pref_Group)
+    return String;
+
 const char * path();
 
TBA
+function At_Path
+       (This : in Pref_Group)
+    return String;
+
 procedure Set
-       (This  : in out Preferences;
+       (This  : in out Pref_Group;
         Key   : in     String;
-        Value : in     Integer);
+        Value : in     Integer)
+with Post => This.Key_Exists (Key);
 
 procedure Set
-       (This  : in out Preferences;
+       (This  : in out Pref_Group;
         Key   : in     String;
-        Value : in     Float);
+        Value : in     Float)
+with Post => This.Key_Exists (Key);
 
 procedure Set
-       (This      : in out Preferences;
+       (This      : in out Pref_Group;
         Key       : in     String;
         Value     : in     Float;
-        Precision : in     Natural);
+        Precision : in     Natural)
+with Post => This.Key_Exists (Key);
 
 procedure Set
-       (This  : in out Preferences;
+       (This  : in out Pref_Group;
         Key   : in     String;
-        Value : in     Long_Float);
+        Value : in     Long_Float)
+with Post => This.Key_Exists (Key);
 
 procedure Set
-       (This      : in out Preferences;
+       (This      : in out Pref_Group;
         Key       : in     String;
         Value     : in     Long_Float;
-        Precision : in     Natural);
+        Precision : in     Natural)
+with Post => This.Key_Exists (Key);
 
 procedure Set
-       (This  : in out Preferences;
+       (This  : in out Pref_Group;
         Key   : in     String;
-        Value : in     String);
+        Value : in     String)
+with Post => This.Key_Exists (Key);
 
 char set(const char *entry, const void *value, int size);
 
TBA
+procedure Set
+       (This  : in out Pref_Group;
+        Key   : in     String;
+        Value : in     Binary_Data)
+with Post => This.Key_Exists (Key);
+
-function Entry_Size
-       (This : in Preferences;
+function Value_Size
+       (This : in Pref_Group;
         Key  : in String)
     return Natural;
 
-static const char * newUUID();
-
TBA
-static char remove(ID id_);
-
TBA
-- cgit