Browse Source

cmPrefs.c/h Renamed 'Scalar' func's., Fixed bug in cmPrefsCreateXXX()

master
kevin 11 years ago
parent
commit
67f462a501
2 changed files with 118 additions and 47 deletions
  1. 85
    30
      cmPrefs.c
  2. 33
    17
      cmPrefs.h

+ 85
- 30
cmPrefs.c View File

290
       goto errLabel;
290
       goto errLabel;
291
     }
291
     }
292
 
292
 
293
-    if( cmJsonCreateObject( p->jsH, NULL ) != kOkJsRC )
293
+    if( cmJsonCreateObject( p->jsH, NULL ) == NULL )
294
     {
294
     {
295
       rc = cmErrMsg(&p->err,kJsonFailPrRC,"The JSON root object could not be created.");
295
       rc = cmErrMsg(&p->err,kJsonFailPrRC,"The JSON root object could not be created.");
296
       goto errLabel;
296
       goto errLabel;
335
 bool cmPrefsIsValid( cmPrH_t h )
335
 bool cmPrefsIsValid( cmPrH_t h )
336
 { return h.h != NULL; }
336
 { return h.h != NULL; }
337
 
337
 
338
+const cmChar_t* cmPrefsFileName( cmPrH_t h )
339
+{
340
+  cmPr_t* p = _cmPrefsHandleToPtr(h);
341
+  return p->fn;
342
+}
343
+
338
 cmPrRC_t cmPrefsRC( cmPrH_t h)
344
 cmPrRC_t cmPrefsRC( cmPrH_t h)
339
 { return cmErrLastRC(&_cmPrefsHandleToPtr(h)->err); }
345
 { return cmErrLastRC(&_cmPrefsHandleToPtr(h)->err); }
340
 
346
 
665
 }
671
 }
666
 
672
 
667
 
673
 
668
-cmPrRC_t        cmPrefsScalarBool(   cmPrH_t h, const cmChar_t* pathStr, bool*            retValPtr )
674
+cmPrRC_t        cmPrefsBoolRc(   cmPrH_t h, const cmChar_t* pathStr, bool*            retValPtr )
669
 {
675
 {
670
   unsigned id;
676
   unsigned id;
671
   if((id = cmPrefsId(h,pathStr,true)) == cmInvalidId )
677
   if((id = cmPrefsId(h,pathStr,true)) == cmInvalidId )
675
   return cmPrefsGetBool(h,id,retValPtr,&n); 
681
   return cmPrefsGetBool(h,id,retValPtr,&n); 
676
 }
682
 }
677
 
683
 
678
-cmPrRC_t        cmPrefsScalarUInt(   cmPrH_t h, const cmChar_t* pathStr, unsigned*        retValPtr )
684
+cmPrRC_t        cmPrefsUIntRc(   cmPrH_t h, const cmChar_t* pathStr, unsigned*        retValPtr )
679
 {
685
 {
680
   unsigned id;
686
   unsigned id;
681
   unsigned n = 1;
687
   unsigned n = 1;
691
   return rc;
697
   return rc;
692
 }
698
 }
693
 
699
 
694
-cmPrRC_t        cmPrefsScalarInt(    cmPrH_t h, const cmChar_t* pathStr, int*             retValPtr )
700
+cmPrRC_t        cmPrefsIntRc(    cmPrH_t h, const cmChar_t* pathStr, int*             retValPtr )
695
 {
701
 {
696
   unsigned id;
702
   unsigned id;
697
   if((id = cmPrefsId(h,pathStr,true)) == cmInvalidId )
703
   if((id = cmPrefsId(h,pathStr,true)) == cmInvalidId )
701
   return cmPrefsGetInt(h,id,retValPtr,&n); 
707
   return cmPrefsGetInt(h,id,retValPtr,&n); 
702
 }
708
 }
703
 
709
 
704
-cmPrRC_t        cmPrefsScalarFloat(  cmPrH_t h, const cmChar_t* pathStr, float*           retValPtr )
710
+cmPrRC_t        cmPrefsFloatRc(  cmPrH_t h, const cmChar_t* pathStr, float*           retValPtr )
705
 {
711
 {
706
   unsigned id;
712
   unsigned id;
707
   unsigned n = 1;
713
   unsigned n = 1;
717
   return rc;
723
   return rc;
718
 }
724
 }
719
 
725
 
720
-cmPrRC_t        cmPrefsScalarReal(   cmPrH_t h, const cmChar_t* pathStr, double*          retValPtr )
726
+cmPrRC_t        cmPrefsRealRc(   cmPrH_t h, const cmChar_t* pathStr, double*          retValPtr )
721
 {
727
 {
722
   unsigned id;
728
   unsigned id;
723
   if((id = cmPrefsId(h,pathStr,true)) == cmInvalidId )
729
   if((id = cmPrefsId(h,pathStr,true)) == cmInvalidId )
727
   return cmPrefsGetReal(h,id,retValPtr,&n); 
733
   return cmPrefsGetReal(h,id,retValPtr,&n); 
728
 }
734
 }
729
 
735
 
730
-cmPrRC_t        cmPrefsScalarString( cmPrH_t h, const cmChar_t* pathStr, const cmChar_t** retValPtr ) 
736
+cmPrRC_t        cmPrefsStringRc( cmPrH_t h, const cmChar_t* pathStr, const cmChar_t** retValPtr ) 
731
 {
737
 {
732
   unsigned id;
738
   unsigned id;
733
   if((id = cmPrefsId(h,pathStr,true)) == cmInvalidId )
739
   if((id = cmPrefsId(h,pathStr,true)) == cmInvalidId )
996
   return _cmPrefsSetValues2( p, np, bvp, ivp, rvp, svp, eleCntPtr );
1002
   return _cmPrefsSetValues2( p, np, bvp, ivp, rvp, svp, eleCntPtr );
997
 }
1003
 }
998
 
1004
 
999
-cmPrRC_t cmPrefsSetBool(   cmPrH_t h, unsigned id, const bool*   vp, const unsigned* eleCntPtr )
1005
+cmPrRC_t cmPrefsSetBoolArray(   cmPrH_t h, unsigned id, const bool*   vp, const unsigned* eleCntPtr )
1000
 { return _cmPrefsSetValues(h, id, vp, NULL, NULL, NULL, eleCntPtr ); }
1006
 { return _cmPrefsSetValues(h, id, vp, NULL, NULL, NULL, eleCntPtr ); }
1001
 
1007
 
1002
-cmPrRC_t cmPrefsSetInt(    cmPrH_t h, unsigned id, const int*    vp, const unsigned* eleCntPtr )
1008
+cmPrRC_t cmPrefsSetIntArray(    cmPrH_t h, unsigned id, const int*    vp, const unsigned* eleCntPtr )
1003
 { return _cmPrefsSetValues(h, id, NULL, vp, NULL, NULL, eleCntPtr ); }
1009
 { return _cmPrefsSetValues(h, id, NULL, vp, NULL, NULL, eleCntPtr ); }
1004
 
1010
 
1005
-cmPrRC_t cmPrefsSetReal(   cmPrH_t h, unsigned id, const double* vp, const unsigned* eleCntPtr )
1011
+cmPrRC_t cmPrefsSetRealArray(   cmPrH_t h, unsigned id, const double* vp, const unsigned* eleCntPtr )
1006
 { return _cmPrefsSetValues(h, id, NULL, NULL, vp, NULL, eleCntPtr ); }
1012
 { return _cmPrefsSetValues(h, id, NULL, NULL, vp, NULL, eleCntPtr ); }
1007
 
1013
 
1008
-cmPrRC_t cmPrefsSetString( cmPrH_t h, unsigned id, const cmChar_t**   vp, const unsigned* eleCntPtr )
1014
+cmPrRC_t cmPrefsSetStringArray( cmPrH_t h, unsigned id, const cmChar_t**   vp, const unsigned* eleCntPtr )
1009
 { return _cmPrefsSetValues(h, id, NULL, NULL, NULL, vp, eleCntPtr ); }
1015
 { return _cmPrefsSetValues(h, id, NULL, NULL, NULL, vp, eleCntPtr ); }
1010
 
1016
 
1011
 
1017
 
1012
-cmPrRC_t cmPrefsSetScalarBool(   cmPrH_t h, const cmChar_t* pathStr, bool val )
1018
+cmPrRC_t cmPrefsSetBool(   cmPrH_t h, unsigned id, bool val )
1019
+{
1020
+  unsigned n = 1;
1021
+  return cmPrefsSetBoolArray(h,id,&val,&n);
1022
+}
1023
+
1024
+cmPrRC_t cmPrefsSetUInt(   cmPrH_t h, unsigned id, unsigned val )
1025
+{
1026
+  unsigned n = 1;
1027
+  int ival = (int)val;
1028
+  return cmPrefsSetIntArray(h,id,&ival,&n);
1029
+}
1030
+
1031
+cmPrRC_t cmPrefsSetInt(    cmPrH_t h, unsigned id, int val )
1032
+{
1033
+  unsigned n = 1;
1034
+  return cmPrefsSetIntArray(h,id,&val,&n);
1035
+}
1036
+
1037
+cmPrRC_t cmPrefsSetFloat(  cmPrH_t h, unsigned id, float val )
1038
+{
1039
+  unsigned n = 1;
1040
+  double dval = val;
1041
+  return cmPrefsSetRealArray(h,id,&dval,&n);
1042
+}
1043
+
1044
+cmPrRC_t cmPrefsSetReal( cmPrH_t h, unsigned id, double val )
1045
+{
1046
+  unsigned n = 1;
1047
+  return cmPrefsSetRealArray(h,id,&val,&n);
1048
+}
1049
+
1050
+cmPrRC_t cmPrefsSetString( cmPrH_t h, unsigned id, const cmChar_t* val )
1051
+{
1052
+  unsigned n = 1;
1053
+  return cmPrefsSetStringArray(h,id,&val,&n);
1054
+}
1055
+
1056
+
1057
+
1058
+
1059
+cmPrRC_t cmPrefsPathSetBool(   cmPrH_t h, const cmChar_t* pathStr, bool val )
1013
 {
1060
 {
1014
   unsigned id;
1061
   unsigned id;
1015
   unsigned n = 1;
1062
   unsigned n = 1;
1016
   if((id = cmPrefsId(h,pathStr,true)) == cmInvalidId )
1063
   if((id = cmPrefsId(h,pathStr,true)) == cmInvalidId )
1017
     return kVarNotFoundPrRC;
1064
     return kVarNotFoundPrRC;
1018
 
1065
 
1019
-  return cmPrefsSetBool(h,id,&val,&n);
1066
+  return cmPrefsSetBoolArray(h,id,&val,&n);
1020
 }
1067
 }
1021
 
1068
 
1022
-cmPrRC_t cmPrefsSetScalarUInt(   cmPrH_t h, const cmChar_t* pathStr, unsigned val )
1069
+cmPrRC_t cmPrefsPathSetUInt(   cmPrH_t h, const cmChar_t* pathStr, unsigned val )
1023
 {
1070
 {
1024
   unsigned id;
1071
   unsigned id;
1025
   unsigned n = 1;
1072
   unsigned n = 1;
1027
     return kVarNotFoundPrRC;
1074
     return kVarNotFoundPrRC;
1028
 
1075
 
1029
   int ival = (int)val;
1076
   int ival = (int)val;
1030
-  return cmPrefsSetInt(h,id,&ival,&n);
1077
+  return cmPrefsSetIntArray(h,id,&ival,&n);
1031
 }
1078
 }
1032
 
1079
 
1033
-cmPrRC_t cmPrefsSetScalarInt(    cmPrH_t h, const cmChar_t* pathStr, int val )
1080
+cmPrRC_t cmPrefsPathSetInt(    cmPrH_t h, const cmChar_t* pathStr, int val )
1034
 {
1081
 {
1035
   unsigned id;
1082
   unsigned id;
1036
   unsigned n = 1;
1083
   unsigned n = 1;
1037
   if((id = cmPrefsId(h,pathStr,true)) == cmInvalidId )
1084
   if((id = cmPrefsId(h,pathStr,true)) == cmInvalidId )
1038
     return kVarNotFoundPrRC;
1085
     return kVarNotFoundPrRC;
1039
 
1086
 
1040
-  return cmPrefsSetInt(h,id,&val,&n);
1087
+  return cmPrefsSetIntArray(h,id,&val,&n);
1041
 }
1088
 }
1042
 
1089
 
1043
-cmPrRC_t cmPrefsSetScalarFloat(  cmPrH_t h, const cmChar_t* pathStr, float val )
1090
+cmPrRC_t cmPrefsPathSetFloat(  cmPrH_t h, const cmChar_t* pathStr, float val )
1044
 {
1091
 {
1045
   unsigned id;
1092
   unsigned id;
1046
   unsigned n = 1;
1093
   unsigned n = 1;
1048
     return kVarNotFoundPrRC;
1095
     return kVarNotFoundPrRC;
1049
 
1096
 
1050
   double dval = val;
1097
   double dval = val;
1051
-  return cmPrefsSetReal(h,id,&dval,&n);
1098
+  return cmPrefsSetRealArray(h,id,&dval,&n);
1052
 }
1099
 }
1053
 
1100
 
1054
-cmPrRC_t cmPrefsSetScalarReal( cmPrH_t h, const cmChar_t* pathStr, double val )
1101
+cmPrRC_t cmPrefsPathSetReal( cmPrH_t h, const cmChar_t* pathStr, double val )
1055
 {
1102
 {
1056
   unsigned id;
1103
   unsigned id;
1057
   unsigned n = 1;
1104
   unsigned n = 1;
1058
   if((id = cmPrefsId(h,pathStr,true)) == cmInvalidId )
1105
   if((id = cmPrefsId(h,pathStr,true)) == cmInvalidId )
1059
     return kVarNotFoundPrRC;
1106
     return kVarNotFoundPrRC;
1060
 
1107
 
1061
-  return cmPrefsSetReal(h,id,&val,&n);
1108
+  return cmPrefsSetRealArray(h,id,&val,&n);
1062
 }
1109
 }
1063
 
1110
 
1064
-cmPrRC_t cmPrefsSetScalarString( cmPrH_t h, const cmChar_t* pathStr, const cmChar_t* val )
1111
+cmPrRC_t cmPrefsPathSetString( cmPrH_t h, const cmChar_t* pathStr, const cmChar_t* val )
1065
 {
1112
 {
1066
   unsigned id;
1113
   unsigned id;
1067
   unsigned n = 1;
1114
   unsigned n = 1;
1068
   if((id = cmPrefsId(h,pathStr,true)) == cmInvalidId )
1115
   if((id = cmPrefsId(h,pathStr,true)) == cmInvalidId )
1069
     return kVarNotFoundPrRC;
1116
     return kVarNotFoundPrRC;
1070
 
1117
 
1071
-  return cmPrefsSetString(h,id,&val,&n);
1118
+  return cmPrefsSetStringArray(h,id,&val,&n);
1072
 }
1119
 }
1073
 
1120
 
1074
 
1121
 
1168
   }
1215
   }
1169
 
1216
 
1170
   // we have followed 'pathString' to the last node which already
1217
   // we have followed 'pathString' to the last node which already
1171
-  // exists in the JSON tree - now we must new JSON nodes to reflect 
1218
+  // exists in the JSON tree - now we must create new JSON nodes to reflect 
1172
   // the remaining path elements
1219
   // the remaining path elements
1173
   for(; i<pathCnt; ++i)
1220
   for(; i<pathCnt; ++i)
1174
   {
1221
   {
1225
 
1272
 
1226
     }
1273
     }
1227
 
1274
 
1275
+    unsigned nxtId = p->id;
1276
+
1228
     // create a pref node to associate with this new level
1277
     // create a pref node to associate with this new level
1229
-    if((pnp = _cmPrefsCreateNode(p, jsPairNodePtr, pnp->pathPtr )) == NULL )
1278
+    if((pnp = _cmPrefsCreateNode(p, jsPairNodePtr, pnp==NULL ? NULL : pnp->pathPtr )) == NULL )
1230
     {
1279
     {
1231
       rc = cmErrMsg(&p->err,kNodeCreateFailPrRC,"Creation failed for the '%s' element of the preference node '%s'.",cmStringNullGuard(pathEleStr),cmStringNullGuard(pathString));
1280
       rc = cmErrMsg(&p->err,kNodeCreateFailPrRC,"Creation failed for the '%s' element of the preference node '%s'.",cmStringNullGuard(pathEleStr),cmStringNullGuard(pathString));
1232
       goto errLabel;
1281
       goto errLabel;
1233
     }
1282
     }
1234
 
1283
 
1284
+    // always leave internal nodes with id=cmInvalidId, leaf node id's will be set below
1285
+    p->id   = nxtId;
1286
+    pnp->id = cmInvalidId;
1287
+
1235
     pathEleStr += strlen(pathEleStr) + 1;
1288
     pathEleStr += strlen(pathEleStr) + 1;
1236
   }
1289
   }
1237
 
1290
 
1238
   assert( pnp != NULL );
1291
   assert( pnp != NULL );
1239
 
1292
 
1240
   // if an preference variable 'id' was given then set it here
1293
   // if an preference variable 'id' was given then set it here
1241
-  if( id != cmInvalidId )
1294
+  if( id == cmInvalidId )
1295
+    pnp->id = _cmPrefsCalcNextAvailId(p);
1296
+  else
1242
   {
1297
   {
1243
     if( _cmPrefsIdToNodePtr(p, id, false ) != NULL )
1298
     if( _cmPrefsIdToNodePtr(p, id, false ) != NULL )
1244
-      cmErrWarnMsg(&p->err,kDuplicateIdPrRC,"The preference variable id '%i' is used by multiple preference variables including '%s'.",cmStringNullGuard(pathString));
1299
+      cmErrWarnMsg(&p->err,kDuplicateIdPrRC,"The preference variable id '%i' is used by multiple preference variables including '%s'.",id,cmStringNullGuard(pathString));
1245
   
1300
   
1246
     pnp->id = id;
1301
     pnp->id = id;
1247
   }
1302
   }
1462
   
1517
   
1463
   sr = 44100;
1518
   sr = 44100;
1464
   n  = 1;
1519
   n  = 1;
1465
-  cmPrefsSetInt(h, cmPrefsId(h,"cfg/srate",true), &sr, &n);
1520
+  cmPrefsSetIntArray(h, cmPrefsId(h,"cfg/srate",true), &sr, &n);
1466
   cmPrefsGetInt(h, cmPrefsId(h,"cfg/chNames/array",true), &sr, &n );
1521
   cmPrefsGetInt(h, cmPrefsId(h,"cfg/chNames/array",true), &sr, &n );
1467
   printf("sr:%i %i\n",sr,n);
1522
   printf("sr:%i %i\n",sr,n);
1468
  
1523
  
1469
   int sarr[] = {10,11,12,13 };
1524
   int sarr[] = {10,11,12,13 };
1470
   n = sizeof(sarr)/sizeof(sarr[0]);
1525
   n = sizeof(sarr)/sizeof(sarr[0]);
