SASC
DVBSoftCAM

cStructLoaderPlain Class Reference

#include <data.h>

Inheritance diagram for cStructLoaderPlain:

List of all members.

Public Member Functions

 cStructLoaderPlain (const char *Type, const char *Filename, int Flags)
virtual void Load (bool reload)
virtual void Save (void)
 cStructLoaderPlain (const char *Type, const char *Filename, int Flags)
virtual void Load (bool reload)
virtual void Save (void)

Protected Member Functions

virtual cStructItem * ParseLine (char *line)
virtual bool ParseLinePlain (const char *line)=0
virtual void PreLoad (void)
virtual void PreSave (FILE *f)
virtual void PostSave (FILE *f)
virtual cStructItem * ParseLine (char *line)
virtual bool ParseLinePlain (const char *line)=0
virtual void PreLoad (void)
virtual void PreSave (FILE *f)
virtual void PostSave (FILE *f)

Detailed Description

Definition at line 163 of file data.h.


Constructor & Destructor Documentation

cStructLoaderPlain::cStructLoaderPlain ( const char *  Type,
const char *  Filename,
int  Flags 
)

Definition at line 421 of file data.c.

:cStructLoader(Type,Filename,Flags)
{}
cStructLoaderPlain::cStructLoaderPlain ( const char *  Type,
const char *  Filename,
int  Flags 
)

Member Function Documentation

void cStructLoaderPlain::Load ( bool  reload) [virtual]

Reimplemented from cStructLoader.

Definition at line 432 of file data.c.

References cStructLoader::CheckAccess(), L_GEN_ERROR, L_GEN_INFO, cStructLoader::ListLock(), cStructLoader::ListUnlock(), cStructLoader::LoadFinished(), cStructLoader::OpenFailed(), ParseLinePlain(), cStructLoader::path, cStructLoader::PostLoad(), PreLoad(), PRINTF, skipspace(), SL_CLRFLAG, SL_DISABLED, SL_LOADED, SL_SETFLAG, SL_TSTFLAG, strreplace(), and cStructLoader::type.

Referenced by cTpsAuHook::DummyProcess().

{
  if(SL_TSTFLAG(SL_DISABLED) || reload) return;
  FILE *f=fopen(path,"r");
  if(f) {
    PreLoad();
    ListLock(true);
    SL_SETFLAG(SL_LOADED);
    PRINTF(L_GEN_INFO,"loading %s from %s",type,path);
    CheckAccess();
    int lineNum=0;
    char buff[4096];
    while(fgets(buff,sizeof(buff),f)) {
      lineNum++;
      if(!index(buff,'\n') && !feof(f)) {
        PRINTF(L_GEN_ERROR,"file %s readbuffer overflow line#%d",path,lineNum);
        SL_CLRFLAG(SL_LOADED);
        break;
        }
      strreplace(buff,'\n',0); strreplace(buff,'\r',0); // chomp
      bool hasContent=false;
      char *ls;
      for(ls=buff; *ls; ls++) {
        if(*ls==';' || *ls=='#') break;
        if(*ls>' ') hasContent=true;
        }
      if(hasContent) {
        *ls=0;
        if(!ParseLinePlain(skipspace(buff)))
          PRINTF(L_GEN_ERROR,"file %s has error in line #%d",path,lineNum);
        }
      }
    ListUnlock();
    PostLoad();
    fclose(f);
    LoadFinished();
    }
  else
    OpenFailed();
}
virtual void cStructLoaderPlain::Load ( bool  reload) [virtual]

Reimplemented from cStructLoader.

virtual cStructItem* cStructLoaderPlain::ParseLine ( char *  line) [inline, protected, virtual]

Implements cStructLoader.

Definition at line 165 of file data.h.

{ return 0; }
virtual cStructItem* cStructLoaderPlain::ParseLine ( char *  line) [inline, protected, virtual]

Implements cStructLoader.

Definition at line 165 of file data.h.

{ return 0; }
virtual bool cStructLoaderPlain::ParseLinePlain ( const char *  line) [protected, pure virtual]
virtual bool cStructLoaderPlain::ParseLinePlain ( const char *  line) [protected, pure virtual]
virtual void cStructLoaderPlain::PostSave ( FILE *  f) [inline, protected, virtual]

Reimplemented in cTpsKeys, and cTpsKeys.

Definition at line 169 of file data.h.

Referenced by Save().

{};
virtual void cStructLoaderPlain::PostSave ( FILE *  f) [inline, protected, virtual]

Reimplemented in cTpsKeys, and cTpsKeys.

Definition at line 169 of file data.h.

{};
virtual void cStructLoaderPlain::PreLoad ( void  ) [protected, virtual]

Reimplemented from cStructLoader.

Reimplemented in cTpsKeys, and cTpsKeys.

void cStructLoaderPlain::PreLoad ( void  ) [protected, virtual]

Reimplemented from cStructLoader.

Reimplemented in cTpsKeys, and cTpsKeys.

Definition at line 425 of file data.c.

References cSimpleListBase::Clear(), cStructLoader::ListLock(), cStructLoader::ListUnlock(), and cStructLoader::Modified().

Referenced by Load().

{
  ListLock(true);
  Clear(); Modified(false);
  ListUnlock();
}
virtual void cStructLoaderPlain::PreSave ( FILE *  f) [protected, virtual]
void cStructLoaderPlain::PreSave ( FILE *  f) [protected, virtual]

Definition at line 473 of file data.c.

Referenced by Save().

{
  fprintf(f,"## This is a generated file. DO NOT EDIT!!\n"
            "## This file will be OVERWRITTEN WITHOUT WARNING!!\n");
}
void cStructLoaderPlain::Save ( void  ) [virtual]
virtual void cStructLoaderPlain::Save ( void  ) [virtual]

Reimplemented from cStructLoader.


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines