List of ancestors:
Desc. & Idea | Warnings | Methods | Attributes | Operators | Specials |
|
![]() |
![]() |
![]() |
![]() |
![]() |
Methods beginning with Get or Set (get/set) are usually intended to access Attributes of same name (exceptions will be marked). |
This class is intended to simply access and use a bunch of parametric files as shown in the params.h.
Avoid to open a file with flSet ("save after work") flag more then ones. This
is because during the save the file is overwritten not changed.
Inserted parameters are really inserted not copied.
Don't create any parts of TParamFile on stack(TGroup, TAParam, TPFileID)
as they are destroyed with the parent TParamFile.
Public:
void AddDirective(char *aFilename,char *aDirective) | |
void AddFileID(TPFileID *Who) | |
void AddRemark(char *aFilename,char *aRemark) | |
![]() |
TAParam *AddParam(TAParam *NewParam,char* Groupname,char* Filename) |
BOOL ChangeFilename(char *From, char *To) | |
void Clear() | |
void Close(char *aFilename) | |
![]() ![]() |
BOOL Exist(char *) |
TParamFile *Extract(char * aFilename) | |
TStrList *GetDirectives(char *aFilename) | |
![]() ![]() |
TPFileID* GetFileID(char *FileName) |
![]() ![]() |
TGroup * GetGroup(char *Called) |
TPFileID *GetNo1FileID() | |
![]() |
TAParam *GetParam(char *Called) |
TStrList *GetRemarks(char *aFilename) | |
![]() ![]() |
uint GetSerSize(BOOL subclass=FALSE) |
void Load(char *aFilename,TFlag OpenType=flNotSet,BOOL Control=TRUE) | |
void Merge(TParamFile &With, BOOL Control=TRUE) | |
![]() |
BOOL ReadBool(char *Called,BOOL DefVal) |
![]() |
char ReadChar(char *Called,char DefVal) |
![]() |
float ReadFloat(char *Called,float DefVal) |
![]() |
int ReadInt(char *Called,int DefVal) |
![]() |
char *ReadString(char *Called,char *DefVal) |
![]() |
TFit ReadTFit(char *Called,TFit DefVal) |
![]() |
TProb ReadTProb(char *Called,TProb DefVal) |
void Save(char *aFilename) | |
void SaveAll() | |
void SaveInto(char *aFilename) | |
![]() ![]() |
uint Serialize(BYTE **rawbytes,BOOL subclass=FALSE) |
![]() ![]() |
TParamFile(BYTE** raw,uint length,BOOL subclass) |
![]() ![]() |
TParamFile(char *aFilename=NULL, TFlag OpenType=flNotSet) |
![]() |
~TParamFile(void) |
Protected:
void Compact() | |
TPFileID *EjectFileID(char *aName) | |
TGroup *GetFirstGrp() | |
TAParam *GetFirstParam() | |
TGroup *InsertGroup(TGroup *Who,BOOL Control=TRUE) | |
TAParam *InsertParam(TAParam *Who,char *GroupName,BOOL Control=TRUE) | |
BOOL IsSingle() | |
void NeedCompactUp() | |
void PutAtBeginning (TAParam *Who) | |
void PutFileID(TPFileID *thing,FILE *into,BOOL trimed=FALSE) | |
void PutGroup(TGroup *thing,FILE *into) | |
void PutParam(TAParam *thing,FILE *into) | |
void SaveAsociated(TPFileID *asoc,FILE *into) | |
void SetFirstGrp(TGroup *val) | |
void SetFirstParam(TAParam* Who) | |
void WorkUpDirectives(TStrList &Directives, TFlag InheritedState) |
Private:
Adds a directive line into the TPFileID specified by a
Filename.
The line is copied.
aFilename...specifies the TPFileID which the directive insert to
aDirecive...the directive line
Inserts the specified TPFileID into the hierarchy
Who...specifies the TPFileID which should be inserted
Adds a remark line into the TPFileID specified by a
Filename.
The line is copied.
aFilename...specifies the TPFileID which the remark insert to
Inserts the specified TAParam into the structure. If the group or TPFileID of the specified names doesn't exist, they are created. The parameter is bounded in not copied.
NewParam... ..the parameter to be inserted
Groupname....the name of the group which the parameter should be inserted to
Filename....the name of the file the parameter belongs to
Returns the pointer to the inserted parameter.
Changes a TPFileID.Filename specified by the string From to the value To. But this happens only if TPFileID.Filename of value does not exist already.
From... ..old filename; specifies the TPFileID to be
affected
To....new filename
Returns TRUE if the operation was successful. If the TPFileID.Filename was not changed FALSE is returned
Deletes all parameters, groups and FileIDs. The structure remains empty like after a
call of the constructor without parameters.
TParamFile(char *, TFlag)
Removes the FileID specified by aFilename and saves it if it is said by TPFileID.Saveable. All params pointing to this FileID are also deleted.
aFilename...name of the parametric file to be closed
TPFileID.Saveable, TAParam.SourceFile
Answers the question of the existence of a parameter in the structure. If the parameter is found, it is placed on the beginning of the list so later access is faster.
aPar...name of the parameter, that should be looked for.
TRUE if a parameter of the specified name exists, otherwise FALSE.
Creates a new TParamFile structure filled with FileID of the specified aFilename and all belonging parameters with their groups. If there is no FileID with the aFilename no new structure is created
aFilename...name of the file which parameters should be extracted
Pointer to the new structure. If a FileID is not found NULL is returned.
Merge, operator <<, operator >>
Get the directives obtained from a specified file.
aFilename....the file the directives was taken from
The TStrList with the directives.
Finds the FileID with the specified Filename in the structure.
Filename....the name of the file which the FileID is associated with.
The TPFileID with the specified Filename or NULL if no such exists.
Finds the Group with the specified name in the structure.
Called....the name of the group to be found
The appropriate TGroup or NULL if no group of the Called name exists.
Return the first FileID in the list.
Searches for a parameter with the specified name. If the parameter is found it is placed at the beginning of the list for later faster access.
Called...the name of the parameter
the parameter with the specified name or if no such exists the NotExists is returned
TParamFile[], TParamFile.Exist, NotExists, TAParam.Name
Get the remarks obtained from a specified file.
aFilename....the file the remarks was taken from
The TStrList with the remarks.
Loads the parameters (builds the structure) from a specified file. The existing structure is destroyed. All directives are handled also.
aFilename....the source file
OpenType...the type the file will be handled (changes will be written back or not)
Control....control the duplicity of parameter names
Save, SaveAll, SaveInto,
Close
The structure specified by the With parameter is build into the local structure.
With.....the TParamFile structure, that should be merged
into the local structure.
Control.... to control or not the duplicity of parameter names. The same named parameter
stays int the old striker.
These functions (ReadBool, ReadChar, ReadFloat, ReadInt, ReadString, ReadTFit, ReadTProb) can be used to obtain values from the structure.
Called....name of the parameter
DefVal....default value, that should be returned, if no parameter with the specified name
exists
value of the parameter as a type you required, or a DefVal if no parameter is found
Save the specified file with all parameters, groups, remarks and directives belonging into it. Ignores the Saveable TFlag in TPFileID.
aFilename...name of the file to be saved
Save all file in the structure (all TPFileID). All items are added to their parent files. TFlag is ignored.
The complete structure is saved into one file. File directives are omitted. The structure is not affected.
aFilename...the target filename
Deserialization constructor. Rebuilds the structure from the rawbytes serialized before.
Constructor. Creates a new empty structure. If aFilename is specified the file is loaded.
aFilename....name of the file to be loaded, if NULL the structure remains
empty
OpenType...how to handle the file
Destructor.The structure is closed and all items are destroyed.
Inserts the specified TGroup into the hierarchy. This function is for internal use only. Instead use the function AddParam.
Who...specifies the TGroup which should be inserted.
Control...If this flag is set to true, the structure is controlled for existence of a group of the same name If such a group exists items are rather inserted into it, not the new group just simply inserted.
Returns the pointer to the target group. The inserted one or , if controlled and exists, the group of the same name that is used for inserted subitems.
Inserts the specified TAParam into the hierarchy. This function is for internal use only. Instead use the function AddParam.
Who...specifies the TAParam which should be inserted
GroupName...target group.
Control...control or not the existence of a parameter of the same name.
Returns the pointer to the final TAParam.
Public:
Protected:
Private:
BOOL NeedCompact |
Pointer to the first item of the groups list.
Pointer to the fist item of the params list.
Pointer to the TAParam that is returned, when a
parameter of the specified name doesn't exist. It contains the default values: 0, FALSE,
"", #0, 0% etc. The values are read only. The SetValue
procedure has no effect.
Pointer to the fist item of the TPFileIDs list.
Flag to specify if the control for empty groups and file IDs is required before a save.
Public:
![]() |
TAParam& operator [] (char* Called) |
TParamFile& operator << (TParamFile &With) | |
TParamFile& operator >> (TParamFile &With) |
Protected:
Private:
Returns the TAParam of the specified name. Unlike the function GetParam it return a reference to this object, so a pointed notation can be used. So as the GetParam, if the TAParam doesn't exist, the NotExist param is returned.
Called....the name of the parameter wanted.
reference to the requested parameter
Merges the With parameter into the local structure. See method Merge.
With.....the TParamFile structure, that should be merged into the local structure.
reference to the reorganised local structure
Merges the local striker into the With parameter. See method Merge.
With.....the target TParamFile structure
reference to the reorganised With structure
For the syntax of a parametric file see params.h