1471
-  cmPrefsSetInt(h, cmPrefsId(h,"cfg/chNames/array",true), sarr, &n);
1526
+  cmPrefsSetIntArray(h, cmPrefsId(h,"cfg/chNames/array",true), sarr, &n);
1472
   cmPrefsGetInt(h, cmPrefsId(h,"cfg/chNames/array",true), sarr, &n );
1527
   cmPrefsGetInt(h, cmPrefsId(h,"cfg/chNames/array",true), sarr, &n );
1473
   printf("array:%i %i %i %i n=%i\n",sarr[0],sarr[1],sarr[2],sarr[3],n);
1528
   printf("array:%i %i %i %i n=%i\n",sarr[0],sarr[1],sarr[2],sarr[3],n);
1474
 
1529
 
1475
   int tarr[] = {20,21 };
1530
   int tarr[] = {20,21 };
1476
   n = sizeof(tarr)/sizeof(tarr[0]);
1531
   n = sizeof(tarr)/sizeof(tarr[0]);
1477
-  cmPrefsSetInt(h, cmPrefsId(h,"cfg/chNames/array",true), tarr, &n);
1532
+  cmPrefsSetIntArray(h, cmPrefsId(h,"cfg/chNames/array",true), tarr, &n);
1478
   cmPrefsGetInt(h, cmPrefsId(h,"cfg/chNames/array",true), tarr, &n );
1533
   cmPrefsGetInt(h, cmPrefsId(h,"cfg/chNames/array",true), tarr, &n );
1479
   printf("array:%i %i  n=%i\n",tarr[0],tarr[1],n);
1534
   printf("array:%i %i  n=%i\n",tarr[0],tarr[1],n);
1480
 
1535
 

+ 33
- 17
cmPrefs.h View File

34
 
34
 
35
   bool cmPrefsIsValid( cmPrH_t h );
35
   bool cmPrefsIsValid( cmPrH_t h );
36
 
36
 
37
+  const cmChar_t* cmPrefsFileName( cmPrH_t h );
38
+
37
   // Return last RC.
39
   // Return last RC.
38
   cmPrRC_t cmPrefsRC( cmPrH_t h);
40
   cmPrRC_t cmPrefsRC( cmPrH_t h);
39
 
41
 
52
 
54
 
53
   // On input *'eleCntPtr' must contain the number of elements in the buffer pointed to by 'vp'.
55
   // On input *'eleCntPtr' must contain the number of elements in the buffer pointed to by 'vp'.
54
   // On return *'eleCntPtr' contains the actuall number of elements returned by the function.
56
   // On return *'eleCntPtr' contains the actuall number of elements returned by the function.
57
+  // Set *eleCntPtr to 1 for scalar a values.
55
   cmPrRC_t cmPrefsGetBool(   cmPrH_t h, unsigned id, bool*            vp, unsigned* eleCntPtr );
58
   cmPrRC_t cmPrefsGetBool(   cmPrH_t h, unsigned id, bool*            vp, unsigned* eleCntPtr );
56
   cmPrRC_t cmPrefsGetInt(    cmPrH_t h, unsigned id, int*             vp, unsigned* eleCntPtr );
59
   cmPrRC_t cmPrefsGetInt(    cmPrH_t h, unsigned id, int*             vp, unsigned* eleCntPtr );
57
   cmPrRC_t cmPrefsGetReal(   cmPrH_t h, unsigned id, double*          vp, unsigned* eleCntPtr );
60
   cmPrRC_t cmPrefsGetReal(   cmPrH_t h, unsigned id, double*          vp, unsigned* eleCntPtr );
76
   const cmChar_t* cmPrefsStringDef( cmPrH_t h, const cmChar_t* pathStr, const cmChar_t* dfltVal ); 
79
   const cmChar_t* cmPrefsStringDef( cmPrH_t h, const cmChar_t* pathStr, const cmChar_t* dfltVal ); 
77
 
80
 
