• Skip to content
  • Skip to link menu
KDE 4.2 API Reference
  • KDE API Reference
  • kdepim
  • Sitemap
  • Contact Us
 

akregator

c4_Storage Class Reference

#include <mk4.h>

Inheritance diagram for c4_Storage:

Inheritance graph
[legend]

List of all members.


Detailed Description

Manager for persistent storage of view structures.

The storage class uses a view, with additional functionality to be able to store and reload the data it contains (including nested subviews).

By default, data is loaded on demand, i.e. whenever data which has not yet been referenced is used for the first time. Loading is limited to the lifetime of this storage object, since the storage object carries the file descriptor with it that is needed to access the data file.

To save changes, call the Commit member. This is the only time that data is written to file - when using a read-only file simply avoid calling Commit.

The LoadFromStream and SaveToStream members can be used to serialize the contents of this storage row using only sequential I/O (no seeking, only read or write calls).

The data storage mechanism implementation provides fail-safe operation: if anything prevents Commit from completing its task, the last succesfully committed version of the saved data will be recovered on the next open. This also includes changes made to the table structure.

The following code creates a view with 1 row and stores it on file:

    c4_StringProp pName ("Name");
    c4_IntProp pAge ("Age");

    c4_Storage storage ("myfile.dat", true);
    c4_View myView = storage.GetAs("Musicians[Name:S,Age:I]");

    myView.Add(pName ["John Williams"] + pAge [43]);

    storage.Commit();

Definition at line 534 of file mk4.h.


Public Member Functions

bool AutoCommit (bool=true)
 c4_Storage (const c4_View &)
 c4_Storage (const char *, int)
 c4_Storage (c4_Strategy &, bool=false, int=1)
 c4_Storage ()
bool Commit (bool=false)
const char * Description (const char *=0)
t4_i32 FreeSpace (t4_i32 *bytes_=0)
c4_View GetAs (const char *)
c4_Storage * GetAside () const
bool LoadFrom (c4_Stream &)
bool Rollback (bool=false)
void SaveTo (c4_Stream &)
bool SetAside (c4_Storage &)
void SetStructure (const char *)
c4_Strategy & Strategy () const
c4_ViewRef View (const char *)
 ~c4_Storage ()

Constructor & Destructor Documentation

c4_Storage::c4_Storage (  ) 

Construct streaming-only storage object.

Definition at line 186 of file store.cpp.

c4_Storage::c4_Storage ( c4_Strategy &  strategy_,
bool  owned_ = false,
int  mode_ = 1 
)

Construct a storage using the specified strategy handler.

Definition at line 191 of file store.cpp.

c4_Storage::c4_Storage ( const char *  fname_,
int  mode_ 
)

Construct a storage object, keeping the current structure.

Definition at line 196 of file store.cpp.

c4_Storage::c4_Storage ( const c4_View &  root_  ) 

Reconstruct a storage object from a suitable view.

Definition at line 205 of file store.cpp.

c4_Storage::~c4_Storage (  ) 

Destructor, usually closes file, but does not commit by default.

Definition at line 214 of file store.cpp.


Member Function Documentation

bool c4_Storage::AutoCommit ( bool  flag_ = true  ) 

Set storage up to always call Commit in the destructor.

Definition at line 378 of file store.cpp.

bool c4_Storage::Commit ( bool  full_ = false  ) 

Flush pending changes to file right now.

Definition at line 361 of file store.cpp.

const char * c4_Storage::Description ( const char *  name_ = 0  ) 

Return a description of the view structure (default is all).

Definition at line 338 of file store.cpp.

t4_i32 c4_Storage::FreeSpace ( t4_i32 *  bytes_ = 0  ) 

Definition at line 404 of file store.cpp.

c4_View c4_Storage::GetAs ( const char *  description_  ) 

Get a named view, redefining it to match the given structure.

Definition at line 253 of file store.cpp.

c4_Storage * c4_Storage::GetAside (  )  const

Return storage used for differential commits, or null.

Definition at line 356 of file store.cpp.

bool c4_Storage::LoadFrom ( c4_Stream &  stream_  ) 

Load contents from the specified input stream.

Definition at line 383 of file store.cpp.

bool c4_Storage::Rollback ( bool  full_ = false  ) 

(Re)initialize for on-demand loading

Calling Rollback will cancel all uncommitted changes.

Definition at line 369 of file store.cpp.

void c4_Storage::SaveTo ( c4_Stream &  stream_  ) 

Save contents to the specified output stream.

Definition at line 400 of file store.cpp.

bool c4_Storage::SetAside ( c4_Storage &  aside_  ) 

Define the storage to use for differential commits.

Definition at line 347 of file store.cpp.

void c4_Storage::SetStructure ( const char *  description_  ) 

Define the complete view structure of the storage.

Definition at line 317 of file store.cpp.

c4_Strategy & c4_Storage::Strategy (  )  const

Return the strategy object associated with this storage.

Definition at line 333 of file store.cpp.

c4_ViewRef c4_Storage::View ( const char *  name_  ) 

Get or set a named view in this storage object.

Definition at line 228 of file store.cpp.


The documentation for this class was generated from the following files:
  • mk4.h
  • store.cpp

akregator

Skip menu "akregator"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members

kdepim

Skip menu "kdepim"
  • akonadi
  •   clients
  •   kabc
  •   kcal
  •   kcm
  • akregator
  • console
  •   kabcclient
  •   konsolekalendar
  • kaddressbook
  • kalarm
  •   lib
  • kdgantt
  • kdgantt1
  • kjots
  • kleopatra
  • kmail
  • kmobiletools
  • knode
  • knotes
  • kontact
  • kontactinterfaces
  • korganizer
  •   korgac
  • kpilot
  • ktimetracker
  •   doc
  • libkdepim
  • libkholidays
  • libkleo
  • libkpgp
  • maildir
Generated for kdepim by doxygen 1.5.4
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal