|
| RRecFile (void) |
|
| RRecFile (const RURI &uri, size_t recsize) |
|
virtual void | Open (RIO::ModeType mode) |
|
void | Open (const RURI &uri, size_t recsize, RIO::ModeType mode=RIO::Read) |
|
virtual void | Close (void) |
|
void | GoToRec (size_t nb) |
|
void | GoToRec (size_t c, size_t l, size_t maxc) |
|
template<class TUse > |
size_t | Search (const TUse &tag) |
|
bool | FindRecord (void) |
|
size_t | GetRecNb (void) const |
|
size_t | GetCurrentRec (void) const |
|
void | ReadRec (C &rec) |
|
void | WriteRec (C &rec) |
|
void | Start (void) |
|
void | Next (void) |
|
void | Prev (void) |
|
C * | operator() (void) |
|
virtual | ~RRecFile (void) |
|
| RBinaryFile (void) |
|
| RBinaryFile (const RURI &name) |
|
| RBinaryFile (RIOFile &file) |
|
void | Open (const RURI &uri, RIO::ModeType mode) |
|
RBinaryFile & | operator>> (bool &b) |
|
RBinaryFile & | operator>> (char *str) |
|
RBinaryFile & | operator>> (RString &str) |
|
RBinaryFile & | operator>> (char &nb) |
|
RBinaryFile & | operator>> (unsigned char &nb) |
|
RBinaryFile & | operator>> (int &nb) |
|
RBinaryFile & | operator>> (unsigned int &nb) |
|
RBinaryFile & | operator>> (long &nb) |
|
RBinaryFile & | operator>> (unsigned long &nb) |
|
RBinaryFile & | operator>> (long long &nb) |
|
RBinaryFile & | operator>> (unsigned long long &nb) |
|
RBinaryFile & | operator>> (float &nb) |
|
RBinaryFile & | operator>> (double &nb) |
|
RBinaryFile & | operator<< (bool b) |
|
RBinaryFile & | operator<< (char *str) |
|
RBinaryFile & | operator<< (RString &str) |
|
RBinaryFile & | operator<< (char nb) |
|
RBinaryFile & | operator<< (unsigned char nb) |
|
RBinaryFile & | operator<< (int nb) |
|
RBinaryFile & | operator<< (unsigned int nb) |
|
RBinaryFile & | operator<< (long nb) |
|
RBinaryFile & | operator<< (unsigned long nb) |
|
RBinaryFile & | operator<< (long long nb) |
|
RBinaryFile & | operator<< (unsigned long long nb) |
|
RBinaryFile & | operator<< (float nb) |
|
RBinaryFile & | operator<< (double nb) |
|
virtual | ~RBinaryFile (void) |
|
| RIOFile (void) |
|
| RIOFile (const RURI &uri) |
|
| RIOFile (RIOFile &file) |
|
RURI | GetRealName (void) const |
|
void | Open (const RURI &uri, RIO::ModeType mode) |
|
bool | IsOpen (void) const |
|
size_t | Read (char *buffer, size_t nb, bool move=true) |
|
void | Write (const char *buffer, size_t nb) |
|
virtual void | Seek (off_t pos) |
|
virtual void | SeekRel (off_t pos) |
|
virtual void | SeekToEnd (void) |
|
void | Truncate (off_t newsize) |
|
bool | End (void) const |
|
off_t | GetSize (void) const |
|
off_t | GetPos (void) const |
|
virtual | ~RIOFile (void) |
|
| RFile (void) |
|
| RFile (const RURI &uri) |
|
| RFile (const RFile &file) |
|
void | Open (const RURI &uri, RIO::ModeType mode) |
|
int | Compare (const RFile &file) const |
|
int | Compare (const RFile *file) const |
|
int | Compare (const RString &uri) const |
|
const RURI & | GetURI (void) const |
|
void | SetURI (const RURI &uri) |
|
const RString | GetFileName (void) const |
|
virtual | ~RFile (void) |
|
template<class C, bool bOrder = false>
class R::RRecFile< C, bOrder >
Fixed-length Records File.
- Template Parameters
-
C | The class of the elements to be read/write. |
bOrder | Specify if the elements are ordered in the file. |
The RRecFile class implements some basic functions needed when working with files for records. This files can be accessed as ordered or not. Opening a non ordered file as ordered gives problems.
As for the RContainer class, the TUse represent a class or a structure used for the comparaisons.
At least, one read function must be implemented in the class C:
void Read(R::RecFile<C,bOrder>& f);
The user can write his own operators to read and write record from a RRecFile. Here is an example:
class Person
{
public:
Person(void) {}
Person(const Person& p) : LastName(p.LastName), FirstName(p.FirstName) {}
int Compare(
const Person& p)
const {
return(LastName.
Compare(p.LastName));}
};
{
char Buf[41];
LastName=Buf;
FirstName=Buf;
}
{
char Buf[41];
strcpy(Buf,LastName.Latin1());
strcpy(Buf,FirstName.Latin1());
}
int main(int argc, char *argv[])
{
Cont.InsertPtr(new Person("Jagger","Mike"));
Cont.InsertPtr(new Person("Gillian","Ian"));
Cont.InsertPtr(new Person("Plant","Robert"));
Cont.InsertPtr(new Person("Coverdale","David"));
Cont.Clear();
Cont.InsertPtr(
new Person(*
File()));
std::cout<<
" "<<Cur()->LastName<<
", "<<Cur()->FirstName<<
std::endl;
if(
File.Search(
"Gillian"))
}