78
   // Get a scalar value. 
81
   // Get a scalar value. 
79
-  cmPrRC_t        cmPrefsScalarBool(   cmPrH_t h, const cmChar_t* pathStr, bool*            retValPtr );
80
-  cmPrRC_t        cmPrefsScalarUInt(   cmPrH_t h, const cmChar_t* pathStr, unsigned*        retValPtr );
81
-  cmPrRC_t        cmPrefsScalarInt(    cmPrH_t h, const cmChar_t* pathStr, int*             retValPtr );
82
-  cmPrRC_t        cmPrefsScalarFloat(  cmPrH_t h, const cmChar_t* pathStr, float*           retValPtr );
83
-  cmPrRC_t        cmPrefsScalarReal(   cmPrH_t h, const cmChar_t* pathStr, double*          retValPtr );
84
-  cmPrRC_t        cmPrefsScalarString( cmPrH_t h, const cmChar_t* pathStr, const cmChar_t** retValPtr ); 
82
+  cmPrRC_t        cmPrefsBoolRc(   cmPrH_t h, const cmChar_t* pathStr, bool*            retValPtr );
83
+  cmPrRC_t        cmPrefsUIntRc(   cmPrH_t h, const cmChar_t* pathStr, unsigned*        retValPtr );
84
+  cmPrRC_t        cmPrefsIntRc(    cmPrH_t h, const cmChar_t* pathStr, int*             retValPtr );
85
+  cmPrRC_t        cmPrefsFloatRc(  cmPrH_t h, const cmChar_t* pathStr, float*           retValPtr );
86
+  cmPrRC_t        cmPrefsRealRc(   cmPrH_t h, const cmChar_t* pathStr, double*          retValPtr );
87
+  cmPrRC_t        cmPrefsStringRc( cmPrH_t h, const cmChar_t* pathStr, const cmChar_t** retValPtr ); 
85
 
88
 
86
 
89
 
87
   // Simplified array interface - check cmPrefsRC() for errors
90
   // Simplified array interface - check cmPrefsRC() for errors
108
   // 3) For  scalar (non-array) variables *eleCntPtr must be set to 1.
111
   // 3) For  scalar (non-array) variables *eleCntPtr must be set to 1.
109
   //
112
   //
110
 
113
 
