BinaryListComponent
#include <binarylistcomponent.h>
Public Member Functions | |
BinaryListComponent (Component *parent, QString basename) | |
BinaryListComponent (Component *parent, QString basename, QString txtExt, QString binExt) | |
Protected Member Functions | |
virtual void | clearData () |
virtual bool | dropBinary () |
virtual bool | dropText () |
virtual void | loadData () |
virtual void | loadData (bool dropBinaryFile) |
virtual void | loadDataFromBinary () |
virtual void | loadDataFromBinary (QFile &binfile) |
virtual void | loadDataFromText ()=0 |
virtual void | writeBinary () |
virtual void | writeBinary (QFile &binfile) |
Protected Attributes | |
QString | filepath_bin |
QString | filepath_txt |
Detailed Description
class BinaryListComponent< T, Component >
provides functionality for loading the component data from Binary
- Version
- 1.0
This class is an abstract Template which requires that the type T
is some child of SkyObject
and the type Component
is some child of ListComponent
. The class T
must provide a static TYPE
property of the type SkyObject::TYPE
. This is required because access to the type()
method is inconvenient here!
The derived class must provide a void loadFromText()
method, which loads the component via addListObject
or similar. (This method implements parsing etc, and cannot be abstracted by this class.)
Finally, one has to add this template as a friend class upon deriving it. This is a concession to the already present architecture.
File paths are determent by the means of KSPaths::writableLocation.
Definition at line 39 of file binarylistcomponent.h.
Constructor & Destructor Documentation
◆ BinaryListComponent() [1/2]
BinaryListComponent< T, Component >::BinaryListComponent | ( | Component * | parent, |
QString | basename ) |
- Parameters
-
parent a reference to the inheriting child basename the base filename for the binary
Sets the file extensions to dat
for text and bin
for binary.
Definition at line 147 of file binarylistcomponent.h.
◆ BinaryListComponent() [2/2]
BinaryListComponent< T, Component >::BinaryListComponent | ( | Component * | parent, |
QString | basename, | ||
QString | txtExt, | ||
QString | binExt ) |
- Parameters
-
parent a reference to the inheriting child basename the base filename for the binary txtExt text data file extension binExt binary data file extension
Definition at line 150 of file binarylistcomponent.h.
Member Function Documentation
◆ clearData()
|
protectedvirtual |
clearData
Removes the current component data where necessary.
Definition at line 252 of file binarylistcomponent.h.
◆ dropBinary()
|
protectedvirtual |
dropBinary
Removes the binary file.
- Returns
- True if operation succeeds
Definition at line 240 of file binarylistcomponent.h.
◆ dropText()
|
protectedvirtual |
dropText
Removes the text file.
- Returns
- True if operation succeeds
Definition at line 246 of file binarylistcomponent.h.
◆ loadData() [1/2]
|
protectedvirtual |
◆ loadData() [2/2]
|
protectedvirtual |
loadData
Load the component data from binary (if available) or from text
- Parameters
-
dropBinaryFile whether to drop the current binary (and to recreate it)
Tip: If you want to reload the data and recreate the binfile, just call loadData(true).
Definition at line 163 of file binarylistcomponent.h.
◆ loadDataFromBinary() [1/2]
|
protectedvirtual |
loadDataFromBinary
Opens the default binfile and calls loadDataFromBinary([FILE])
Definition at line 182 of file binarylistcomponent.h.
◆ loadDataFromBinary() [2/2]
|
protectedvirtual |
loadDataFromBinary
- Parameters
-
binfile the binary file
Loads the component data from the given binary.
Definition at line 189 of file binarylistcomponent.h.
◆ loadDataFromText()
|
protectedpure virtual |
loadDataFromText
Load the component data from text.
This method shall be implemented by those who derive this class.
This method should load the component data from text by the use of addListObject
or similar.
◆ writeBinary() [1/2]
|
protectedvirtual |
writeBinary
Opens the default binfile and calls writeBinary([FILE])
Definition at line 216 of file binarylistcomponent.h.
◆ writeBinary() [2/2]
|
protectedvirtual |
writeBinary
- Parameters
-
binfile
Writes the component data to the specified binary. (Destructive)
Definition at line 223 of file binarylistcomponent.h.
Member Data Documentation
◆ filepath_bin
|
protected |
Definition at line 138 of file binarylistcomponent.h.
◆ filepath_txt
|
protected |
Definition at line 137 of file binarylistcomponent.h.
The documentation for this class was generated from the following file:
Documentation copyright © 1996-2024 The KDE developers.
Generated on Sat Dec 21 2024 17:04:47 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.