111
-  cmPrRC_t cmPrefsSetBool(   cmPrH_t h, unsigned id, const bool*      vp, const unsigned* eleCntPtr );
112
-  cmPrRC_t cmPrefsSetInt(    cmPrH_t h, unsigned id, const int*       vp, const unsigned* eleCntPtr );
113
-  cmPrRC_t cmPrefsSetReal(   cmPrH_t h, unsigned id, const double*    vp, const unsigned* eleCntPtr );
114
-  cmPrRC_t cmPrefsSetString( cmPrH_t h, unsigned id, const cmChar_t** vp, const unsigned* eleCntPtr );
115
-
116
-  cmPrRC_t cmPrefsSetScalarBool(   cmPrH_t h, const cmChar_t* pathStr, bool     val );
117
-  cmPrRC_t cmPrefsSetScalarUInt(   cmPrH_t h, const cmChar_t* pathStr, unsigned val );
118
-  cmPrRC_t cmPrefsSetScalarInt(    cmPrH_t h, const cmChar_t* pathStr, int      val );
119
-  cmPrRC_t cmPrefsSetScalarFloat(  cmPrH_t h, const cmChar_t* pathStr, float    val );
120
-  cmPrRC_t cmPrefsSetScalarReal(   cmPrH_t h, const cmChar_t* pathStr, double   val );
121
-  cmPrRC_t cmPrefsSetScalarString( cmPrH_t h, const cmChar_t* pathStr, const cmChar_t* val );
114
+  cmPrRC_t cmPrefsSetBoolArray(   cmPrH_t h, unsigned id, const bool*      vp, const unsigned* eleCntPtr );
115
+  cmPrRC_t cmPrefsSetIntArray(    cmPrH_t h, unsigned id, const int*       vp, const unsigned* eleCntPtr );
116
+  cmPrRC_t cmPrefsSetRealArray(   cmPrH_t h, unsigned id, const double*    vp, const unsigned* eleCntPtr );
117
+  cmPrRC_t cmPrefsSetStringArray( cmPrH_t h, unsigned id, const cmChar_t** vp, const unsigned* eleCntPtr );
118
+
119
+  cmPrRC_t cmPrefsSetBool(   cmPrH_t h, unsigned id, bool     val );
120
+  cmPrRC_t cmPrefsSetUInt(   cmPrH_t h, unsigned id, unsigned val );
121
+  cmPrRC_t cmPrefsSetInt(    cmPrH_t h, unsigned id, int      val );
122
+  cmPrRC_t cmPrefsSetFloat(  cmPrH_t h, unsigned id, float    val );
123
+  cmPrRC_t cmPrefsSetReal(   cmPrH_t h, unsigned id, double   val );
124
+  cmPrRC_t cmPrefsSetString( cmPrH_t h, unsigned id, const cmChar_t* val );
125
+
126
+  cmPrRC_t cmPrefsPathSetBool(   cmPrH_t h, const cmChar_t* pathStr, bool     val );
127
+  cmPrRC_t cmPrefsPathSetUInt(   cmPrH_t h, const cmChar_t* pathStr, unsigned val );
128
+  cmPrRC_t cmPrefsPathSetInt(    cmPrH_t h, const cmChar_t* pathStr, int      val );
129
+  cmPrRC_t cmPrefsPathSetFloat(  cmPrH_t h, const cmChar_t* pathStr, float    val );
130
+  cmPrRC_t cmPrefsPathSetReal(   cmPrH_t h, const cmChar_t* pathStr, double   val );
131
+  cmPrRC_t cmPrefsPathSetString( cmPrH_t h, const cmChar_t* pathStr, const cmChar_t* val );
122
 
132
 
123
   // Create a new preference variable and set it's value to 'val'.
133
   // Create a new preference variable and set it's value to 'val'.
124
   // If a variable with the same path and type already exists and kForceValuePrFl is set then update it's value to 'val'.
134
   // If a variable with the same path and type already exists and kForceValuePrFl is set then update it's value to 'val'.
126
   //
136
   //
127
   // If a variable with the same path but a different type exists then an error is returned.
137
   // If a variable with the same path but a different type exists then an error is returned.
128
   // 
138
   // 
139
+  // The 'id' argument is optional.  If 'id' is set to cmInvalidId then the
140
+  // variable will be automatically assigned an id.  The value of the
141
+  // automatically assigned id can be found from the path string
142
+  // via cmPrefsId()
129
 
143
 
130
   // Set kForceValuePrFl 
144
   // Set kForceValuePrFl 
131
   enum { kForceValuePrFl=0x01 };
145
   enum { kForceValuePrFl=0x01 };
144
   cmPrRC_t cmPrefsCreateStringArray( cmPrH_t h, unsigned id, const cmChar_t* pathStr, unsigned flags, const cmChar_t** val, unsigned eleCnt );
158
   cmPrRC_t cmPrefsCreateStringArray( cmPrH_t h, unsigned id, const cmChar_t* pathStr, unsigned flags, const cmChar_t** val, unsigned eleCnt );
145
 
159
 
146
   bool     cmPrefsIsDirty( cmPrH_t h );
160
   bool     cmPrefsIsDirty( cmPrH_t h );
161
+
162
+  // If 'fn' is NULL then the filename passed in cmPrefsInitialize() is used.
147
   cmPrRC_t cmPrefsWrite( cmPrH_t h, const cmChar_t* fn );
163
   cmPrRC_t cmPrefsWrite( cmPrH_t h, const cmChar_t* fn );
148
 
164
 
149
 
165
 

Loading…
Cancel
Save